/**
 * Assistant UI (conversation stream + run activity).
 * Visual reference: docs/assistant-ui-mock.html — Conversation screen.
 * Chat shell geometry (.chat-dock, .chat-history*) lives in layout.css;
 * this file owns the stream primitives rendered inside .chat-history__body
 * plus the dock's Stop button.
 */

/* --- message bubbles ------------------------------------------------------ */

.chat-history__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* user bubble */
.msg-user {
  align-self: flex-end;
  max-width: 86%;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface-raised);
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  border-top-right-radius: var(--space-1);
  box-shadow: var(--shadow-1);
  font-size: var(--text-sm);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.msg-user__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-ink-faint);
  font-style: italic;
  white-space: nowrap;
}
.msg-user__badge .spinner {
  width: 10px;
  height: 10px;
  border-width: 1.5px;
}

/* assistant say — flat, left, persona-labelled */
.msg-ai {
  align-self: stretch;
  max-width: 92%;
}
.msg-ai__who {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-ink-secondary);
  margin-bottom: 3px;
}
.msg-ai__who svg {
  color: var(--color-ink);
}
.msg-ai__avatar {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  object-fit: cover;
}
.msg-ai__text {
  font-size: var(--text-sm);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
/* Final say (post-stream): GFM via renderMarkdown — not pre-wrapped plain text. */
.msg-ai__text--md {
  white-space: normal;
  min-width: 0;
}
.msg-ai__text--md > :first-child {
  margin-top: 0;
}
.msg-ai__text--md > :last-child {
  margin-bottom: 0;
}
.msg-ai__text--md p,
.msg-ai__text--md ul,
.msg-ai__text--md ol,
.msg-ai__text--md blockquote,
.msg-ai__text--md pre {
  margin: 0 0 0.45em;
}
.msg-ai__text--md p:last-child,
.msg-ai__text--md ul:last-child,
.msg-ai__text--md ol:last-child,
.msg-ai__text--md blockquote:last-child,
.msg-ai__text--md pre:last-child {
  margin-bottom: 0;
}
.msg-ai__text--md ul,
.msg-ai__text--md ol {
  padding-left: 1.25em;
}
.msg-ai__text--md li + li {
  margin-top: 0.15em;
}
.msg-ai__text--md a {
  color: var(--color-accent);
  text-decoration: underline;
  word-break: break-word;
}
.msg-ai__text--md a:hover {
  opacity: 0.85;
}
.msg-ai__text--md strong {
  font-weight: 600;
}
.msg-ai__text--md code {
  font-size: 0.9em;
  padding: 0.1em 0.3em;
  border-radius: 3px;
  background: var(--color-surface-sunken, rgba(0, 0, 0, 0.06));
}
.msg-ai__text--md pre {
  padding: 0.5em 0.65em;
  overflow-x: auto;
  border-radius: 6px;
  background: var(--color-surface-sunken, rgba(0, 0, 0, 0.06));
  font-size: 0.85em;
}
.msg-ai__text--md pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}
.msg-ai__text--md h1,
.msg-ai__text--md h2,
.msg-ai__text--md h3,
.msg-ai__text--md h4 {
  margin: 0.65em 0 0.3em;
  font-weight: 600;
  line-height: var(--leading-tight, 1.25);
  font-size: 1em;
}
.msg-ai__text--md h1:first-child,
.msg-ai__text--md h2:first-child,
.msg-ai__text--md h3:first-child {
  margin-top: 0;
}
.msg-ai__text--md .pill {
  vertical-align: baseline;
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-ai__text .caret {
  display: inline-block;
  width: 7px;
  height: 14px;
  translate: 2px 2px;
  background: var(--color-ink);
  opacity: 0.8;
  animation: assistant-caret-blink 1.1s steps(1) infinite;
}
@keyframes assistant-caret-blink {
  50% {
    opacity: 0;
  }
}

/* run header / divider */
.run-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-ink-faint);
  letter-spacing: 0.04em;
}
.run-header::before,
.run-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* --- shared bits ---------------------------------------------------------- */

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--color-border-strong);
  border-top-color: var(--color-ink);
  border-radius: 50%;
  animation: assistant-spin 0.8s linear infinite;
}
@keyframes assistant-spin {
  to {
    rotate: 360deg;
  }
}

