:root {
  color-scheme: dark;
  --bg: #111;
  --text: #ddd;
  --muted: #888;
  --accent: #e8a832;
  --ok: #4c4;
  --bad: #e55;
  --dim: #666;
  --progress-dock-space: 3.5rem;
}

* { box-sizing: border-box; margin: 0; }

html {
  overflow-anchor: none;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  padding-bottom: calc(var(--progress-dock-space) + env(safe-area-inset-bottom));
  overflow-anchor: none;
}

.page {
  padding: 0.75rem 1.5rem;
  display: grid;
  gap: 0.75rem;
}

header h1 { font-size: 1rem; font-weight: 600; display: inline; }
header p { color: var(--muted); font-size: 0.8rem; display: inline; margin-left: 0.5rem; }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar label { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

button, input, select {
  border: 1px solid #333;
  background: #1a1a1a;
  color: var(--text);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

button { cursor: pointer; }
button:hover { background: #252525; }

.toolbar-sep { width: 1px; height: 1rem; background: #333; }
.compact-number {
  width: 5rem;
  padding: 0.15rem 0.3rem;
}

/* Card */
.card { margin-bottom: 0.25rem; }
.card h2 { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.3rem; }

/* Summary */
.summary {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.summary strong {
  color: var(--accent);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 0.35rem;
}
.summary-wide {
  flex-basis: 100%;
}
.summary-progress { color: #d0a64a; }
.summary-phase { color: #d0a64a; }
.summary-phase-pass { color: var(--ok); }

.progress-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  min-height: 2.35rem;
  padding: 0.35rem 1.5rem;
  background: rgba(16, 16, 16, 0.96);
  border-top: 1px solid #333;
  box-shadow: 0 -0.25rem 0.75rem rgba(0, 0, 0, 0.35);
  font-size: 0.78rem;
}

.progress-dock strong {
  color: var(--accent);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-main { color: #d0a64a; }
.dock-phase { color: #d0a64a; }
.dock-phase-pass { color: var(--ok); }
.dock-turn { color: #888; }
.dock-usage { color: #999; }
.dock-tests { color: #b08030; }
.dock-tests-pass { color: var(--ok); }
.dock-meta {
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

/* Timeline */
.timeline {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  overflow-anchor: none;
}

.timeline * {
  overflow-anchor: none;
}

.combined-run {
  display: grid;
  gap: 0.25rem;
  padding: 0.35rem 0 0.55rem;
  border-bottom: 1px solid #222;
}

.combined-run-header {
  display: grid;
  gap: 0.25rem;
}

.combined-run-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
}

.combined-run-title {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.combined-run-title:hover {
  color: #ffd071;
  text-decoration: underline;
}

.run-repository-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.22rem;
  color: #8aa7c7;
  font-size: 0.72rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.run-repository-link:hover {
  color: #b6d6f7;
  text-decoration: underline;
}

.external-link-arrow {
  font-size: 0.88em;
  line-height: 1;
}

body.is-static-viz .combined-view-toggle {
  display: none;
}

.combined-run-details {
  display: flex;
  align-items: center;
  gap: 0.35rem 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 0.78rem;
}

.combined-run-meta {
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

.combined-run-feed {
  display: grid;
  gap: 1px;
  padding-left: 0.75rem;
  border-left: 2px solid #252525;
}

.combined-empty,
.combined-run-empty {
  padding: 0.35rem 0;
  font-size: 0.8rem;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.comparison-content {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

.comparison-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.comparison-chart {
  border: 1px solid #242424;
  background: #111;
  padding: 0.65rem;
  min-width: 0;
}

.comparison-chart-title,
.comparison-chart-legend {
  display: flex;
  align-items: center;
  gap: 0.45rem 0.8rem;
  flex-wrap: wrap;
}

.comparison-chart-title {
  justify-content: space-between;
  margin-bottom: 0.35rem;
  color: #eee;
  font-size: 0.78rem;
}

.comparison-chart-title span {
  color: var(--muted);
  font-size: 0.72rem;
}

.comparison-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.comparison-echart {
  width: 100%;
  height: 18rem;
  min-height: 260px;
}

.comparison-grid {
  stroke: #262626;
  stroke-width: 1;
}

.comparison-axis,
.comparison-tick {
  stroke: #555;
  stroke-width: 1;
}

.comparison-axis-label {
  fill: #9a9a9a;
  font-size: 11px;
}

.comparison-area-fill {
  fill-opacity: 0.14;
}

.comparison-area-line {
  fill: none;
  stroke-width: 2.2;
}

.comparison-chart-legend {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.comparison-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.comparison-chart-legend i {
  width: 0.7rem;
  height: 0.7rem;
  flex: 0 0 auto;
}

.comparison-tooltip {
  display: grid;
  gap: 0.25rem;
  min-width: 10rem;
}

.comparison-tooltip-title {
  color: #eee;
  font-weight: 650;
  margin-bottom: 0.1rem;
}

.comparison-tooltip-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
}

.comparison-tooltip-row strong {
  color: #f2f2f2;
  font-weight: 650;
}

.comparison-tooltip-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
}

.comparison-table th,
.comparison-table td {
  border-bottom: 1px solid #222;
  padding: 0.32rem 0.45rem;
  text-align: left;
  vertical-align: top;
}

.comparison-table thead th {
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.comparison-total th,
.comparison-total td {
  background: #171717;
  color: #eee;
  font-weight: 650;
}

.comparison-meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.run-docs-card {
  border-top: 1px solid #222;
  padding-top: 0.1rem;
}

.run-docs {
  display: grid;
  gap: 0.45rem;
}

.run-docs-meta {
  display: flex;
  gap: 0.25rem 0.75rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.75rem;
}

.run-docs-meta span:first-child {
  color: var(--accent);
}

.run-docs-body {
  display: grid;
  grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
}

.run-docs-nav {
  display: grid;
  gap: 0.45rem;
  align-content: start;
}

.run-doc-group {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.run-doc-group-title {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.64rem;
  letter-spacing: 0.03em;
}

.docs-view {
  display: grid;
  gap: 0.5rem;
}

.docs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.doc-tab {
  font-size: 0.75rem;
  padding: 0.2rem 0.42rem;
}

.run-docs .doc-tab {
  width: 100%;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-tab.is-selected {
  border-color: #6b5424;
  color: #ffd071;
  background: #221b10;
}

.doc-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid #222;
  background: #0d0d0d;
  border-radius: 4px;
  padding: 0.75rem;
  max-height: calc(100vh - 12rem);
  overflow: auto;
  font: 0.78rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.accordion-body[hidden] { display: none !important; }

.accordion-header {
  appearance: none;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  min-width: 0;
  text-align: left;
  width: 100%;
}

.accordion-header:hover { background: none; }
.accordion-header:focus-visible { outline: 1px solid #555; outline-offset: 2px; }

/* Turn accordion */
.turn > .turn-header {
  cursor: pointer;
  padding: 0.3rem 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  user-select: none;
  border-bottom: 1px solid #222;
}

.turn > .turn-header::before {
  content: "\25B8";
  font-size: 0.7rem;
  color: var(--dim);
  transition: transform 0.15s;
  width: 0.7rem;
}
.turn.is-open > .turn-header::before { transform: rotate(90deg); }
.turn > .turn-header:hover { color: #fff; }

.turn-info { color: var(--muted); font-size: 0.78rem; }
.turn-window { color: #777; font-size: 0.78rem; }
.turn-duration { color: #777; font-size: 0.78rem; }
.turn-phase { color: #d0a64a; font-size: 0.78rem; }
.turn-phase-pass { color: #4a4; }
.turn-progress { color: #d0a64a; font-size: 0.78rem; }
.turn-tests { color: #b08030; font-size: 0.78rem; }
.turn-tests-pass { color: #4a4; }
.turn-usage {
  color: #777;
  font-size: 0.72rem;
  flex: 1 1 28rem;
  margin-left: auto;
  min-width: 18rem;
  text-align: right;
}

@media (max-width: 800px) {
  body {
    padding-bottom: calc(var(--progress-dock-space) + env(safe-area-inset-bottom));
  }

  .page {
    padding: 0.6rem 0.7rem;
    gap: 0.6rem;
  }

  header h1 {
    display: block;
  }

  header p {
    display: block;
    margin-left: 0;
  }

  .toolbar {
    gap: 0.4rem;
  }

  .toolbar-sep {
    display: none;
  }

  #runSelect {
    flex: 1 1 100%;
    min-width: 0;
  }

  #eventFilter {
    flex: 1 1 10rem;
    min-width: 0;
    width: auto !important;
  }

  .summary {
    gap: 0.35rem 0.8rem;
  }

  .summary > div {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .summary-wide strong {
    display: block;
    margin-bottom: 0.08rem;
  }

  .progress-dock {
    align-items: flex-start;
    gap: 0.35rem 0.65rem;
    padding: 0.35rem 0.75rem;
  }

  .progress-dock strong {
    flex-basis: 100%;
    max-width: 100%;
  }

  .dock-meta {
    margin-left: 0;
  }

  .combined-run-details {
    align-items: flex-start;
  }

  .combined-run-meta {
    flex-basis: 100%;
    margin-left: 0;
  }

  .comparison-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .comparison-charts {
    grid-template-columns: 1fr;
  }

  .run-docs-body {
    grid-template-columns: 1fr;
  }

  .run-docs-nav {
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 0.25rem;
  }

  .docs-nav {
    gap: 0.25rem;
  }

  .doc-content {
    max-height: none;
    font-size: 0.72rem;
  }

  .dock-turn,
  .dock-usage,
  .dock-phase,
  .dock-main,
  .dock-tests,
  .combined-run-details .dock-turn,
  .combined-run-details .dock-usage,
  .combined-run-details .dock-phase,
  .combined-run-details .dock-main,
  .combined-run-details .dock-tests {
    flex-basis: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }

  .turn > .turn-header {
    align-items: flex-start;
    gap: 0.3rem 0.45rem;
  }

  .turn-window,
  .turn-phase,
  .turn-progress,
  .turn-tests {
    flex: 1 1 100%;
    margin-left: 1.2rem;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .turn-usage {
    flex-basis: 100%;
    margin-left: 1.2rem;
    min-width: 0;
    text-align: left;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  body.is-combined-view {
    font-size: 12px;
  }

  body.is-combined-view .page {
    padding: 0.35rem 0.45rem;
    gap: 0.25rem;
  }

  body.is-combined-view header,
  body.is-combined-view .summary-card {
    display: none;
  }

  body.is-combined-view .toolbar {
    gap: 0.25rem;
  }

  body.is-combined-view .toolbar label[for="runSelect"],
  body.is-combined-view #runSelect,
  body.is-combined-view #refreshRuns,
  body.is-combined-view #reloadRun,
  body.is-combined-view .toolbar label[for="codexDetail"],
  body.is-combined-view #codexDetail,
  body.is-combined-view #eventFilter,
  body.is-combined-view #eventCount,
  body.is-combined-view .full-view-toggle {
    display: none;
  }

  body.is-combined-view .card {
    margin-bottom: 0;
  }

  body.is-combined-view .card h2 {
    display: none;
  }

  body.is-combined-view .timeline {
    gap: 0.18rem;
  }

  body.is-combined-view .combined-run {
    gap: 0.08rem;
    padding: 0.12rem 0 0.22rem;
  }

  body.is-combined-view .combined-run-header {
    gap: 0.08rem;
  }

  body.is-combined-view .combined-run-title {
    font-size: 0.76rem;
    line-height: 1.1;
  }

  body.is-combined-view .combined-run-details {
    gap: 0.08rem 0.45rem;
    font-size: 0.64rem;
    line-height: 1.15;
  }

  body.is-combined-view .combined-run-meta {
    flex-basis: auto;
    margin-left: 0;
  }

  body.is-combined-view .combined-run-feed {
    gap: 0;
    padding-left: 0.45rem;
    border-left-width: 1px;
  }

  body.is-combined-view .combined-run-details .dock-turn,
  body.is-combined-view .combined-run-details .dock-usage,
  body.is-combined-view .combined-run-details .dock-phase,
  body.is-combined-view .combined-run-details .dock-main,
  body.is-combined-view .combined-run-details .dock-tests {
    flex: 0 1 auto;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  body.is-combined-view .ev {
    font-size: 0.66rem;
  }

  body.is-combined-view .ev-cmd > .accordion-header,
  body.is-combined-view .ev-file > .accordion-header,
  body.is-combined-view .ev-todo > .accordion-header {
    gap: 0.25rem;
    padding: 0.02rem 0;
  }

  body.is-combined-view .cmd-inline,
  body.is-combined-view .file-title,
  body.is-combined-view .phase-check-command {
    font-size: 0.66rem;
  }

  body.is-combined-view .pill,
  body.is-combined-view .ts,
  body.is-combined-view .cmd-lines {
    font-size: 0.58rem;
    padding-block: 0;
  }

  body.is-combined-view .ev-msg,
  body.is-combined-view .ev-prompt,
  body.is-combined-view .ev-goal,
  body.is-combined-view .ev-phase,
  body.is-combined-view .ev-thought {
    margin: 0;
    padding: 0.03rem 0 0.03rem 0.35rem;
    border-left-width: 2px;
  }

  body.is-combined-view .msg-body,
  body.is-combined-view .prompt-body,
  body.is-combined-view .goal-body,
  body.is-combined-view .thought-body {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 0.66rem;
    line-height: 1.15;
    white-space: normal;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  body.is-combined-view .prompt-label,
  body.is-combined-view .goal-label,
  body.is-combined-view .phase-label,
  body.is-combined-view .thought-subject {
    display: inline;
    font-size: 0.56rem;
    margin: 0 0.25rem 0 0;
  }

  body.is-combined-view .phase-checks {
    display: none;
  }

  body.is-combined-view .progress-dock {
    display: none;
  }

}

.turn-feed {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 0.2rem 0 0.4rem 1rem;
  border-left: 2px solid #252525;
  margin-left: 0.3rem;
}

/* --- Event cards --- */
.ev {
  min-width: 0;
  font-size: 0.82rem;
}

/* Command */
.ev-cmd-fail .cmd-inline { color: var(--bad); }

.ev-subagent-fail .subagent-title { color: var(--bad); }

.ev-subagent > .accordion-header {
  cursor: pointer;
  padding: 0.15rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.ev-subagent > .accordion-header::before {
  content: ">";
  color: #7fa6d8;
  font-family: monospace;
  font-size: 0.75rem;
}

.subagent-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #b9cbe2;
}

.subagent-meta,
.turn-subagents {
  color: #7893b4;
  font-size: 0.7rem;
  white-space: nowrap;
}

.subagent-missing {
  border: 1px solid #7a6334;
  border-radius: 3px;
  color: #c8a65c;
  font-size: 0.65rem;
  line-height: 1.25;
  padding: 0.05rem 0.25rem;
  white-space: nowrap;
}

.subagent-section-label {
  display: block;
  margin: 0.4rem 0 0.15rem;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.subagent-output {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ev-cmd > .accordion-header {
  cursor: pointer;
  padding: 0.15rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ev-cmd > .accordion-header::before {
  content: "$";
  color: var(--dim);
  font-family: monospace;
  font-size: 0.75rem;
}

.cmd-inline {
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 0.8rem;
  background: none;
  border: none;
  padding: 0;
  color: #9d9;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-full {
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: #101510;
  border-left: 2px solid #354835;
  border-radius: 3px;
  padding: 0.4rem 0.6rem;
  margin: 0.2rem 0 0.2rem 1rem;
  color: #b8e0b8;
  line-height: 1.4;
}

.cmd-output {
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0a0a0a;
  border-radius: 3px;
  padding: 0.4rem 0.6rem;
  margin: 0.2rem 0 0.2rem 1rem;
  max-height: 400px;
  overflow-y: auto;
  color: #aaa;
  line-height: 1.4;
}

.btn-more {
  display: inline-block;
  margin: 0.15rem 0 0.15rem 1rem;
  font-size: 0.72rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

/* Message */
.ev-msg {
  padding: 0.3rem 0;
  border-left: 3px solid #345;
  padding-left: 0.6rem;
  margin: 0.15rem 0;
}

.msg-body {
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  color: #ccc;
}

/* File changes */
.ev-file > .accordion-header {
  cursor: pointer;
  padding: 0.15rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ev-file > .accordion-header::before {
  content: "\25AA";
  color: #a84;
  font-size: 0.6rem;
}

.file-list { padding: 0.1rem 0 0.1rem 1rem; }
.file-row {
  font-size: 0.78rem;
  padding: 0.08rem 0;
  font-family: "SF Mono", "Consolas", monospace;
}
.file-title {
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 0.78rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-kind { color: var(--accent); margin-right: 0.3rem; font-size: 0.7rem; }
.file-path { color: #ba8; }
pre.file-diff,
pre.file-diff[class*="language-"],
pre.file-source,
pre.file-source[class*="language-"] {
  margin: 0.1rem 0 0.35rem 1rem;
  padding: 0.4rem 0.5rem;
  border-left: 2px solid #3a3124;
  color: #aaa;
  background: #151515;
  overflow-x: auto;
  font-size: 0.72rem;
  line-height: 1.35;
  border-radius: 4px;
  box-shadow: none;
}

pre.file-source,
pre.file-source[class*="language-"] {
  border-left-color: #2d4b36;
}

pre.file-diff > code,
pre.file-diff > code[class*="language-"],
pre.file-source > code,
pre.file-source > code[class*="language-"] {
  color: inherit;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  text-shadow: none;
  white-space: pre;
}

pre.file-diff .token.inserted:not(.prefix) {
  background: rgba(46, 160, 67, 0.22);
}

pre.file-diff .token.deleted:not(.prefix) {
  background: rgba(248, 81, 73, 0.22);
}

pre.file-diff .token.inserted:not(.prefix),
pre.file-diff .token.deleted:not(.prefix) {
  display: block;
  min-width: 100%;
  color: inherit;
}

pre.file-diff .token.prefix {
  background: transparent;
}

/* Todo */
.ev-todo > .accordion-header {
  cursor: pointer;
  padding: 0.15rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ev-todo > .accordion-header::before {
  content: "\2610";
  color: #88a;
  font-size: 0.75rem;
}

.todo-list { padding: 0.1rem 0 0.1rem 1rem; }
.todo-row { font-size: 0.78rem; padding: 0.08rem 0; }
.todo-done { color: #686; text-decoration: line-through; }

/* Prompt (ralph.prompt) */
.ev-prompt {
  padding: 0.3rem 0;
  border-left: 3px solid #a64;
  padding-left: 0.6rem;
  margin: 0.15rem 0;
}

.prompt-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #a64;
  margin-bottom: 0.15rem;
}

.prompt-body {
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  color: #da8;
}

/* Goal (ralph.goal) */
.ev-goal {
  padding: 0.3rem 0;
  border-left: 3px solid #8a6;
  padding-left: 0.6rem;
  margin: 0.15rem 0;
}

.goal-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8a6;
  margin-bottom: 0.15rem;
}

.goal-body {
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  color: #cfc;
}

/* Phase status (ralph.phase-status) */
.ev-phase {
  padding: 0.3rem 0;
  border-left: 3px solid #a84;
  padding-left: 0.6rem;
  margin: 0.15rem 0;
}

.phase-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #d0a64a;
  margin-bottom: 0.15rem;
}

.phase-label-pass { color: var(--ok); }

.phase-checks {
  display: grid;
  gap: 0.12rem;
  font-size: 0.78rem;
}

.phase-check {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}

.phase-check-name {
  color: #ddd;
  font-weight: 600;
  min-width: 5.5rem;
}

.phase-check-result { color: var(--bad); white-space: nowrap; }
.phase-check-pass .phase-check-result { color: var(--ok); }

.phase-check-command {
  color: #9d9;
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phase-check-preview {
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Gemini thought */
.ev-thought {
  padding: 0.3rem 0;
  border-left: 3px solid #649;
  padding-left: 0.6rem;
  margin: 0.15rem 0;
}

.thought-subject {
  display: block;
  font-size: 0.78rem;
  color: #a7b;
}

.thought-body {
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  color: #888;
}

/* System events */
.ev-sys {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.08rem 0;
  color: #555;
  font-size: 0.7rem;
}

.ev-sys-err { color: var(--bad); }
.sys-label { flex: 1; }

/* Shared */
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  font-size: 0.7rem;
  white-space: nowrap;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
}

.pill-ok { color: var(--ok); }
.pill-bad { color: var(--bad); }
.pill-running { color: #cc2; }

.cmd-lines { color: #555; font-size: 0.7rem; white-space: nowrap; }

.cmd-cell { color: #778; font-size: 0.7rem; white-space: nowrap; }

.ts { color: #555; font-size: 0.68rem; white-space: nowrap; flex-shrink: 0; }

.muted { color: var(--muted); }

pre { margin: 0; }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--muted);
}

.toggle-label input { width: 14px; height: 14px; }

@media (max-width: 800px) {
  .turn-feed {
    padding-left: 0.65rem;
    margin-left: 0.15rem;
  }

  .ev-cmd > .accordion-header,
  .ev-file > .accordion-header,
  .ev-todo > .accordion-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .cmd-inline,
  .file-title {
    flex: 1 1 100%;
    white-space: normal;
    word-break: break-word;
  }

  .cmd-output,
  .file-diff {
    margin-left: 0.4rem;
  }

  .phase-check {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .phase-check-command,
  .phase-check-preview {
    flex-basis: 100%;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
  }
}
