/* ── Inbox: the top bar is the toolbar (title, three tabs), then the list and the open thread. ── */
.inbox-topbar {
  gap: 12px;
}
.inbox-tabs {
  display: flex;
  gap: 2px;
}
.inbox-tabs [role="tab"] {
  height: 24px;
  padding: 0 10px;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  background: none;
  box-shadow: none;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 400;
}
.inbox-tabs [role="tab"]:hover {
  background: none;
  color: var(--foreground);
}
.inbox-tabs [role="tab"][aria-selected="true"] {
  background: var(--muted);
  color: var(--foreground);
  box-shadow: inset 0 0 0 1px var(--border);
}
.inbox-tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.inbox-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.inbox-message {
  margin: 0;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted-foreground);
}
.inbox-message:empty {
  display: none;
}
.inbox-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.inbox-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 4px 0;
}
.inbox-list > .btn {
  margin: 8px 16px;
}

/* A row: status ring, title, time; one line of what and where under the title. */
.inbox-row {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  column-gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px 16px;
  border: 0;
  background: transparent;
  color: var(--foreground);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.inbox-row + .inbox-row {
  box-shadow: 0 -1px 0 var(--border);
}
.inbox-row:hover {
  background: var(--surface-hover);
}
.inbox-row[aria-current="true"] {
  background: var(--surface-selected);
}
.inbox-row[aria-current="true"]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--accent-brand);
}
.inbox-row[aria-current="true"] + .inbox-row {
  box-shadow: none;
}
.inbox-row:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}
.inbox-glyph {
  width: 14px;
  height: 14px;
  color: var(--faint-foreground);
}
.inbox-row[data-glyph="wait"] .inbox-glyph {
  color: var(--accent-brand);
}
.inbox-row[data-glyph="fail"] .inbox-glyph {
  color: var(--destructive);
}
.inbox-row[data-glyph="ok"] .inbox-glyph {
  color: var(--ok);
}
.inbox-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-row[data-read] .inbox-title {
  font-weight: 400;
}
.inbox-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.inbox-meta {
  grid-column: 2 / 4;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The open thread. */
.inbox-detail {
  min-width: 0;
  overflow-y: auto;
}
/* A grid so the quiet actions share the title's row; everything else spans the width. */
.inbox-detail-inner {
  max-width: 784px;
  padding: 24px 32px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  column-gap: 16px;
  row-gap: 16px;
}
.inbox-detail-inner > * {
  grid-column: 1 / -1;
  min-width: 0;
}
/* Placeholders with nothing in them (sources, an error) take no row. */
.inbox-detail-inner > :empty {
  display: none;
}
.inbox-detail-inner > h2 {
  grid-column: 1;
  grid-row: 1;
}
.inbox-detail-inner > .inbox-actions {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}
.inbox-detail h2 {
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.inbox-detail h3 {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
}
.inbox-detail p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* Thread actions: quiet, top right; Back only on a phone. */
.inbox-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  min-height: 28px;
}
.inbox-actions .btn {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 999px;
  color: var(--muted-foreground);
}
.inbox-actions .btn:hover:not(:disabled) {
  color: var(--foreground);
}
.inbox-actions .inbox-back {
  margin-right: auto;
}
.inbox-back {
  display: none;
}
.inbox-actions .input {
  height: 28px;
  border-radius: 999px;
}
/* The line under a title: the state as coloured text, then source and time. */
.inbox-byline,
.memory-byline {
  margin-top: -12px !important;
  color: var(--muted-foreground);
}
.inbox-byline .badge {
  height: auto;
  padding: 0;
  background: none;
  font-size: 13px;
}
.inbox-byline .badge .dot {
  width: 6px;
  height: 6px;
}
/* Approve / Reject: one primary pill; Reject stays quiet until it is meant. */
.inbox-decide {
  position: sticky;
  bottom: 0;
  z-index: 1;
  gap: 8px;
  padding: 12px 0;
  background: var(--background);
}
.inbox-decide .btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
}
.inbox-reject {
  color: var(--muted-foreground);
}
.inbox-reject:hover:not(:disabled),
.inbox-reject:focus-visible {
  color: var(--destructive-text);
  background: var(--destructive-soft);
}
/* What is decided on: a hairline card (a run's approval, a publication, a review's decision). Its state is text. */
.approval-card .badge {
  height: auto;
  padding: 0;
  background: none;
}
.approval-card,
.inbox-decision {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.approval-card .inbox-decide,
.inbox-decision .inbox-decide {
  padding: 0;
  position: static;
  background: none;
}

/* A memory change (memory.js renderProposal): one card per file, its path and what happens to it. */
.memory-change {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}
.memory-change-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}
.memory-change-path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.memory-change-kind {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.memory-change-kind .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-brand);
}
.memory-change[data-kind="new"] .memory-change-kind .dot {
  background: var(--ok);
}
.memory-change[data-kind="delete"] .memory-change-kind .dot {
  background: var(--destructive);
}
.memory-change .memory-diff {
  display: block;
  margin: 0;
  padding: 8px 0;
  font: 12px/20px var(--font-mono);
}
.memory-change .memory-diff > pre {
  margin: 0;
  padding: 4px 12px;
  max-height: none;
  background: none;
  border: 0;
  border-radius: 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* A new note reads as text; it is still the exact text, line breaks and all. */
.memory-change[data-kind="new"] .memory-diff > pre {
  padding: 8px 16px;
  font: 13px/20px var(--font-sans);
}
.memory-change[data-kind="delete"] .memory-diff > pre {
  color: var(--muted-foreground);
  text-decoration: line-through;
}
.memory-diff > div {
  padding: 0 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.memory-diff > .add {
  background: var(--ok-soft);
}
.memory-diff > .del {
  background: var(--destructive-soft);
}
.memory-diff > .ctx {
  color: var(--muted-foreground);
}
.memory-diff-sign {
  display: inline-block;
  width: 16px;
  color: var(--muted-foreground);
  user-select: none;
}
.memory-diff-fold {
  margin: 4px 0;
  color: var(--faint-foreground);
  font-family: var(--font-sans);
}

/* Reviews: the item sent for review, its decision and what followed it. */
.review-tags {
  flex-wrap: wrap;
  gap: 6px;
}
.review-body {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--card);
}
.review-body .markdown > :last-child {
  margin-bottom: 0;
}
.review-links {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
}
.review-links a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.review-details summary,
.inbox-events summary,
.inbox-trace summary {
  cursor: pointer;
  color: var(--muted-foreground);
  font-weight: 500;
}
.review-details summary {
  margin-bottom: 8px;
}
/* Publications: what is being published, in one card; the decision below it. */
.publication-summary {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--card);
  display: grid;
  gap: 12px;
}
.publication-summary-head {
  justify-content: space-between;
  align-items: baseline;
}
.publication-summary-head h3 {
  font-size: 14px;
  font-weight: 600;
}
.publication-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 20px;
  row-gap: 8px;
  margin: 0;
}
.publication-facts dt {
  color: var(--muted-foreground);
  font-size: 13px;
  padding-top: 1px;
}
.publication-facts dd {
  margin: 0;
  min-width: 0;
}
.publication-connections {
  flex-wrap: wrap;
  gap: 6px;
}
.publication-decision .review-decided,
.review-decision .review-decided {
  font-weight: 500;
}
.review-comment {
  margin: 0;
  padding: 8px 12px;
  border-left: 2px solid var(--border);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.review-followups {
  display: grid;
  gap: 8px;
}
.review-followups ul,
.run-reviews ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}
.run-reviews {
  display: grid;
  gap: 8px;
}
.notice-entry {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.inbox-detail pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.6;
  padding: 16px;
  background: var(--muted);
  border-radius: var(--radius);
  max-height: 480px;
  overflow-y: auto;
  margin: 0;
}
.inbox-result {
  display: grid;
  gap: 12px;
}
.inbox-events,
.inbox-trace {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.inbox-events ol {
  padding-left: 20px;
}
.inbox-events li {
  padding: 8px 0;
}
.inbox-events time {
  display: block;
}
.inbox-trace section {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.inbox-empty {
  padding: 32px 16px;
}
.inbox-empty h2 {
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  margin: 0 0 4px;
}
.inbox-empty p {
  margin: 0;
}
.inbox-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}
.inbox-placeholder > span:first-child {
  margin-bottom: 8px;
  color: var(--faint-foreground);
}
.inbox-placeholder > span:first-child .icon {
  width: 32px;
  height: 32px;
}
@media (max-width: 760px) {
  /* The tabs need the bar; the sidebar already says this is the Inbox. */
  .inbox-topbar h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .inbox-detail-inner > .inbox-actions {
    grid-column: 1 / -1;
    grid-row: auto;
  }
  .inbox-detail-inner > h2 {
    grid-column: 1 / -1;
    grid-row: auto;
  }
  .inbox-layout {
    display: block;
    min-height: 360px;
  }
  .inbox-list {
    border: 0;
  }
  /* No pane is open beside the list on a phone: no row looks selected. */
  .inbox-row[aria-current="true"] {
    background: transparent;
  }
  .inbox-row[aria-current="true"]::before {
    display: none;
  }
  .inbox-row[aria-current="true"] + .inbox-row {
    box-shadow: 0 -1px 0 var(--border);
  }
  .inbox-detail {
    display: none;
  }
  .inbox-layout.detail-open .inbox-list {
    display: none;
  }
  .inbox-layout.detail-open .inbox-detail {
    display: block;
  }
  .inbox-detail-inner {
    padding: 12px 16px 24px;
  }
  .inbox-back {
    display: inline-flex;
  }
}

@media (pointer: coarse) {
  .inbox-actions .btn,
  .inbox-decide .btn {
    min-height: 40px;
  }
}

/* ── Readable payloads (approval proposals, step output) ──────────────────── */
.payload-view {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.payload-tabs {
  display: flex;
  gap: 4px;
}
.payload-tab[aria-pressed="true"] {
  background: var(--muted);
  font-weight: 500;
}
.payload-formatted {
  padding: 12px 16px;
  background: var(--muted);
  border-radius: var(--radius);
  max-height: 480px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
}
.payload-formatted .payload-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.payload-formatted .payload-scalar {
  font-size: 12px;
}
.payload-object {
  display: grid;
  grid-template-columns: minmax(80px, max-content) minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 6px;
  margin: 0;
}
.payload-object dt {
  color: var(--muted-foreground);
  font-size: 12px;
  overflow-wrap: anywhere;
  padding-top: 1px;
}
.payload-object dd {
  margin: 0;
  min-width: 0;
}
.payload-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}
.payload-object .payload-object,
.payload-list .payload-object {
  padding-left: 10px;
  border-left: 2px solid var(--border);
}
.payload-formatted .payload-raw {
  margin: 0;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--background);
  max-height: 240px;
}
/* The runs panel shows step output in the same way. */