/* numbered citation circles — map to ## Highlights [n] pills */
.cite-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.15em;
  min-width: 1.15em;
  margin: 0 0.12em;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #c47a3a66;
  background: #c47a3a18;
  color: var(--entity-highlight, #c47a3a);
  font-size: 0.7em;
  font-weight: 650;
  line-height: 1;
  vertical-align: super;
  position: relative;
  top: -0.15em;
  user-select: none;
}
.cite-badge--nav {
  cursor: pointer;
}
.cite-badge--nav:hover {
  filter: brightness(0.95);
  border-color: #c47a3aaa;
  background: #c47a3a28;
}
.cite-badge--nav:focus-visible {
  outline: 2px solid var(--color-focus, #4a7ab5);
  outline-offset: 1px;
}

/* Embedded highlight footnotes inside parent note cards */
.cite-embeds {
  margin-top: var(--space-4, 1rem);
  padding-top: var(--space-3, 0.75rem);
  border-top: var(--border-hairline, 1px solid var(--color-border));
}
.cite-embeds__heading {
  margin: 0 0 var(--space-2, 0.5rem);
  font-size: var(--text-sm, 0.875rem);
  font-weight: 650;
  color: var(--color-ink-secondary);
}
.cite-embeds__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 0.5rem);
}
.cite-embed {
  border: 1px dashed #c47a3a66;
  border-radius: var(--radius-md, 8px);
  background: #c47a3a0a;
  padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
  scroll-margin-block: 3rem;
}
.cite-embed--fallback {
  list-style: none;
  margin-left: 0;
}
.cite-embed--flash {
  animation: cite-embed-flash 1.1s ease;
}
@keyframes cite-embed-flash {
  0%,
  100% {
    box-shadow: none;
  }
  25%,
  60% {
    box-shadow: 0 0 0 2px #c47a3a88;
  }
}
.cite-embed__head {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}
.cite-embed__head .cite-badge {
  vertical-align: baseline;
  position: static;
  top: 0;
  font-size: 0.75rem;
  width: 1.35em;
  height: 1.35em;
  min-width: 1.35em;
}
.cite-embed__title {
  font-size: var(--text-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-ink);
}
.cite-embed__preview {
  margin: 0.25rem 0;
  max-height: 8rem;
  overflow: hidden;
  border-radius: var(--radius-sm, 4px);
}
.cite-embed__comment {
  font-size: var(--text-xs, 0.75rem);
  color: var(--color-ink-secondary);
  margin-top: 0.25rem;
  white-space: pre-wrap;
}
.cite-embed__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: var(--text-xs, 0.75rem);
  color: var(--color-ink-faint);
}
.cite-embed__open {
  flex-shrink: 0;
}

/* pills (inline refs in messages / journal bubbles) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px 1px 6px;
  margin: 0 1px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  vertical-align: baseline;
  line-height: 1.6;
}
.pill svg {
  width: 11px;
  height: 11px;
}
.pill--card {
  color: var(--entity-card);
  border-color: #4a7ab54d;
  background: #4a7ab50f;
}
.pill--highlight,
.pill--latent {
  color: var(--entity-highlight);
  border-color: #c47a3a4d;
  background: #c47a3a0f;
}
.pill--latent {
  border-style: dashed;
}
.pill--view {
  color: var(--entity-view);
  border-color: #8b6bb54d;
  background: #8b6bb50f;
}
.pill--blueprint {
  color: var(--color-ink);
}
.pill--folder,
.pill--group {
  color: var(--color-ink-secondary);
}
.pill--canvas,
.pill--element {
  color: var(--color-ink-secondary);
}
.pill--asset {
  color: var(--color-ink-secondary);
  border-style: dashed;
}
.pill--coord {
  color: var(--color-ink-secondary);
  font-family: var(--font-mono);
}
.pill--nav {
  cursor: pointer;
  max-width: 50ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill--nav:hover {
  filter: brightness(0.97);
  border-color: color-mix(in srgb, currentColor 35%, var(--color-border));
}
.pill--nav:focus-visible {
  outline: 2px solid var(--color-focus, #4a7ab5);
  outline-offset: 1px;
}
.pill--stale {
  opacity: 0.45;
  text-decoration: line-through;
}
.pill--stale.pill--nav {
  cursor: default;
}
.pill--more {
  color: var(--color-ink-faint);
  border-style: dashed;
}
.pill--busy {
  opacity: 0.55;
  animation: pill-busy 1.2s ease-in-out infinite;
}
@keyframes pill-busy {
  50% {
    opacity: 0.3;
  }
}

/* chat dock as an OS-file drop target (§10 attachments) */
.chat.is-drop-target {
  outline: 2px dashed var(--color-accent);
  outline-offset: 2px;
}

/* --- run status strip ------------------------------------------------------ */

