/* App styles on top of @zdanowicz/ui (web/static/ui, vendored). Use --z-* tokens only. */
.home { padding-top: var(--z-space-12); }

/* Login / register */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--z-space-6); background: var(--z-color-bg-subtle); }
.auth__card { width: 100%; max-width: 380px; padding: var(--z-space-8); background: var(--z-color-bg-default); border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-lg); }
.auth__title { margin: 0; font-size: var(--z-font-size-xl); line-height: var(--z-font-line-xl); font-weight: var(--z-font-weight-semibold); }
.logout { display: inline; margin: 0; }

/* App shell & issues list */
.nav__logout { margin-top: auto; padding-top: var(--z-space-4); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--z-space-3); padding: var(--z-space-3) var(--z-space-6); border-bottom: 1px solid var(--z-color-border-muted); }
.filters { align-items: center; }
.list-menu { position: relative; }
.list-menu > summary { list-style: none; cursor: pointer; }
.list-menu > summary::-webkit-details-marker { display: none; }
.list-menu__panel { position: absolute; z-index: 10; top: 100%; left: 0; min-width: 200px; max-height: 70vh; overflow: auto; margin-top: var(--z-space-1); padding: var(--z-space-1); background: var(--z-color-bg-default); border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-md); display: flex; flex-direction: column; }
.list-menu__panel a, .list-menu__group > summary { padding: var(--z-space-1) var(--z-space-2); border-radius: var(--z-radius-md); color: var(--z-color-fg-default); text-decoration: none; cursor: pointer; }
.list-menu__panel a:hover, .list-menu__group > summary:hover { background: var(--z-color-bg-hover); }
.list-menu__panel a[aria-current="true"] { font-weight: var(--z-font-weight-semibold); }
.list-menu__group { display: flex; flex-direction: column; }
.chip__remove { display: inline-flex; color: inherit; }
.list-group > summary { cursor: pointer; list-style: none; }
.list-group > summary::-webkit-details-marker { display: none; }
.list-keys { display: flex; flex-wrap: wrap; gap: var(--z-space-4); padding: var(--z-space-3) var(--z-space-6); border-top: 1px solid var(--z-color-border-muted); }
.issues { flex: 1 1 auto; }
.empty { padding: var(--z-space-6); }
.issue-new { max-width: 560px; padding: var(--z-space-6); }
.projects, .project { max-width: 1120px; padding: var(--z-space-6); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--z-space-2); justify-content: flex-end; }
.project-card { display: flex; flex-direction: column; gap: var(--z-space-2); padding: var(--z-space-4); }
.project-card__head { display: flex; align-items: center; gap: var(--z-space-2); }
.project__head { display: flex; flex-wrap: wrap; gap: var(--z-space-6); align-items: flex-start; }
.project__head > :first-child { flex: 999 1 420px; }
.project__progress { flex: 1 1 260px; display: flex; flex-direction: column; gap: var(--z-space-2); padding: var(--z-space-4); }
.project__pct { font-size: var(--z-font-size-xl); }
.milestones { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--z-space-3); }
.milestone { display: flex; flex-direction: column; gap: var(--z-space-2); padding: var(--z-space-3) var(--z-space-4); }
.milestone__head { display: flex; justify-content: space-between; gap: var(--z-space-2); }
.settings { max-width: 720px; padding: var(--z-space-6); }
.token-secret { word-break: break-all; padding: var(--z-space-2) var(--z-space-3); background: var(--z-color-bg-subtle); border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-md); }
.z-row .z-chip { flex: none; }
.palette__hint { margin-left: auto; }
.palette__id { width: 64px; flex: none; }

/* Chat: floating button + modal overlay (TSK-23) */
.chat-fab { position: fixed; right: var(--z-space-5); bottom: var(--z-space-5); z-index: 40; display: inline-flex; align-items: center; gap: var(--z-space-3); height: var(--z-size-control-lg); padding: 0 var(--z-space-4) 0 var(--z-space-3); border: 0; border-radius: var(--z-radius-full); background: var(--z-color-fg-default); color: var(--z-color-bg-default); font: inherit; font-weight: var(--z-font-weight-semibold); box-shadow: var(--z-shadow-overlay); cursor: pointer; }
.chat-fab:focus-visible { outline: 2px solid var(--z-color-focus); outline-offset: 2px; }
.chat-fab__icon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: var(--z-radius-full); background: var(--z-color-accent-emphasis); color: var(--z-color-fg-on-accent); }
.chat-fab__badge { position: absolute; right: 0; bottom: calc(100% + var(--z-space-2)); display: inline-flex; align-items: center; height: 26px; padding: 0 var(--z-space-3); border-radius: var(--z-radius-full); background: var(--z-color-accent-subtle); color: var(--z-color-accent-fg); font-size: var(--z-font-size-sm); font-weight: var(--z-font-weight-medium); white-space: nowrap; }
.chat-fab__badge[hidden] { display: none; }
.chat-kbd { font-family: var(--z-font-family-mono); font-size: var(--z-font-size-xs); padding: 1px var(--z-space-2); border-radius: var(--z-radius-sm); background: var(--z-color-bg-muted); color: inherit; }
.chat-fab .chat-kbd { background: transparent; border: 1px solid currentColor; opacity: 0.7; }

