/* Symphony operations dashboard: one dark-navy theme. */

:root {
  color-scheme: dark;
  --page: #070d1a;
  --surface: #0d1729;
  --surface-2: #111e35;
  --surface-3: #0a1322;
  --code: #050a14;
  --ink: #e7eef9;
  --ink-2: #a8b6cd;
  --muted: #6d7d98;
  --line: #1c2a44;
  --line-strong: #2a3c5c;
  --ring: rgba(120, 170, 255, 0.08);
  --accent: #2fa8ff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(47, 168, 255, 0.13);
  --accent-ink: #8fd0ff;
  --good: #22c55e;
  --good-ink: #4ade80;
  --good-soft: rgba(34, 197, 94, 0.14);
  --warning: #f5b83d;
  --warning-ink: #fcd34d;
  --warning-soft: rgba(245, 184, 61, 0.14);
  --critical: #f05252;
  --critical-ink: #fca5a5;
  --critical-soft: rgba(240, 82, 82, 0.14);
  --violet: #9a8cff;
  --gold: #f5b83d;
  --series-1: #3b82f6;
  --series-2: #f97316;
  --series-3: #10d0a0;
  --series-4: #eab308;
  --series-5: #ec4899;
  --series-6: #22c55e;
  --series-7: #8b5cf6;
  --series-8: #ef4444;
  --radius: 12px;
  --glow: 0 0 0 1px rgba(47, 168, 255, 0.28), 0 0 28px rgba(47, 168, 255, 0.16);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

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

html {
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -200px, rgba(47, 168, 255, 0.07), transparent), var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}

a {
  color: var(--ink);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.app-shell {
  max-width: 1920px;
  margin: 0 auto;
  padding: 10px 12px 20px;
}

.dashboard-shell {
  display: grid;
  gap: 10px;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

.numeric {
  font-variant-numeric: tabular-nums;
}

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

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

/* Masthead: brand plus a strip of header stats. */

.masthead {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, #22d3ee, #2f7bff 55%, #7c5cff);
  box-shadow: 0 0 18px rgba(47, 168, 255, 0.45);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
  gap: 8px;
  min-width: 0;
}

.head-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.head-label {
  color: var(--ink-2);
  font-size: 11px;
}

.head-value {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.head-value.mono {
  font-size: 13px;
}

.head-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.head-warn .head-value {
  color: var(--critical-ink);
}

.head-live {
  align-items: flex-start;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
}

.status-badge-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: currentColor;
}

.status-badge-live {
  display: none;
  color: var(--good-ink);
}

.status-badge-live .status-badge-dot {
  box-shadow: 0 0 10px var(--good);
  animation: pulse 2.4s ease-in-out infinite;
}

.status-badge-offline {
  color: var(--muted);
}

[data-phx-main].phx-connected .status-badge-live {
  display: inline-flex;
}

[data-phx-main].phx-connected .status-badge-offline {
  display: none;
}

.alert-banner,
.error-card {
  padding: 10px 14px;
  border: 1px solid rgba(240, 82, 82, 0.4);
  border-radius: var(--radius);
  background: var(--critical-soft);
  color: var(--critical-ink);
}

.error-title {
  font-size: 15px;
  margin-bottom: 4px;
}

.error-copy {
  color: var(--critical-ink);
  font-size: 12px;
}

/* Three-column operations grid. */

.ops-grid {
  display: grid;
  grid-template-columns: minmax(300px, 22%) minmax(0, 1fr) minmax(250px, 17%);
  grid-template-areas: "left center right";
  gap: 10px;
  align-items: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.col-left {
  grid-area: left;
}

.col-center {
  grid-area: center;
}

.col-right {
  grid-area: right;
}

.panel {
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 650;
}

.count {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.panel-note {
  color: var(--muted);
  font-size: 11px;
}

.panel-copy {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 12px;
}

.empty-state {
  color: var(--muted);
  font-size: 12px;
}

/* Tables */

.table-wrap {
  overflow: auto;
  max-height: 330px;
}

.panel-activity .table-wrap {
  max-height: 420px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  position: sticky;
  top: 0;
  padding: 4px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 5px 6px;
  border-bottom: 1px solid rgba(28, 42, 68, 0.55);
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 0;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 0;
}

.cell-title {
  overflow: hidden;
  width: 100%;
  max-width: 0;
  color: var(--ink-2);
  text-overflow: ellipsis;
}

.cell-state {
  color: var(--ink-2);
}

.state-text {
  display: inline-block;
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--muted);
  vertical-align: 1px;
}

.dot-lg {
  width: 14px;
  height: 14px;
  margin: 3px 0 0;
}

.dot-good {
  background: var(--good);
  box-shadow: 0 0 7px rgba(34, 197, 94, 0.55);
}

.dot-warning {
  background: var(--warning);
}

.dot-critical {
  background: var(--critical);
  box-shadow: 0 0 7px rgba(240, 82, 82, 0.5);
}

.dot-info {
  background: var(--accent);
}

.dot-neutral {
  background: var(--muted);
}

.ring {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 2px solid var(--muted);
  border-radius: 999px;
  vertical-align: -1px;
}

.ring-open {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 32%, transparent 38%);
}

.tone-good {
  color: var(--good-ink);
}

.tone-warning {
  color: var(--warning-ink);
}

.tone-critical {
  color: var(--critical-ink);
}

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

/* KPI cards with 12-hour sparklines. */

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  --spark: var(--accent);
}

.kpi-green {
  --spark: var(--good);
}

.kpi-blue {
  --spark: #3b82f6;
}

.kpi-violet {
  --spark: var(--violet);
}

.kpi-red {
  --spark: var(--critical);
}

.kpi-cyan {
  --spark: var(--accent-2);
}

.kpi-gold {
  --spark: var(--gold);
}

.kpi-label {
  color: var(--ink-2);
  font-size: 12px;
}

.kpi-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.kpi-value {
  font-size: 23px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kpi-warn .kpi-value {
  color: var(--critical-ink);
}

.kpi-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sparkline {
  display: block;
  flex: 0 1 96px;
  min-width: 36px;
  height: 30px;
  overflow: visible;
}

.spark-line {
  fill: none;
  stroke: var(--spark, var(--accent));
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 3px var(--spark, var(--accent)));
}

.spark-area {
  fill: var(--spark, var(--accent));
  opacity: 0.12;
}

.spark-dot {
  fill: var(--spark, var(--accent));
  stroke: var(--surface);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

/* Active Agent Workspace */

.workspace {
  border-color: rgba(47, 168, 255, 0.55);
  box-shadow: var(--glow);
  background: linear-gradient(180deg, rgba(47, 168, 255, 0.05), transparent 120px), var(--surface);
}

.workspace-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.workspace-head h2 {
  font-size: 18px;
  font-weight: 700;
}

.workspace-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid rgba(245, 184, 61, 0.35);
  border-radius: 10px;
  background: rgba(245, 184, 61, 0.1);
  color: var(--gold);
  font-size: 20px;
}

.workspace-icon::before {
  content: "⚙";
}

.agent-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
}