.run-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  align-self: center;
  max-width: min(100%, 36rem);
  min-width: 0;
  padding: 4px 12px;
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}
.run-status__dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: assistant-pulse 1.6s ease-in-out infinite;
}
.run-status[data-phase="waiting"] .run-status__dot {
  background: var(--color-ink-secondary);
  animation: none;
}
.run-status[data-phase="stopping"] .run-status__dot {
  opacity: 0.5;
}
.run-status[data-phase="thinking"] .run-status__label {
  animation: assistant-pulse 1.6s ease-in-out infinite;
}
@keyframes assistant-pulse {
  50% {
    opacity: 0.35;
  }
}
.run-status__label {
  flex: 0 1 auto;
  white-space: nowrap;
}
.run-status__detail {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-ink-secondary);
}
.run-status__detail:not([hidden])::before {
  content: "·";
  margin-right: var(--space-2);
  color: var(--color-ink-secondary);
}
.run-status__detail[hidden],
.run-status__prog[hidden],
.run-status__count[hidden] {
  display: none;
}
.run-status__prog {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
}
.run-status__count {
  flex: 0 0 auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.run-status__seg {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border);
}
.run-status__seg.is-done {
  background: var(--color-accent);
}
.run-status__seg.is-failed {
  background: var(--color-danger);
}
.run-status__seg.is-running {
  background: var(--color-accent);
  opacity: 0.45;
  animation: assistant-pulse 1.6s infinite;
}

/* --- node / process chips --------------------------------------------------- */

.node-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: stretch;
  max-width: 92%;
}
.node-chip {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 6px var(--space-3);
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  font-size: var(--text-xs);
}
.node-chip__status {
  flex-shrink: 0;
  margin-top: 2px;
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
}
.node-chip__status--done {
  color: var(--color-accent);
}
.node-chip__status--failed {
  color: var(--color-danger);
}
.node-chip__status--pending {
  color: var(--color-ink-faint);
}
.node-chip__main {
  flex: 1;
  min-width: 0;
}
.node-chip__title {
  font-weight: 600;
  color: var(--color-ink);
}
.node-chip__kind {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-ink-faint);
  margin-left: 6px;
}
.node-chip__digest {
  color: var(--color-ink-secondary);
  margin-top: 1px;
  overflow-wrap: break-word;
}
.node-chip__digest--error {
  color: var(--color-danger);
}
.node-chip__refs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.node-chip--pending {
  opacity: 0.6;
  border-style: dashed;
  background: transparent;
}

/* --- ask_user bubble -------------------------------------------------------- */

.ask-bubble {
  align-self: stretch;
  max-width: 92%;
  border: var(--border-hairline);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-1);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.ask-bubble[data-ask="expired"] {
  opacity: 0.55;
}
.ask-q__text {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 6px;
}
.ask-q__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.opt-chip {
  padding: 4px 12px;
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  background: transparent;
  transition: all var(--dur-fast) var(--ease);
}
.opt-chip:hover {
  background: var(--color-hover);
}
.opt-chip.is-selected {
  background: var(--color-ink);
  color: var(--color-bg);
  border-color: var(--color-ink);
}
.ask-q__custom {
  margin-top: 6px;
  width: 100%;
  padding: 5px 12px;
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-size: var(--text-xs);
}
.ask-q__custom::placeholder {
  color: var(--color-ink-faint);
}
.ask-q__custom:focus-visible {
  outline: 2px solid rgba(94, 169, 80, 0.4);
  outline-offset: 0;
}
.ask-bubble__send {
  align-self: flex-end;
  padding: 5px 16px;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-bg);
  font-size: var(--text-xs);
  font-weight: 600;
}
.ask-bubble__send:hover {
  background: var(--color-accent-hover);
}
.ask-bubble__send:disabled {
  opacity: 0.5;
}

/* answered state (compact) */
.answer-line {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}
.answer-line .opt-chip {
  pointer-events: none;
}

/* ============================================================================
   Latent-entity + tool.show bubbles (plan §14/§18) — mock: .latent-bubble /
   .show-bubble on the Conversation screen
   ============================================================================ */