.chat-dialog { position: fixed; inset: auto var(--z-space-6) calc(var(--z-space-6) + var(--z-size-control-lg) + var(--z-space-4)) auto; margin: 0; width: 460px; height: 700px; max-width: calc(100% - 2 * var(--z-space-6)); max-height: calc(100% - 2 * var(--z-space-6) - var(--z-size-control-lg)); padding: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-xl); background: var(--z-color-bg-default); color: var(--z-color-fg-default); box-shadow: var(--z-shadow-overlay); }
.chat-dialog[open] { display: flex; }
.chat-dialog::backdrop { background: var(--z-color-bg-overlay); opacity: 0.6; }
@media (max-width: 640px) {
  .chat-dialog { inset: var(--chat-top, 0) 0 auto 0; width: 100%; height: var(--chat-height, 100dvh); max-width: none; max-height: none; border: 0; border-radius: 0; overscroll-behavior: contain; }
  .chat-fab { right: var(--z-space-3); bottom: var(--z-space-3); }
  .chat-head { padding-top: calc(var(--z-space-3) + env(safe-area-inset-top)); padding-left: calc(var(--z-space-4) + env(safe-area-inset-left)); padding-right: calc(var(--z-space-3) + env(safe-area-inset-right)); }
  .chat-body { padding-left: calc(var(--z-space-4) + env(safe-area-inset-left)); padding-right: calc(var(--z-space-4) + env(safe-area-inset-right)); }
  .chat-foot { padding-bottom: calc(var(--z-space-3) + env(safe-area-inset-bottom)); padding-left: calc(var(--z-space-3) + env(safe-area-inset-left)); padding-right: calc(var(--z-space-3) + env(safe-area-inset-right)); }
  .chat-hints { display: none; }
  /* Conversations become a full list view in place of the thread. */
  .chat-threads { flex: 1 1 auto; max-height: none; padding: var(--z-space-3); border-bottom: 0; background: var(--z-color-bg-default); }
  .chat-threads:not([hidden]) ~ .chat-body, .chat-threads:not([hidden]) ~ .chat-foot { display: none; }
  .chat-thread { padding: var(--z-space-3); min-height: var(--z-size-control-lg); border-bottom: 1px solid var(--z-color-border-muted); border-radius: 0; }
}
.chat-head { display: flex; align-items: center; gap: var(--z-space-3); padding: var(--z-space-3) var(--z-space-3) var(--z-space-3) var(--z-space-4); border-bottom: 1px solid var(--z-color-border-muted); }
.chat-head__text { display: flex; flex-direction: column; min-width: 0; }
.chat-head__title { margin: 0; font-size: var(--z-font-size-md); line-height: var(--z-font-line-md); font-weight: var(--z-font-weight-semibold); }
.chat-head__actions { display: flex; gap: var(--z-space-1); margin-left: auto; }
.chat-avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--z-radius-full); background: var(--z-color-warning-subtle); color: var(--z-color-warning-fg); font-size: var(--z-font-size-xs); font-weight: var(--z-font-weight-semibold); }
.chat-avatar--lg { width: 28px; height: 28px; border-radius: var(--z-radius-lg); }
.chat-status[data-online="true"] { color: var(--z-color-success-fg); }
.chat-status[data-online="false"] { color: var(--z-color-danger-fg); }
.chat-threads { display: flex; flex-direction: column; gap: var(--z-space-1); max-height: 40%; overflow-y: auto; padding: var(--z-space-2); border-bottom: 1px solid var(--z-color-border-muted); background: var(--z-color-bg-subtle); }
.chat-threads[hidden] { display: none; }
.chat-thread { text-align: left; padding: var(--z-space-2) var(--z-space-3); border: 0; border-radius: var(--z-radius-md); background: transparent; color: var(--z-color-fg-default); font: inherit; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread:hover, .chat-thread[aria-current] { background: var(--z-color-bg-selected); }
.chat-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--z-space-3); min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; padding: var(--z-space-4) var(--z-space-4) var(--z-space-2); }
.chat-empty { display: flex; flex-direction: column; gap: var(--z-space-3); padding-top: var(--z-space-6); }
.chat-empty[hidden], .chat-log[hidden], .chat-offline[hidden] { display: none; }
.chat-empty__title { margin: 0; font-size: var(--z-font-size-xl); line-height: var(--z-font-line-xl); font-weight: var(--z-font-weight-semibold); }
.chat-empty__suggestions { display: flex; flex-direction: column; gap: var(--z-space-2); }
.chat-suggest { text-align: left; padding: var(--z-space-3); border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-lg); background: var(--z-color-bg-subtle); color: var(--z-color-fg-default); font: inherit; cursor: pointer; }
.chat-suggest:hover { background: var(--z-color-bg-hover); }
.chat-log { display: flex; flex-direction: column; gap: var(--z-space-4); }
.chat-bubble { align-self: flex-end; max-width: 82%; padding: var(--z-space-2) var(--z-space-3); border-radius: var(--z-radius-xl) var(--z-radius-xl) var(--z-radius-sm) var(--z-radius-xl); background: var(--z-color-accent-subtle); color: var(--z-color-fg-default); overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-row { display: flex; align-items: flex-start; gap: var(--z-space-3); }
.chat-row--center { align-items: center; }
.chat-row__col { display: flex; flex-direction: column; gap: var(--z-space-3); min-width: 0; flex: 1 1 auto; }
.chat-card { display: flex; align-items: center; gap: var(--z-space-3); padding: var(--z-space-3); border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-lg); background: var(--z-color-bg-subtle); color: var(--z-color-fg-default); text-decoration: none; }
.chat-card:hover { background: var(--z-color-bg-hover); }
.chat-card__title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--z-font-weight-medium); }
.chat-note { flex: 1 1 auto; min-width: 0; color: var(--z-color-fg-muted); font-size: var(--z-font-size-sm); }
.chat-typing { display: inline-flex; align-items: center; height: 32px; padding: 0 var(--z-space-3); border-radius: var(--z-radius-full); background: var(--z-color-bg-muted); color: var(--z-color-fg-muted); font-size: var(--z-font-size-sm); }
.chat-fail { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--z-space-2); padding: var(--z-space-3); border: 1px solid var(--z-color-danger-fg); border-radius: var(--z-radius-lg); background: var(--z-color-danger-subtle); }
.chat-fail__head { font-weight: var(--z-font-weight-semibold); color: var(--z-color-danger-fg); }
.chat-actions { display: flex; flex-wrap: wrap; gap: var(--z-space-2); }
.chat-proposal { display: flex; flex-direction: column; gap: var(--z-space-2); padding: var(--z-space-3); border: 1px solid var(--z-color-accent-emphasis); border-radius: var(--z-radius-lg); background: var(--z-color-accent-subtle); }
.chat-proposal__label { font-size: var(--z-font-size-xs); font-weight: var(--z-font-weight-semibold); letter-spacing: 0.04em; color: var(--z-color-accent-fg); }
.chat-proposal__line { display: flex; align-items: center; gap: var(--z-space-2); font-weight: var(--z-font-weight-medium); }
.chat-offline { align-self: center; margin: 0; padding: var(--z-space-1) var(--z-space-3); border-radius: var(--z-radius-full); background: var(--z-color-bg-muted); color: var(--z-color-fg-muted); font-size: var(--z-font-size-sm); }
.chat-foot { display: flex; flex-direction: column; gap: var(--z-space-2); padding: var(--z-space-3); border-top: 1px solid var(--z-color-border-muted); }
.chat-composer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--z-space-2); padding: var(--z-space-2) var(--z-space-2) var(--z-space-2) var(--z-space-3); border: 1px solid var(--z-color-border-strong); border-radius: var(--z-radius-lg); background: var(--z-color-bg-inset); }
.chat-composer:focus-within { outline: 2px solid var(--z-color-focus); outline-offset: 1px; }
.chat-composer__input { flex: 1 1 0; min-width: 0; resize: none; border: 0; outline: none; background: transparent; color: var(--z-color-fg-default); font: inherit; font-size: 16px; /* after the shorthand: below 16px iOS Safari zooms on focus */ padding: var(--z-space-1) 0; }
.chat-composer__send { flex: none; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: var(--z-radius-md); background: var(--z-color-accent-emphasis); color: var(--z-color-fg-on-accent); cursor: pointer; }
.chat-composer__send:disabled { background: var(--z-color-bg-muted); color: var(--z-color-fg-subtle); cursor: default; }
.chat-composer:has(.chat-composer__mic[aria-pressed="true"]) { border-color: var(--z-color-accent-emphasis); box-shadow: 0 0 0 3px var(--z-color-accent-subtle); }
.chat-composer__mic { flex: none; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: var(--z-radius-md); background: transparent; color: var(--z-color-fg-muted); cursor: pointer; }
.chat-composer__mic[hidden] { display: none; }
.chat-composer__mic:hover { background: var(--z-color-bg-hover); color: var(--z-color-fg-default); }
.chat-composer__mic[aria-pressed="true"] { background: var(--z-color-danger-subtle); color: var(--z-color-danger-fg); }
.chat-composer__mic-off, .chat-composer__mic[aria-pressed="true"] .chat-composer__mic-on { display: none; }
.chat-composer__mic[aria-pressed="true"] .chat-composer__mic-off { display: block; }
.chat-dictation-live { flex: 1 0 100%; padding: 0 0 var(--z-space-1); color: var(--z-color-fg-subtle); font-size: 16px; line-height: 22px; overflow-wrap: anywhere; }
.chat-dictation[hidden] { display: none; }
/* Empty live regions stay in the accessibility tree (so their first message
   is announced) but take no space. */