.agent-tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
}

.agent-tab:hover {
  border-color: var(--line-strong);
}

.agent-tab.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(47, 168, 255, 0.35), 0 0 16px rgba(47, 168, 255, 0.18);
  color: var(--ink);
}

.tab-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}

.kind-dot-pr {
  background: var(--violet);
  box-shadow: 0 0 8px var(--violet);
}

.kind-dot-research {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.tab-id {
  color: var(--ink);
  font-weight: 700;
}

.tab-state {
  color: var(--good-ink);
  font-size: 11px;
}

.tab-time {
  color: var(--muted);
  font-size: 11px;
}

.agent-panel {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.agent-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.agent-main {
  min-width: 0;
}

.agent-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.agent-title {
  margin: 6px 0 4px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.agent-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12.5px;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.agent-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.label-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.label-chip {
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11px;
}

.agent-side {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
}

.chip-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-3);
  font-size: 12px;
}

.chip-stat dt {
  color: var(--muted);
}

.chip-stat dd {
  margin: 0;
  font-weight: 650;
}

.fact-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
}

.fact-list div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
}

.fact-list dt {
  color: var(--muted);
}

.fact-list dd {
  margin: 0;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.fact-list dd.mono {
  overflow: hidden;
  color: var(--ink);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fact-progress dd {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-track {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f7bff, var(--accent-2));
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.45);
}

.agent-body {
  display: grid;
  grid-template-columns: minmax(200px, 250px) minmax(0, 1fr);
  gap: 10px;
}

.agent-rail {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.rail-block {
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.rail-block h4 {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 650;
}

.agent-chat {
  min-width: 0;
}

.agent-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 12px;
}

.agent-latest {
  flex: 1 1 240px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.agent-spacer {
  flex: 0 0 0;
}


.agent-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agent-message {
  margin: 4px 0;
  overflow-wrap: anywhere;
}

.agent-events {
  display: grid;
  gap: 4px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

.agent-events li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
}

.agent-event-text {
  overflow: hidden;
  color: var(--ink-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.kind-chip {
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kind-pr {
  background: rgba(154, 140, 255, 0.15);
  color: #c4bbff;
}

.kind-research {
  background: var(--warning-soft);
  color: var(--warning-ink);
}

.state-badge,
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-tag::before,
.state-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--muted);
}

.state-badge-active::before,
.status-good::before {
  background: var(--good);
}

.state-badge-warning::before,
.status-warning::before {
  background: var(--warning);
}

.state-badge-danger::before,
.status-critical::before {
  background: var(--critical);
}

.subtle-button {
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.subtle-button:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.issue-id {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.issue-id-link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--line-strong);
}

.issue-link {
  color: var(--accent);
  font-size: 12px;
}

.workspace-path {
  padding: 0;
  overflow-wrap: anywhere;
}

/* Observed chat */

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
  max-height: 660px;
  margin: 0;
  padding: 12px;
  overflow-y: auto;
  list-style: none;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.chat-fallback {
  min-height: 0;
}

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

.chat-row {
  min-width: 0;
}

.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.msg-user {
  justify-content: flex-end;
}

.avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.avatar-agent {
  background: linear-gradient(135deg, var(--accent-2), #2f7bff);
  color: #04101f;
  box-shadow: 0 0 10px rgba(47, 168, 255, 0.4);
}

.avatar-user {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-2);
}

.bubble {
  min-width: 0;
  max-width: min(780px, 100%);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
}

.bubble-user {
  border-color: rgba(47, 168, 255, 0.28);
  border-radius: 12px 4px 12px 12px;
  background: rgba(47, 168, 255, 0.08);
}

.msg-final .bubble {
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.14);
}

.bubble-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.who {
  color: var(--ink);
  font-weight: 650;
}

.who-note {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.msg-final .who-note {
  background: var(--good-soft);
  color: var(--good-ink);
}

.stamp {
  margin-left: auto;
  padding-left: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
}

.prompt-text {
  max-height: 320px;
  margin: 6px 0 0;
  overflow: auto;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 12px;
  white-space: pre-wrap;
}

.rich {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.rich p {
  margin: 0 0 6px;
  white-space: pre-line;
}

.rich p:last-child,
.rich ul:last-child,
.rich pre:last-child {
  margin-bottom: 0;
}

.rich ul {
  margin: 0 0 6px;
  padding-left: 18px;
}

.rich-h {
  font-weight: 700;
}

.rich code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.13);
  font-family: var(--mono);
  font-size: 0.88em;
}

.rich a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.rich-code {
  margin: 0 0 6px;
  padding: 8px 10px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code);
  font-size: 12px;
}

.rich-code code {
  padding: 0;
  background: none;
}

.fold > summary,
.act > summary,
.edit-file > summary {
  list-style: none;
  cursor: pointer;
}

.fold > summary::-webkit-details-marker,
.act > summary::-webkit-details-marker,
.edit-file > summary::-webkit-details-marker {
  display: none;
}

.fold > summary {
  overflow: hidden;
  color: var(--ink-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.act,
.term,
.edit-card,
.notice {
  margin-left: 32px;
}

.act > summary,
.act-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink-2);
  font-size: 12px;
}

.act-icon {
  width: 16px;
  flex: none;
  color: var(--accent);
  text-align: center;
}

.act-title {
  flex: none;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.act-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.act-fold > summary {
  list-style: none;
  cursor: pointer;
}

.act-fold > summary::-webkit-details-marker {
  display: none;
}

.act-detail {
  max-height: 240px;
  margin: 6px 0 0 24px;
  padding: 6px 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.act-failed .act-icon,
.act-failed .act-title {
  color: var(--critical-ink);
}

.act-note {
  margin: 4px 0 0 24px;
  color: var(--muted);
  font-size: 11px;
}

.act-thinking .act-icon {
  color: var(--violet);
}

.act-live .act-title {
  color: var(--ink-2);
  font-style: italic;
  font-weight: 500;
}

.thinking-text {
  margin: 6px 0 0 24px;
  padding-left: 10px;
  border-left: 2px solid var(--line-strong);
}

.thinking-text .rich {
  color: var(--ink-2);
  font-size: 12px;
  font-style: italic;
}

.act-plan .plan {
  margin: 8px 0 0 24px;
}

.act-plan .plan-note {
  margin: 8px 0 0 24px;
}

.term {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--code);
}

.term-failed {
  border-color: rgba(240, 82, 82, 0.45);
}

.term-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}

.term-status {
  width: 16px;
  flex: none;
  text-align: center;
  font-weight: 700;
}

.status-ok {
  color: var(--good-ink);
}

.status-failed {
  color: var(--critical-ink);
}

.status-running {
  display: inline-block;
  color: var(--accent);
  animation: spin 1.2s linear infinite;
}

.term-command {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #d6e2f5;
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.term-prompt {
  color: var(--good-ink);
}

.term-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.term-script {
  margin: 0;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  color: #d6e2f5;
  font-family: var(--mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.term-meta {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.term-output,
.term-empty {
  margin: 0;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}

.term-output {
  max-height: 320px;
  overflow: auto;
  color: #c9d6ea;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.term-empty {
  color: var(--muted);
  font-size: 11px;
}

.term-clip {
  display: block;
  color: var(--muted);
  font-style: italic;
}

.edit-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.edit-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
}

.edit-head .act-icon {
  color: var(--warning);
}

.edit-file > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.edit-file > summary:hover {
  background: rgba(47, 168, 255, 0.05);
}

.diff {
  max-height: 360px;
  margin: 0;
  padding: 6px 0;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: var(--code);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
}

.diff > span {
  display: block;
  min-height: 1.45em;
  padding: 0 10px;
  white-space: pre;
}

.diff-line-add {
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
}

.diff-line-del {
  background: rgba(240, 82, 82, 0.12);
  color: #fecaca;
}

.diff-hunk {
  color: var(--accent-ink);
}

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

.diff-ctx {
  color: #b7c4da;
}

.diff-add {
  color: var(--good-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.diff-del {
  color: var(--critical-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.shots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 0 24px;
}

.shot {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--code);
}

.shot:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.shot img {
  display: block;
  max-width: 240px;
  max-height: 170px;
  object-fit: contain;
}

.shots-large .shot img {
  max-width: min(560px, 100%);
  max-height: 360px;
}

.shot-rail img {
  max-width: 100%;
  max-height: 200px;
}

.notice {
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
}

.notice .stamp {
  margin-left: 6px;
}

.notice-error {
  background: var(--critical-soft);
  color: var(--critical-ink);
}

/* Plan checklist (rail and plan updates) */

.plan-note {
  margin-bottom: 8px;
  color: var(--ink-2);
  font-size: 12px;
}

.plan {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-step {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--ink-2);
  font-size: 12px;
}

.plan-step:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: -8px;
  left: 7px;
  width: 2px;
  background: var(--line);
}

.plan-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
}

.plan-completed .plan-mark {
  border-color: var(--good);
  background: var(--good);
}

.plan-completed .plan-mark::after {
  content: "✓";
  color: #04210f;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.plan-in_progress .plan-mark {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 168, 255, 0.2), 0 0 10px rgba(47, 168, 255, 0.5);
}

.plan-in_progress .plan-mark::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.plan-completed .plan-text {
  color: var(--ink);
}

.plan-in_progress .plan-text {
  color: var(--ink);
  font-weight: 650;
}

/* Files changed */

.file-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  font-size: 11.5px;
}

.file-badge {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.file-mod {
  background: var(--warning-soft);
  color: var(--warning-ink);
}

.file-add {
  background: var(--good-soft);
  color: var(--good-ink);
}

.file-del {
  background: var(--critical-soft);
  color: var(--critical-ink);
}

.file-path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-family: var(--mono);
  white-space: nowrap;
  text-overflow: ellipsis;
}

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

.file-total {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

/* Right column: health, statistics, autopilot, attention */

.health-summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.health-title {
  font-size: 15px;
  font-weight: 700;
}

.health-operational .health-title {
  color: var(--good-ink);
}

.health-degraded .health-title {
  color: var(--warning-ink);
}

.health-down .health-title {
  color: var(--critical-ink);
}

.health-copy {
  color: var(--ink-2);
  font-size: 12px;
}

.health-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.health-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  column-gap: 6px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(28, 42, 68, 0.55);
  font-size: 12px;
}

.health-row:last-child {
  border-bottom: 0;
}

.health-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.health-state {
  font-weight: 600;
}

.health-detail {
  grid-column: 2 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stat-table {
  display: grid;
  gap: 6px;
  margin: 0;
}

.stat-table div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 40px;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
}

.stat-table dt {
  color: var(--ink-2);
}

.stat-table dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.stat-table dd.muted {
  font-size: 12px;
  font-weight: 500;
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stepper .step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--line-strong);
}

.step-name {
  font-weight: 600;
}

.step-state {
  color: var(--muted);
  font-size: 11px;
}

.step-running {
  border-color: var(--accent);
}

.step-running .step-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.step-done .step-dot {
  background: var(--good);
}

.step-pending .step-dot {
  background: var(--warning);
}

.attention-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attention-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(28, 42, 68, 0.55);
  font-size: 12px;
}

.attention-item:last-child {
  border-bottom: 0;
}

.attention-text {
  flex: 1 1 100%;
  overflow: hidden;
  color: var(--ink-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tagline {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 15px;
  font-style: italic;
}

.tagline p::before {
  content: "“";
  margin-right: 2px;
  color: var(--accent);
}

.tagline p::after {
  content: "”";
  color: var(--accent);
}

.tagline footer {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-align: right;
}

/* Charts */

.charts-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.chart {
  margin: 0;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 11px;
}

.chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-key {
  display: inline-block;
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--muted);
}

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

.chart-grid line {
  stroke: var(--line);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-baseline {
  stroke: var(--line-strong);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-axis text {
  fill: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.chart-hit {
  fill: transparent;
}

.chart-column:hover .chart-hit {
  fill: rgba(47, 168, 255, 0.06);
}

.chart-column:hover .chart-mark {
  opacity: 0.85;
}

.chart-table {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.chart-table summary {
  cursor: pointer;
}

.chart-table table {
  width: 100%;
  margin-top: 4px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.chart-table th,
.chart-table td {
  padding: 2px 4px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.chart-table th:first-child {
  text-align: left;
}

/* Series and status fills: marks carry color, text never does. */

.series-1 { fill: var(--series-1); background: var(--series-1); }
.series-2 { fill: var(--series-2); background: var(--series-2); }
.series-3 { fill: var(--series-3); background: var(--series-3); }
.series-4 { fill: var(--series-4); background: var(--series-4); }
.series-5 { fill: var(--series-5); background: var(--series-5); }
.series-6 { fill: var(--series-6); background: var(--series-6); }
.series-7 { fill: var(--series-7); background: var(--series-7); }
.series-8 { fill: var(--series-8); background: var(--series-8); }

.chart-mark.status-good,
.legend-key.status-good { fill: var(--good); background: var(--good); }
.chart-mark.status-warning,
.legend-key.status-warning { fill: var(--warning); background: var(--warning); }
.chart-mark.status-critical,
.legend-key.status-critical { fill: var(--critical); background: var(--critical); }

.hbar-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hbar-row {
  display: grid;
  grid-template-columns: minmax(70px, 32%) minmax(40px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.hbar-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hbar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
}

.hbar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
}

.hbar-value {
  color: var(--ink-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.meter {
  margin-top: 10px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.meter-value {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.meter-status {
  margin-left: 4px;
  color: var(--muted);
  font-weight: 500;
}

.meter-track {
  height: 8px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.meter-ok {
  background: var(--accent);
}

.meter-warning {
  background: var(--warning);
}

.meter-critical {
  background: var(--critical);
}

.meter-detail {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

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

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-running,
  .status-badge-live .status-badge-dot {
    animation: none;
  }
}

/* Responsive: centre first, then the side columns; one column on phones. */

@media (max-width: 1400px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1320px) {
  .ops-grid {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 34%);
    grid-template-areas:
      "center center"
      "left right";
  }
}

@media (max-width: 1100px) {
  .masthead {
    grid-template-columns: minmax(0, 1fr);
  }

  .charts-row,
  .agent-head {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .ops-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "center"
      "left"
      "right";
  }

  .agent-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-rail {
    order: 2;
  }

  .chat {
    max-height: 70vh;
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 8px 16px 16px;
  }

  .stat-strip,
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-value {
    font-size: 22px;
  }

  .act,
  .term,
  .edit-card,
  .notice {
    margin-left: 0;
  }

  .avatar {
    display: none;
  }

  .shots {
    margin-left: 0;
  }
}

@media (forced-colors: active) {
  .chart-mark,
  .legend-key,
  .hbar-fill,
  .meter-fill,
  .progress-fill {
    forced-color-adjust: none;
  }
}