.latent-bubble,
.show-bubble {
  align-self: stretch;
  flex-shrink: 0;
  min-height: min-content;
  max-width: 92%;
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.latent-bubble {
  border-style: dashed;
  border-color: var(--color-border-strong);
}
.latent-bubble--dismissed {
  opacity: 0.55;
}
.latent-bubble--flash {
  animation: latent-flash 1.1s ease;
}
@keyframes latent-flash {
  0%,
  100% {
    box-shadow: var(--shadow-1);
  }
  30%,
  60% {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--entity-highlight, #c47a3a) 55%, transparent);
  }
}
.latent-bubble__tag,
.show-bubble__tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--space-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  border-bottom: var(--border-hairline);
}
.latent-bubble__body,
.show-bubble__body {
  padding: var(--space-3) var(--space-4);
}
.show-bubble--tab .show-bubble__body {
  padding: var(--space-2) var(--space-3);
}
.show-bubble__tab-line {
  font-size: var(--text-sm);
  color: var(--color-ink-secondary);
}
.show-bubble__tab-line strong {
  color: var(--color-ink);
  font-weight: var(--weight-medium);
}
.latent-bubble__footer,
.show-bubble__footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-top: var(--border-hairline);
  background: var(--color-surface);
}
.latent-bubble__footer[hidden] {
  display: none;
}
.latent-bubble__loading {
  font-size: var(--text-xs);
  color: var(--color-ink-faint);
}
.latent-bubble__state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}

.btn-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: var(--text-xs);
  font-weight: 600;
}
.btn-save:hover {
  background: var(--color-accent-hover);
}
.btn-save:disabled {
  opacity: 0.6;
}
.btn-quiet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}
.btn-quiet:hover {
  background: var(--color-hover);
  color: var(--color-ink);
}
.btn-quiet:disabled {
  opacity: 0.6;
}
.folder-select {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}
.folder-select:hover {
  background: var(--color-hover);
}
.latent-bubble__footer .spacer,
.show-bubble__footer .spacer {
  flex: 1;
}

/* folder picker popover */
.latent-folder-list {
  display: flex;
  flex-direction: column;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  min-width: 180px;
}
.latent-folder-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--color-ink);
  text-align: left;
}
.latent-folder-item:hover {
  background: var(--color-hover);
}

/* ============================================================================
   Import mapping bubble (plan §6 worker.importsmith) — mock: .map-bubble on
   the Conversation screen
   ============================================================================ */

.map-bubble {
  align-self: stretch;
  max-width: 96%;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  overflow: hidden;
}
.map-bubble__body {
  padding: var(--space-3) var(--space-4);
}
.map-bubble__bp {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  margin-bottom: var(--space-3);
}
.map-bubble__bp label {
  color: var(--color-ink-secondary);
  font-weight: 600;
}
.map-bubble__bp input {
  flex: 1;
  padding: 4px 10px;
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-size: var(--text-xs);
}
.map-row {
  display: grid;
  grid-template-columns: 16px 1fr 14px 1fr 92px;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 0;
  border-bottom: var(--border-hairline);
  font-size: var(--text-xs);
}
.map-row:last-of-type {
  border-bottom: none;
}
.map-row__csv {
  font-family: var(--font-mono);
  color: var(--color-ink-secondary);
}
.map-row__arrow {
  color: var(--color-ink-faint);
  text-align: center;
}
.map-row input[type="checkbox"] {
  accent-color: var(--color-accent);
}
.map-row__cell input {
  width: 100%;
  padding: 3px 8px;
  border: var(--border-hairline);
  border-radius: 8px;
  background: var(--color-surface);
  font-size: var(--text-xs);
}
.type-select {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  padding: 3px 8px;
  border: var(--border-hairline);
  border-radius: 8px;
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
  background: var(--color-surface);
}
.type-select:hover {
  background: var(--color-hover);
}
.map-row.is-excluded .map-row__csv,
.map-row.is-excluded .map-row__cell,
.map-row.is-excluded .type-select {
  opacity: 0.4;
}
.map-bubble__hint {
  font-size: 10px;
  color: var(--color-ink-faint);
  margin-top: var(--space-2);
}

.doc-map-card {
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: var(--border-hairline);
}
.doc-map-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
}
.doc-map-card__file {
  font-family: var(--font-mono);
  color: var(--color-ink-secondary);
  font-weight: 600;
}
.doc-map-card__title {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  min-width: 12rem;
  color: var(--color-ink-secondary);
}
.doc-map-card__title input {
  flex: 1;
  padding: 3px 8px;
  border: var(--border-hairline);
  border-radius: 8px;
  background: var(--color-surface);
  font-size: var(--text-xs);
}
.doc-map-card__fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.doc-map-field {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: var(--space-2);
  align-items: start;
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}
.doc-map-field input,
.doc-map-field textarea {
  width: 100%;
  padding: 3px 8px;
  border: var(--border-hairline);
  border-radius: 8px;
  background: var(--color-surface);
  font-size: var(--text-xs);
  font-family: inherit;
  resize: vertical;
}
.doc-map-keep {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
  cursor: pointer;
}
.doc-map-keep input {
  accent-color: var(--color-accent);
}
.map-sample {
  margin-top: var(--space-2);
  overflow-x: auto;
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
}
.map-sample table {
  border-collapse: collapse;
  font-size: 10px;
  font-family: var(--font-mono);
  width: 100%;
}
.map-sample th,
.map-sample td {
  padding: 3px 8px;
  border-bottom: var(--border-hairline);
  text-align: left;
  white-space: nowrap;
}
.map-sample th {
  color: var(--color-ink-secondary);
  background: var(--color-surface);
}