.chat-dictation-live:empty, .chat-dictation-error:empty { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); }
.chat-dictation { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-2); font-size: var(--z-font-size-sm); color: var(--z-color-fg-muted); }
.chat-dictation__dot { width: 8px; height: 8px; border-radius: var(--z-radius-full); background: var(--z-color-danger-emphasis); animation: chat-pulse 1.2s infinite; }
@keyframes chat-pulse { 50% { opacity: 0.35; } }
.chat-dictation__lang { margin-left: var(--z-space-1); height: 22px; padding: 0 var(--z-space-2); border: 1px solid var(--z-color-border-strong); border-radius: var(--z-radius-full); background: transparent; color: var(--z-color-fg-default); font: inherit; font-size: var(--z-font-size-xs); font-weight: var(--z-font-weight-medium); cursor: pointer; }
.chat-dictation__note { margin-left: auto; color: var(--z-color-fg-subtle); }
.chat-dictation-error { display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-1); padding: var(--z-space-2) var(--z-space-3); border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-lg); background: var(--z-color-bg-subtle); color: var(--z-color-fg-muted); font-size: var(--z-font-size-sm); }
.chat-dictation-error[data-kind="blocked"], .chat-dictation-error[data-kind="service-off"] { border-color: var(--z-color-warning-fg); background: var(--z-color-warning-subtle); color: var(--z-color-warning-fg); }
.chat-dictation-error .dictation-retry { padding: 0; border: 0; background: transparent; color: var(--z-color-accent-fg); font: inherit; font-weight: var(--z-font-weight-medium); cursor: pointer; }
.chat-hints { display: flex; flex-wrap: wrap; gap: var(--z-space-3); margin: 0; }
.chat-hints__end { margin-left: auto; }
.chat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.prose { overflow-wrap: anywhere; }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote { margin: 0 0 var(--z-space-2); }
.prose ul, .prose ol { padding-left: var(--z-space-5); }
.prose li > ul, .prose li > ol { margin: var(--z-space-1) 0 0; }
.prose code { padding: 1px var(--z-space-1); background: var(--z-color-bg-subtle); border-radius: var(--z-radius-sm); font-family: var(--z-font-family-mono); font-size: 0.92em; }
.prose pre { overflow-x: auto; padding: var(--z-space-2) var(--z-space-3); background: var(--z-color-bg-subtle); border-radius: var(--z-radius-md); }
.prose pre code { padding: 0; background: none; }
.prose blockquote { padding-left: var(--z-space-3); border-left: 3px solid var(--z-color-border-default); }
.prose a { color: var(--z-color-accent-fg); }