/* mini view (latent view payload) */
.mini-view__title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
}
.latent-view .view-grid {
  max-height: 320px;
  overflow-y: auto;
}

/* mini card (tool.show / fallback card payload) */
.mini-card__title {
  font-size: var(--text-sm);
  font-weight: 600;
}
.mini-card__cells {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--space-2);
}
.mini-cell {
  font-size: var(--text-xs);
}
.mini-cell__key {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
}
.mini-cell__val {
  color: var(--color-ink);
  white-space: pre-wrap;
}

/* Full-text deliverables (transcripts) — scroll inside the bubble, don't clip. */
.latent-bubble .mini-cell__val {
  max-height: 360px;
  overflow-y: auto;
}

/* real card grid inside a latent bubble */
.latent-card .card-grid {
  margin-top: var(--space-2);
  max-height: 360px;
  overflow-y: auto;
}

/* blueprint draft / edit-draft bubble (§18 blueprintsmith) */
.latent-bp__summary {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}
.latent-bp__instructions {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--color-ink-faint);
  white-space: pre-wrap;
}
.latent-bp__grid {
  display: grid;
  gap: 6px;
  margin-top: var(--space-2);
  max-height: 360px;
  overflow-y: auto;
}
.bp-cell {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--color-surface);
  min-width: 0;
}
.bp-cell--new {
  border-color: var(--color-accent, #4a7);
}
.bp-cell--changed {
  border-style: dashed;
}
.bp-cell__head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.bp-cell__label {
  font-size: var(--text-xs);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bp-cell__type {
  font-size: 10px;
  color: var(--color-ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: none;
}
.bp-cell__badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent, #4a7);
  flex: none;
  margin-left: auto;
}
.bp-cell__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  max-height: 120px;
  overflow-y: auto;
}
.bp-chip {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-ink-secondary);
  white-space: nowrap;
}
.bp-chip--more {
  color: var(--color-ink-faint);
  border-style: dashed;
}

/* latent highlight preview */
.latent-highlight__preview {
  margin-top: var(--space-2);
}
.latent-highlight__comment {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}
.latent-highlight__meta {
  margin-top: var(--space-1);
  font-size: 10px;
  color: var(--color-ink-faint);
}

/* Collapsible stack of draft highlights (search report) */
.latent-hl-group {
  align-self: stretch;
  flex-shrink: 0;
  min-height: min-content;
  max-width: 92%;
  border: var(--border-hairline);
  border-style: dashed;
  border-color: var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.latent-hl-group__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px var(--space-3);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-ink-secondary);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.latent-hl-group__toggle:hover {
  background: var(--color-hover);
  color: var(--color-ink);
}
.latent-hl-group__chev {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--color-ink-faint);
}
.latent-hl-group__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.latent-hl-group__preview {
  padding: 0 var(--space-3) var(--space-3);
  cursor: pointer;
}
.latent-hl-group.is-open .latent-hl-group__preview {
  display: none;
}
.latent-hl-group__sum-line {
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
  padding: 2px 0 2px 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.latent-hl-group__sum-more {
  font-size: 10px;
  color: var(--color-ink-faint);
  padding: 2px 0 0 22px;
}
.latent-hl-group__list {
  display: none;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
  border-top: var(--border-hairline);
  max-height: min(70vh, 640px);
  overflow-y: auto;
}
/* class-driven open — author `display:flex` must not override [hidden] */
.latent-hl-group.is-open .latent-hl-group__list {
  display: flex;
}
.latent-hl-group .latent-bubble--in-group {
  max-width: 100%;
  box-shadow: none;
  border-radius: var(--radius-sm);
}
.latent-hl-group.is-open .latent-hl-group__toggle {
  border-bottom: var(--border-hairline);
}

.show-bubble__sep {
  border: 0;
  border-top: var(--border-hairline);
  margin: var(--space-3) 0;
}
.show-bubble__pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* --- system notice line ------------------------------------------------------ */

.sys-line {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--color-ink-faint);
}
/* abnormal run termination notice (budget / internal error) */
.sys-line--notice {
  color: var(--color-danger);
}

/* --- dock Stop button --------------------------------------------------------- */

.chat__stop {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-bg);
  font-size: var(--text-xs);
  font-weight: 600;
}
.chat__stop:hover {
  background: var(--color-danger);
}
.chat__stop:disabled {
  opacity: 0.6;
}
.chat__stop .sq {
  width: 9px;
  height: 9px;
  background: currentColor;
  border-radius: 2px;
}
.chat__stop[hidden] {
  display: none;
}

/* ============================================================================
   Changes overlay (plan §17) — mock: docs/assistant-ui-mock.html screen 4
   ============================================================================ */

.chat-history__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.changes-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  color: var(--color-ink-secondary);
  transition: background var(--dur-fast) var(--ease);
}
.changes-btn:hover {
  background: var(--color-hover);
  color: var(--color-ink);
}
.changes-btn__badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: var(--text-xs);
  font-weight: 600;
}
.changes-btn__badge[hidden] {
  display: none;
}

.changes-scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(28, 27, 25, 0.28);
}

.changes {
  width: min(560px, 92%);
  max-height: 92%;
  background: var(--color-surface);
  border: var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.changes__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5);
  border-bottom: var(--border-hairline);
}
.changes__header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.changes__header-actions .change-row__act[hidden] {
  display: none;
}
.changes__title {
  font-weight: 600;
}
.changes__title small {
  font-weight: 400;
  color: var(--color-ink-faint);
  margin-left: var(--space-2);
  font-size: var(--text-xs);
}
.changes__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-5) var(--space-5);
}
.changes__empty {
  color: var(--color-ink-faint);
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--space-6) 0;
}
.changes__group {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  margin: var(--space-4) 0 var(--space-2);
}
.changes__group:first-child {
  margin-top: var(--space-1);
}

.change-row {
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  margin-bottom: var(--space-2);
  overflow: hidden;
}
.change-row__top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  cursor: pointer;
}
.change-row__meta {
  color: var(--color-ink-faint);
}
.change-row__spacer {
  flex: 1;
}
.change-row__act {
  padding: 3px 12px;
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  color: var(--color-ink-secondary);
}
.change-row__act:hover {
  background: var(--color-hover);
  color: var(--color-ink);
}
.change-row__act:disabled {
  opacity: 0.6;
  pointer-events: none;
}
.change-row__act--approve {
  background: var(--color-ink);
  border-color: var(--color-ink);
  color: var(--color-bg);
}
.change-row__act--approve:hover {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}
.change-row--stale {
  opacity: 0.55;
}
.change-row--stale .change-row__act:disabled {
  text-decoration: line-through;
}

.change-row__diff {
  border-top: var(--border-hairline);
  background: var(--color-surface);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.7;
}
.change-row__diff .cellkey {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  margin: 4px 0 2px;
}
.dl {
  display: block;
  border-radius: 4px;
  padding: 0 6px;
  white-space: pre-wrap;
}
.dl--add {
  background: rgba(94, 169, 80, 0.14);
  color: #2d6b23;
}
.dl--del {
  background: rgba(179, 38, 30, 0.1);
  color: var(--color-danger);
  text-decoration: line-through;
}
.dl--ctx {
  color: var(--color-ink-secondary);
}

.changes__footnote {
  padding: var(--space-2) var(--space-5);
  border-top: var(--border-hairline);
  font-size: 10px;
  color: var(--color-ink-faint);
}

/* --- chat pill input (§10) --------------------------------------------------- */

.chat__input--rich {
  height: auto;
  align-self: center;
  padding: 4px 0;
  white-space: pre-wrap;
  overflow-x: hidden;
  overflow-y: auto;
  word-break: break-word;
  min-height: 1.9em;
  max-height: calc(1.9em * 6 + 8px);
  outline: none;
  cursor: text;
  line-height: 1.9;
}

.chat__input--rich:empty::before {
  content: attr(data-placeholder);
  color: var(--color-ink-faint);
  pointer-events: none;
}

.chat__input--rich .pill {
  cursor: pointer;
  user-select: none;
}

.chat__input--rich .pill [data-pin] {
  font-size: 9px;
  line-height: 1;
}

.pill--pinned {
  box-shadow: 0 0 0 2px rgba(94, 169, 80, 0.25);
}

/* --- trigger pickers (\ blueprint, @ folder) --------------------------------- */

.popover--picker {
  width: 320px;
  padding: 0;
}

.popover__search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--border-hairline);
  color: var(--color-ink-faint);
  font-size: var(--text-sm);
  min-height: 32px;
}

.popover__search b {
  color: var(--color-ink);
  font-weight: 500;
}

.popover__list {
  max-height: 240px;
  overflow-y: auto;
  padding: var(--space-1);
}

.popover__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 7px var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  text-align: left;
}