/* Issue detail */
.issue-layout { display: flex; flex-wrap: wrap; flex: 1 1 auto; }
.issue { flex: 999 1 560px; min-width: 0; max-width: 860px; padding: var(--z-space-8) var(--z-space-10); }
.issue__title { margin: 0; font-size: var(--z-font-size-xl); line-height: var(--z-font-line-xl); font-weight: var(--z-font-weight-semibold); }
.issue__proposed-actions { display: flex; flex-wrap: wrap; gap: var(--z-space-2); }
.issue__actions { display: flex; flex-wrap: wrap; gap: var(--z-space-2); margin-top: var(--z-space-2); }
.issue__actions form { margin: 0; }
.subissues__head { display: flex; align-items: center; gap: var(--z-space-2); }
.subissues__bar { margin-left: auto; width: 80px; height: 4px; }
.subissues__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--z-space-2); }
.subissues__item { display: flex; align-items: center; gap: var(--z-space-2); }
.issue__section { margin: 0; font-size: var(--z-font-size-md); font-weight: var(--z-font-weight-semibold); }
.issue__edit > summary { display: inline-flex; cursor: pointer; margin-bottom: var(--z-space-3); }
.issue__side { flex: 1 1 280px; max-width: 340px; box-sizing: border-box; padding: var(--z-space-6) var(--z-space-5); border-left: 1px solid var(--z-color-border-muted); background: var(--z-color-bg-subtle); }
.props { display: grid; grid-template-columns: 96px 1fr; gap: var(--z-space-3) var(--z-space-2); align-items: center; margin: 0; }
.props dt { color: var(--z-color-fg-muted); }
.props dd { margin: 0; min-width: 0; }
.props__form { display: inline-flex; gap: var(--z-space-1); align-items: center; margin: 0; }
.props__labels { display: flex; flex-wrap: wrap; gap: var(--z-space-1); align-items: center; }
.props__github, .props__usage { margin-top: var(--z-space-5); padding-top: var(--z-space-4); border-top: 1px solid var(--z-color-border-muted); }
.props__github h2, .props__usage h2 { margin: 0 0 var(--z-space-2); font-size: inherit; font-weight: 600; }
.usage { display: grid; grid-template-columns: 96px 1fr; gap: var(--z-space-1) var(--z-space-2); margin: 0; font-size: var(--z-font-size-sm); }
.usage dt { color: var(--z-color-fg-muted); }
.usage dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.props__github ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--z-space-1); overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--z-space-3); }
.timeline__item { display: flex; gap: var(--z-space-2); align-items: center; }
.comment { border: 1px solid var(--z-color-border-muted); border-radius: var(--z-radius-lg); padding: var(--z-space-3) var(--z-space-4); display: flex; flex-direction: column; gap: var(--z-space-2); }
.comment__head { display: flex; gap: var(--z-space-2); align-items: center; }
.comment__actions { display: flex; gap: var(--z-space-2); align-items: flex-start; }
.comment__actions form { margin: 0; }
.comment__edit > summary { display: inline-flex; cursor: pointer; margin-bottom: var(--z-space-2); }
.comment-form { border: 1px solid var(--z-color-border); border-radius: var(--z-radius-lg); display: flex; flex-direction: column; }
.comment-form__label { position: absolute; left: -9999px; }
.comment-form__foot { display: flex; justify-content: flex-end; padding: var(--z-space-2); border-top: 1px solid var(--z-color-border-muted); }
.nav__badge { margin-left: auto; }
.inbox { display: flex; flex-wrap: wrap; min-height: 100%; }
.inbox__list { flex: 1 1 420px; max-width: 480px; box-sizing: border-box; border-right: 1px solid var(--z-color-border-muted); display: flex; flex-direction: column; }
.inbox__head { display: flex; align-items: center; gap: var(--z-space-3); padding: var(--z-space-2) var(--z-space-4); border-bottom: 1px solid var(--z-color-border-muted); }
.inbox__tabs { display: flex; gap: var(--z-space-1); }
.inbox__tab { padding: var(--z-space-1) var(--z-space-3); border-radius: var(--z-radius-md); color: var(--z-color-fg-muted); }
.inbox__tab[aria-current="page"] { background: var(--z-color-bg-hover); color: var(--z-color-fg-default); font-weight: var(--z-font-weight-medium); }
.inbox__readall { margin: 0 0 0 auto; }
.inbox__items { list-style: none; margin: 0; padding: 0; }
.inbox__item { display: grid; grid-template-columns: 32px 1fr auto; gap: var(--z-space-1) var(--z-space-3); padding: var(--z-space-3) var(--z-space-4) var(--z-space-3) var(--z-space-5); border-bottom: 1px solid var(--z-color-border-muted); position: relative; color: var(--z-color-fg-muted); }
.inbox__item .z-avatar { grid-row: span 2; }
.inbox__item--unread { color: var(--z-color-fg-default); }
.inbox__item--unread .inbox__title { font-weight: var(--z-font-weight-semibold); }
.inbox__item[aria-current="true"], .inbox__item:focus-visible, .inbox__item:hover { background: var(--z-color-bg-hover); }
.inbox__dot { position: absolute; left: var(--z-space-2); top: var(--z-space-4); width: 6px; height: 6px; border-radius: 50%; background: var(--z-color-accent-fg); }
.inbox__title, .inbox__detail { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.inbox__detail { grid-column: 2 / span 2; }
.inbox__empty { padding: var(--z-space-5); }
.inbox__keys { margin-top: auto; display: flex; flex-wrap: wrap; gap: var(--z-space-4); padding: var(--z-space-3) var(--z-space-5); border-top: 1px solid var(--z-color-border-muted); }
.inbox__preview { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; }
.inbox__phead { display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-2); padding: var(--z-space-2) var(--z-space-6); border-bottom: 1px solid var(--z-color-border-muted); }
.inbox__phead form { margin: 0; }
.inbox__open { margin-left: auto; }
.inbox__body { display: flex; flex-direction: column; gap: var(--z-space-4); padding: var(--z-space-6) var(--z-space-8); max-width: 760px; overflow-wrap: anywhere; }
.inbox__issue { margin: 0; font-size: var(--z-font-size-xl); line-height: var(--z-font-line-xl); font-weight: var(--z-font-weight-semibold); }
.inbox__events { list-style: none; margin: 0; padding: 0 0 0 var(--z-space-4); border-left: 1px solid var(--z-color-border-muted); display: flex; flex-direction: column; gap: var(--z-space-3); }