.popover__item:hover {
  background: var(--color-hover);
}

.popover__item.is-active {
  background: var(--color-active);
}

.popover__item small {
  color: var(--color-ink-faint);
  font-size: var(--text-xs);
  display: block;
}

.popover__item .grow {
  flex: 1;
  min-width: 0;
}

.popover__item .ind {
  width: 18px;
  flex-shrink: 0;
}

.popover__group {
  position: sticky;
  top: -5px;
  z-index: 1;
  padding: 6px var(--space-3) 4px;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  background: var(--color-surface-raised, var(--color-surface));
  border-bottom: var(--border-hairline);
}

.popover__group:first-child {
  margin-top: 0;
}

.popover__item-cost {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-ink-faint);
  white-space: nowrap;
  margin-left: var(--space-2);
}

.popover__hint {
  padding: 6px var(--space-3);
  border-top: var(--border-hairline);
  font-size: 10px;
  color: var(--color-ink-faint);
}

.popover--picker .popover__hint:first-child,
.popover--picker > div > .popover__hint:only-child {
  border-top: none;
}

/* ---- journal bubbles (decay gradient, §14) -------------------------------- */

.journal-bubble {
  align-self: stretch;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: transparent;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.journal-bubble:hover {
  background: var(--color-hover);
}
.journal-bubble__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-ink-faint);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.journal-bubble__text {
  font-size: var(--text-sm);
  color: var(--color-ink-secondary);
  margin-bottom: 6px;
}
.journal-bubble__refs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.journal-bubble__collapse {
  display: block;
  width: 100%;
  margin-bottom: var(--space-2);
  padding: 4px 0;
  font-size: var(--text-xs);
  color: var(--color-ink-faint);
  text-align: left;
}
.journal-bubble__collapse:hover {
  color: var(--color-ink);
}
.pill--stale {
  opacity: 0.45;
  text-decoration: line-through;
}

/* ---- assistant panel (/) — overlays chat-history, expands upward ---------- */

.panel--assistant {
  --apanel-inset: 12px;
  --apanel-bottom: calc(
    var(--space-panel-gap) + var(--chat-height) + var(--space-2) + var(--apanel-inset)
  );
  /* Full history-column height (desktop); bottom-anchored so height grows up. */
  --apanel-height: calc(100vh - var(--chrome-top) - var(--apanel-inset) - var(--apanel-bottom));
  pointer-events: none;
  opacity: 0;
  left: calc(var(--space-panel-gap) + var(--apanel-inset));
  right: auto;
  top: auto;
  bottom: var(--apanel-bottom);
  width: calc(var(--panel-col-width) - 2 * var(--apanel-inset));
  height: 0;
  max-height: none;
  border-radius: var(--radius-lg);
  transition:
    height var(--dur-panel) var(--ease),
    opacity var(--dur-panel) var(--ease),
    box-shadow var(--dur-panel) var(--ease);
}
/* Only the height animates for the assistant sheet (width is constant), so the
   content just needs the final height — otherwise the transcript is re-laid-out
   on every frame of the open. These are ui/panel.js's content-sizing hooks; see
   the .panel__content rule in layout.css. */
.panel--assistant {
  --panel-content-w: 100%;
  --panel-content-h: var(--apanel-height);
}

.panel--assistant .panel__orb {
  display: none;
}
.panel--assistant.is-expanded {
  pointer-events: auto;
  opacity: 1;
  z-index: calc(var(--z-panel) + 1);
  height: var(--apanel-height);
  box-shadow: var(--shadow-3);
}
/* Settings stacked above chat: shorter stack under the left panel. */
#app.panel-left-open.chat-open .panel--assistant {
  --apanel-height: calc(
    100vh - var(--space-panel-gap) - var(--panel-left-stack-h, 240px) - var(--space-2)
      - var(--apanel-inset)
      - var(--apanel-bottom)
  );
}
/* Chat history blurred behind the overlay. */
#app.assistant-panel-open .chat-history {
  filter: blur(6px);
  opacity: 0.85;
  pointer-events: none;
  user-select: none;
}
.panel--no-orb .panel__body.apanel-host,
.panel--assistant .panel__body.apanel-host {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.apanel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 599px) {
  .panel--assistant {
    left: calc(var(--space-panel-gap) + var(--apanel-inset));
    right: calc(var(--space-panel-gap) + var(--apanel-inset));
    width: auto;
    --apanel-height: calc(
      100vh - var(--space-panel-gap) - var(--apanel-inset) - var(--apanel-bottom)
    );
  }
  #app.panel-left-open.chat-open .panel--assistant {
    --apanel-height: calc(
      100vh - var(--space-panel-gap) - var(--apanel-inset) - var(--apanel-bottom)
    );
  }
}
.apanel__tabs {
  display: flex;
  gap: 2px;
  padding: var(--space-2) var(--space-4);
  border-bottom: var(--border-hairline);
  flex-shrink: 0;
  overflow-x: auto;
}
.apanel__tab {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  color: var(--color-ink-secondary);
  white-space: nowrap;
}
.apanel__tab:hover {
  background: var(--color-hover);
  color: var(--color-ink);
}
.apanel__tab.is-active {
  background: var(--color-ink);
  color: var(--color-bg);
}
.apanel__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.field {
  margin-bottom: var(--space-4);
}
.field__label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-secondary);
  margin-bottom: 6px;
}
.field input[type="text"],
.field textarea {
  width: 100%;
  padding: 8px 14px;
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  font-size: var(--text-sm);
}
.field textarea {
  min-height: 88px;
  resize: vertical;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  cursor: pointer;
}
.avatar-orb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-round);
  display: grid;
  place-items: center;
  background: var(--color-ink);
  color: var(--color-bg);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-row small {
  color: var(--color-ink-faint);
  font-size: var(--text-xs);
}

.model-group {
  margin-bottom: var(--space-4);
}
.model-group__name {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  margin-bottom: var(--space-1);
}
.model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 7px 0;
  border-bottom: var(--border-hairline);
  font-size: var(--text-sm);
}
.model-row:last-child {
  border-bottom: none;
}
.model-row__fn {
  color: var(--color-ink);
}
.model-row__fn small {
  display: block;
  color: var(--color-ink-faint);
  font-size: var(--text-xs);
}
.model-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  padding: 4px 10px;
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
  white-space: nowrap;
  overflow: hidden;
}
.model-pick:hover {
  background: var(--color-hover);
}
.model-pick span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-pick.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  border-style: dashed;
}
.model-search {
  display: none;
  width: 100%;
  padding: 7px 14px;
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: var(--border-hairline);
}
.toggle-row:last-child {
  border-bottom: none;
}
.toggle-row__name {
  font-size: var(--text-sm);
  font-weight: 500;
}
.toggle-row__desc {
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}
.switch {
  position: relative;
  width: 36px;
  height: 21px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-border-strong);
  transition: background var(--dur-fast) var(--ease);
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-1);
  transition: translate var(--dur-fast) var(--ease);
}
.switch.is-on {
  background: var(--color-accent);
}
.switch.is-on::after {
  translate: 15px 0;
}

.ledger-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-ink-faint);
  margin-bottom: var(--space-3);
}
.ledger-node {
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
}
.ledger-node__top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.ledger-node__id {
  font-family: var(--font-mono);
  color: var(--color-ink-faint);
}
.ledger-node__title {
  font-weight: 600;
  flex: 1;
}
.ledger-node__kind {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-ink-faint);
}
.ledger-node__sub {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 3px;
  color: var(--color-ink-secondary);
  flex-wrap: wrap;
}
.ledger-node__deps {
  font-family: var(--font-mono);
  color: var(--color-ink-faint);
}
.ledger-node__actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.ledger-node__actions button {
  padding: 2px 10px;
  font-size: 10px;
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  color: var(--color-ink-secondary);
}
.ledger-node__actions button:hover {
  background: var(--color-hover);
  color: var(--color-ink);
}
.ledger-node--pending {
  border-style: dashed;
  background: transparent;
}
.ledger-node--failed {
  border-left: 3px solid var(--color-danger);
}
.st {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}
.st__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.st--done .st__dot {
  background: var(--color-accent);
}
.st--running .st__dot {
  background: #4a7ab5;
  animation: pulse 1.4s infinite;
}
.st--pending .st__dot {
  background: var(--color-ink-faint);
}
.st--failed .st__dot {
  background: var(--color-danger);
}
.st--cancelled .st__dot,
.st--blocked .st__dot {
  background: var(--color-ink-faint);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.stat-card {
  padding: var(--space-3);
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
}
.stat-card__val {
  font-size: var(--text-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-card__label {
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}
.usage-row {
  display: grid;
  grid-template-columns: 1fr 120px 56px;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 0;
  border-bottom: var(--border-hairline);
  font-size: var(--text-xs);
}
.usage-row:last-child {
  border-bottom: none;
}
.usage-row__fn {
  font-family: var(--font-mono);
  color: var(--color-ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
}
.usage-row__bar {
  height: 6px;
  border-radius: 3px;
  background: var(--color-border);
  overflow: hidden;
}
.usage-row__bar i {
  display: block;
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;
}
.usage-row__amt {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