/* Issue detail: Work section (factory runs) and GitHub links */
.work { display: flex; flex-direction: column; gap: var(--z-space-3); }
.work__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--z-space-2); }
.work__run { display: flex; flex-direction: column; gap: var(--z-space-3); padding: var(--z-space-3) var(--z-space-4); border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-lg); }
.work__run-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-2); }
.work__badge { margin-left: auto; }
.work__track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--z-space-2); font-size: var(--z-font-size-xs); color: var(--z-color-fg-muted); }
.work__step { display: flex; flex-direction: column; gap: var(--z-space-1); overflow-wrap: anywhere; }
.work__step::before { content: ""; height: 4px; border-radius: var(--z-radius-sm); background: var(--z-color-border-default); }
.work__step--done::before { background: var(--z-color-success-fg); }
.work__step--current { color: var(--z-color-fg-default); font-weight: var(--z-font-weight-medium); }
.work__step--current::before { background: var(--z-color-accent-emphasis); }
.work__step--stopped { color: var(--z-color-danger-fg); }
.work__step--stopped::before { background: var(--z-color-danger-fg); }
.work__step--todo { color: var(--z-color-fg-subtle); }
.work__meta { display: flex; flex-wrap: wrap; gap: var(--z-space-2) var(--z-space-4); font-size: var(--z-font-size-sm); color: var(--z-color-fg-muted); overflow-wrap: anywhere; }
.work__meta a { color: var(--z-color-accent-fg); }
.work__branch { margin: 0; font-family: var(--z-font-family-mono); font-size: var(--z-font-size-sm); color: var(--z-color-fg-muted); overflow-wrap: anywhere; }
.work__result { margin: 0; font-size: var(--z-font-size-sm); color: var(--z-color-fg-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.work__older { display: flex; flex-direction: column; gap: var(--z-space-2); padding: var(--z-space-2) var(--z-space-4); border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-lg); }
.work__older[open] > .work__summary { margin-bottom: var(--z-space-2); }
.work__summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-2); cursor: pointer; font-size: var(--z-font-size-sm); color: var(--z-color-fg-muted); }
.work__summary strong { color: var(--z-color-fg-default); }
.work__cost { margin-left: auto; }
.props__github .work__branch { margin-bottom: var(--z-space-2); }
/* Budget overrides: a run stopped at its cost limit (docs/design/Budget.dc.html) */
.work__run--limit { border-color: color-mix(in srgb, var(--z-color-warning-fg) 35%, var(--z-color-border-default)); background: color-mix(in srgb, var(--z-color-warning-subtle) 45%, var(--z-color-bg-default)); }
.budget { display: flex; flex-direction: column; gap: var(--z-space-2); }
.budget__text, .budget__done { margin: 0; color: var(--z-color-fg-muted); overflow-wrap: anywhere; }
.budget__done { color: var(--z-color-fg-default); }
.budget__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-2); }
.budget__form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-2); }
.budget__label { color: var(--z-color-fg-muted); }
.budget__select { width: auto; }
.gh-link { display: flex; align-items: center; gap: var(--z-space-2); }
.gh-dot { flex: none; width: 8px; height: 8px; border-radius: var(--z-radius-full); background: var(--z-color-border-strong); }
.gh-dot--open { background: var(--z-color-success-fg); }
.gh-dot--merged { background: var(--z-color-label-violet); }
.gh-dot--closed { background: var(--z-color-fg-subtle); }

/* Attachments grid (issue page) */
.atts { display: flex; flex-direction: column; gap: var(--z-space-3); }
.atts__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--z-space-2); }
.atts__add { margin-left: auto; }
.atts__add > summary { display: inline-flex; cursor: pointer; list-style: none; }
.atts__add[open] { flex-basis: 100%; margin-left: 0; }
.atts__forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--z-space-4); margin-top: var(--z-space-3); padding: var(--z-space-4); border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-lg); }
.atts__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--z-space-3); }
.att-card { display: flex; flex-direction: column; height: 100%; overflow: hidden; border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-lg); color: var(--z-color-fg-default); text-decoration: none; }
.att-card:hover { border-color: var(--z-color-border-strong); }
.att-card--current { border-color: var(--z-color-accent-emphasis); }
.att-card__thumb { height: 96px; box-sizing: border-box; display: flex; flex-direction: column; gap: var(--z-space-1); padding: var(--z-space-2) var(--z-space-3); overflow: hidden; background: var(--z-color-bg-subtle); }
.att-card__thumb--image { padding: 0; }
.att-card__thumb--link, .att-card__thumb--file { align-items: center; justify-content: center; color: var(--z-color-fg-subtle); }
.att-card__img { width: 100%; height: 100%; object-fit: cover; }
.att-card__line { font-family: var(--z-font-family-mono); font-size: var(--z-font-size-xs); color: var(--z-color-fg-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-card__bar { height: 10px; width: 60%; border-radius: var(--z-radius-sm); background: var(--z-color-border-default); }
.att-card__bar--short { width: 40%; }
.att-card__box { height: 34px; border-radius: var(--z-radius-md); border: 1px solid var(--z-color-border-default); background: var(--z-color-bg-default); }
.att-card__icon { width: 22px; height: 22px; }
.att-card__ext { font-size: var(--z-font-size-sm); font-weight: var(--z-font-weight-semibold); }
.att-card__body { display: flex; flex-direction: column; gap: 2px; padding: var(--z-space-2) var(--z-space-3); }
.att-card__title { display: flex; align-items: center; gap: var(--z-space-2); min-width: 0; }
.att-card__title strong { font-size: var(--z-font-size-sm); font-weight: var(--z-font-weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-card__badge { flex: none; padding: 0 5px; border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-sm); font-size: var(--z-font-size-xs); color: var(--z-color-fg-muted); }
.att-card__badge--latest { border-color: transparent; background: var(--z-color-accent-subtle); color: var(--z-color-accent-fg); font-weight: var(--z-font-weight-semibold); }
.att-card__meta { font-size: var(--z-font-size-xs); color: var(--z-color-fg-muted); overflow-wrap: anywhere; }

/* Attachment viewer */
.att-viewer { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.att-viewer__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-3); padding: var(--z-space-3) var(--z-space-5); border-bottom: 1px solid var(--z-color-border-default); }
.att-viewer__back { display: inline-flex; align-items: center; gap: var(--z-space-1); color: var(--z-color-fg-muted); text-decoration: none; }
.att-viewer__chev { transform: rotate(90deg); }
.att-viewer__title { display: flex; flex-direction: column; min-width: 0; }
.att-viewer__title h2 { margin: 0; font-size: var(--z-font-size-md); font-weight: var(--z-font-weight-semibold); overflow-wrap: anywhere; }
.att-viewer__versions { margin-left: auto; }
.att-viewer__widths { display: inline-flex; gap: var(--z-space-1); }
.att-viewer__widths [aria-pressed="true"] { border-color: var(--z-color-accent-emphasis); background: var(--z-color-accent-subtle); color: var(--z-color-accent-fg); }
.att-viewer__body { display: flex; flex-wrap: wrap; flex: 1 1 auto; min-height: 0; }
.att-viewer__main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: var(--z-space-3); padding: var(--z-space-5); background: var(--z-color-bg-subtle); }
.att-viewer__note { display: flex; align-items: center; gap: var(--z-space-2); margin: 0; font-size: var(--z-font-size-sm); color: var(--z-color-fg-muted); }
.att-viewer__lock { width: 14px; height: 14px; flex: none; }
.att-viewer__stage { flex: 1 1 auto; min-height: 640px; display: flex; justify-content: center; border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-xl); background: var(--z-color-bg-default); overflow: auto; }
.att-viewer__frame { width: 100%; min-height: 640px; border: 0; color-scheme: light; }
.att-viewer__stage--phone .att-viewer__frame { width: 390px; max-width: 100%; border-left: 1px solid var(--z-color-border-default); border-right: 1px solid var(--z-color-border-default); }
.att-viewer__img { max-width: 100%; height: auto; align-self: flex-start; }
.att-viewer__doc { margin: 0; padding: var(--z-space-5); border: 1px solid var(--z-color-border-default); border-radius: var(--z-radius-xl); background: var(--z-color-bg-default); overflow: auto; }
.att-viewer__text { font-family: var(--z-font-family-mono); font-size: var(--z-font-size-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.att-viewer__empty { align-items: center; gap: var(--z-space-3); }
.att-viewer__url { overflow-wrap: anywhere; font-family: var(--z-font-family-mono); font-size: var(--z-font-size-sm); }
.att-viewer__side { flex: 1 1 320px; max-width: 380px; display: flex; flex-direction: column; border-left: 1px solid var(--z-color-border-default); }
.att-viewer__changed { display: flex; flex-direction: column; gap: var(--z-space-1); padding: var(--z-space-4); border-bottom: 1px solid var(--z-color-border-muted); font-size: var(--z-font-size-sm); }
.att-viewer__changed p { margin: 0; color: var(--z-color-fg-muted); white-space: pre-wrap; }
.att-viewer__thread { list-style: none; margin: 0; padding: var(--z-space-4); flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--z-space-4); }
.att-comment { display: flex; gap: var(--z-space-2); }
.att-comment > div { min-width: 0; }
.att-viewer__form { display: flex; flex-direction: column; gap: var(--z-space-2); padding: var(--z-space-4); border-top: 1px solid var(--z-color-border-default); }
.att-viewer__actions { display: flex; flex-wrap: wrap; gap: var(--z-space-2); }
@media (max-width: 640px) {
  .att-viewer__side { max-width: none; border-left: 0; border-top: 1px solid var(--z-color-border-default); }
  .att-viewer__main { padding: var(--z-space-3); }
  .att-viewer__versions { margin-left: 0; }
}

/* iOS Safari zooms into any focused field whose computed font-size is below
   16px. The design system sizes fields at 13px, so on touch devices every
   text field gets 16px (unlayered, so it wins over @layer z.components). */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  textarea, select { font-size: 16px; }
  .chat-dictation__lang { height: auto; font-size: 16px; }
  .chat-hints__voice { display: none; } /* no ⌥Space without a keyboard */
}

/* Settings → Agents (docs/design/Agents.dc.html) */
.settings--wide { max-width: 900px; }
.agents__title { margin: 0; font-size: var(--z-font-size-xl); font-weight: var(--z-font-weight-semibold); }
.agent { display: flex; flex-direction: column; }
.agent__intro { display: flex; flex-direction: column; gap: var(--z-space-1); }
.agent__intro p { margin: 0; }
.agent__muted { color: var(--z-color-fg-muted); }
.agent__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-3); padding: var(--z-space-4) var(--z-space-5); border-bottom: 1px solid var(--z-color-border-muted); }
.agent__avatar { width: 36px; height: 36px; border-radius: var(--z-radius-lg); font-weight: var(--z-font-weight-semibold); }
.agent__name { display: flex; flex-direction: column; }
.agent__h { margin: 0; font-size: var(--z-font-size-md); font-weight: var(--z-font-weight-semibold); }
.agent__status { font-size: var(--z-font-size-sm); color: var(--z-color-fg-subtle); }
.agent__running { color: var(--z-color-success-fg); }
.agent__paused { color: var(--z-color-warning-fg); font-weight: var(--z-font-weight-medium); }
.agent__actions { margin-left: auto; display: flex; gap: var(--z-space-2); }
.agent__policy { display: grid; grid-template-columns: minmax(180px, 220px) 1fr; gap: var(--z-space-4) var(--z-space-6); align-items: start; padding: var(--z-space-4) var(--z-space-5); border-bottom: 1px solid var(--z-color-border-muted); }
.agent__label { font-weight: var(--z-font-weight-medium); padding-top: 6px; }
.agent__label--radio { padding-top: 2px; }
.agent__field { display: flex; flex-direction: column; gap: var(--z-space-2); min-width: 0; }
.agent__inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-3); }
.agent__num { width: 72px; }
.agent__num--wide { width: 88px; }
.agent__radio { display: flex; gap: var(--z-space-2); align-items: flex-start; }
.agent__radio input { margin-top: 3px; accent-color: var(--z-color-accent-emphasis); }
.agent__strong { font-weight: var(--z-font-weight-medium); }
.agent__bar { width: 160px; }
.agent__save { grid-column: 2; }
.agent__section { display: flex; flex-direction: column; gap: var(--z-space-3); padding: var(--z-space-4) var(--z-space-5); }
.agent__subtitle { margin: 0; font-size: var(--z-font-size-md); font-weight: var(--z-font-weight-semibold); }
.agent__table { min-width: 420px; }
.agent__key { font-weight: var(--z-font-weight-medium); }
.agent__note { display: flex; gap: var(--z-space-3); padding: var(--z-space-3); border-radius: var(--z-radius-lg); background: var(--z-color-bg-subtle); font-size: var(--z-font-size-sm); color: var(--z-color-fg-muted); }
.agent__note-icon { flex: none; margin-top: 3px; }
.agent__bar--over::-webkit-progress-value { background: var(--z-color-warning-fg); }
.agent__bar--over::-moz-progress-bar { background: var(--z-color-warning-fg); }
.agent__over { color: var(--z-color-warning-fg); font-weight: var(--z-font-weight-medium); }
.agent__raise { display: flex; flex-direction: column; gap: var(--z-space-2); }
.agent__raise[open] > .agent__link { margin-bottom: var(--z-space-2); }
.agent__link { width: fit-content; cursor: pointer; font-size: var(--z-font-size-sm); color: var(--z-color-accent-fg); }
.agent__log { list-style: none; margin: 0; padding: var(--z-space-2) var(--z-space-5); display: flex; flex-direction: column; gap: var(--z-space-1); border-bottom: 1px solid var(--z-color-border-muted); font-size: var(--z-font-size-sm); color: var(--z-color-fg-muted); }
.agent__log-item { display: flex; align-items: center; gap: var(--z-space-2); }
.agent__log-text { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.trust { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--z-space-2); }
.trust__item { display: flex; flex-wrap: wrap; align-items: center; gap: var(--z-space-3); }
.trust__badge { margin-left: auto; }
@media (max-width: 640px) {
  .agent__policy { grid-template-columns: 1fr; gap: var(--z-space-2); }
  .agent__label { padding-top: var(--z-space-3); }
  .agent__save { grid-column: 1; }
}
