/* Maintenance Agent tab — only the pieces the Creative Agent styling doesn't
   already cover. Structural chrome (window, transcript, bubbles, tool chips,
   confirm cards) reuses .agent-* from agent.css; everything here is scoped
   under .maint-* and consumes the same brand tokens. */

.maint-empty-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink, #1a1a1a);
}

.maint-empty-sub {
  max-width: 46ch;
  margin-top: 8px;
  color: var(--ink-soft, #555);
  line-height: 1.5;
}

/* Commit message shown on the ship confirmation card. */
.maint-commit-msg {
  margin: 0 0 10px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-sunken, #f5f5f4);
  border: 1px solid var(--border, #ddd);
  border-radius: var(--radius-md, 8px);
}

/* Diffstat block on the ship confirmation card. */
.maint-diffstat {
  margin: 10px 0 0;
  padding: 10px 12px;
  max-height: 240px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre;
  background: var(--surface-sunken, #f5f5f4);
  border: 1px solid var(--border, #ddd);
  border-radius: var(--radius-md, 8px);
}

/* Test run result card. */
.maint-test-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border, #ddd);
  border-left-width: 4px;
  border-radius: var(--radius-md, 8px);
  background: var(--surface, #fff);
}

.maint-test-card.ok { border-left-color: var(--ok, #1a7f37); }
.maint-test-card.err { border-left-color: var(--danger, #b42318); }

.maint-test-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.maint-test-card.ok .maint-test-badge { color: var(--ok, #1a7f37); }
.maint-test-card.err .maint-test-badge { color: var(--danger, #b42318); }

.maint-test-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}

.maint-test-summary { color: var(--ink-soft, #555); font-size: 0.8rem; }

.maint-cache-delay {
  flex: 1 0 100%;
  color: var(--danger, #b42318);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.45;
}

/* ── Plain-English-first ship card ────────────────────────────────────── */
.maint-plain {
  margin: 0 0 10px;
  padding: 12px 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #ddd);
  border-left: 4px solid var(--accent, #f47b20);
  border-radius: var(--radius-md, 8px);
}

.maint-plain-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft, #555);
  margin-bottom: 4px;
}

.maint-plain-label + .maint-plain-label,
.maint-verify + .maint-plain-label,
.maint-plain-summary + .maint-plain-label { margin-top: 10px; }

.maint-plain-summary {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink, #1a1a1a);
}

.maint-verify {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.5;
  color: var(--ink, #1a1a1a);
}

.maint-verify li + li { margin-top: 2px; }

.maint-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
}

.maint-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border, #ddd);
  background: var(--surface-sunken, #f5f5f4);
  color: var(--ink, #1a1a1a);
}

.maint-chip.ok { border-color: var(--ok, #1a7f37); color: var(--ok, #1a7f37); }
.maint-chip.warn { border-color: #b26a00; color: #b26a00; }
.maint-chip.err { border-color: var(--danger, #b42318); color: var(--danger, #b42318); }

.maint-reasons {
  margin: 0 0 8px;
  padding-left: 1.25rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.maint-reasons.err { color: var(--danger, #b42318); }
.maint-reasons.warn { color: #b26a00; }

/* Technical detail folded away for the engineer. */
.maint-tech {
  margin-top: 8px;
  border: 1px solid var(--border, #ddd);
  border-radius: var(--radius-md, 8px);
  padding: 6px 10px;
  background: var(--surface-sunken, #f5f5f4);
}

.maint-tech > summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft, #555);
}

.maint-tech[open] > summary { margin-bottom: 8px; }

.maint-shipped-card .agent-confirm-title::before { content: '✓ '; color: var(--ok, #1a7f37); }

.maint-check-list {
  flex-basis: 100%;
  margin: 6px 0 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-soft, #555);
}

.maint-check-list li.err { color: var(--danger, #b42318); }
.maint-check-list li.skipped { color: #b26a00; }
.maint-test-card { flex-wrap: wrap; }

/* Elapsed-time label next to the thinking dots. */
.maint-wait { margin-left: 8px; font-size: 0.75rem; color: var(--ink-soft, #555); }

/* The shared agent chrome labels assistant bubbles "Creative Agent"; this tab is not that. */
.maint-root .agent-msg.agent-assistant::before { content: 'Maintenance Agent'; }

/* Failure notice rendered inside the turn. */
.maint-fail { border-left: 4px solid var(--danger, #b42318); color: var(--danger, #b42318); font-weight: 600; }

/* ── 2026-08-26 chat overhaul: polling transport, status row, stepper, cards ── */

/* A turn = its transcript entries + a live area (status row while running). */
.maint-turn { display: flex; width: 100%; flex-direction: column; gap: 22px; }
.maint-turn-entries:empty, .maint-turn-live:empty { display: none; }
.maint-turn-entries { display: flex; flex-direction: column; gap: 22px; }
.maint-live-msg { gap: 8px; }

/* Status row: spinner + bold phase text + elapsed. Replaces .agent-pending. */
.maint-status-wrap { display: flex; width: 100%; flex-direction: column; gap: 10px; }
.maint-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border, #ddd);
  border-left: 4px solid var(--accent, #f47b20);
  border-radius: var(--radius-md, 8px);
  background: var(--surface, #fff);
  font-size: 0.9rem;
}
.maint-status-label { font-weight: 700; color: var(--ink, #1a1a1a); }
.maint-status-time { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-soft, #555); font-size: 0.8rem; white-space: nowrap; }
.maint-spinner {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(232, 117, 17, 0.25);
  border-top-color: var(--accent, #f47b20);
  border-radius: 50%;
  animation: maint-spin 0.9s linear infinite;
}
@keyframes maint-spin { to { transform: rotate(360deg); } }

/* Stepper: Read request → Get code → Edit → Review → Checks → Approval → Deploying → Live */
.maint-stepper {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
  gap: 4px 0;
  counter-reset: step;
}
.maint-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 0;
  font-size: 0.72rem;
  color: var(--ink-soft, #555);
  white-space: nowrap;
}
.maint-step::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong, #bbb);
  background: var(--surface, #fff);
}
.maint-step + .maint-step::after {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--border-strong, #bbb);
}
.maint-step.done { color: var(--ok, #1a7f37); }
.maint-step.done::before { background: var(--ok, #1a7f37); border-color: var(--ok, #1a7f37); }
.maint-step.current { color: var(--ink, #1a1a1a); font-weight: 700; }
.maint-step.current::before { border-color: var(--accent, #f47b20); background: var(--accent, #f47b20); box-shadow: 0 0 0 3px rgba(232, 117, 17, 0.18); }
.maint-step.failed { color: var(--danger, #b42318); font-weight: 700; }
.maint-step.failed::before { border-color: var(--danger, #b42318); background: var(--danger, #b42318); }

/* Thinking behind a disclosure. */
.maint-thinking { width: 100%; max-width: 72ch; }
.maint-thinking > summary { cursor: pointer; font-size: 0.75rem; color: var(--ink-soft, #555); }
.maint-thinking .agent-thinking { max-height: 180px; overflow: auto; margin-top: 6px; }

/* Example requests in the empty state. */
.maint-examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.maint-example {
  padding: 8px 12px;
  border: 1px solid var(--border-strong, #bbb);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--ink, #1a1a1a);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
}
.maint-example:hover { border-color: var(--accent, #f47b20); }

/* Operator inbox strip. */
.maint-inbox {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border, #ddd);
  background: rgba(232, 117, 17, 0.06);
}
.maint-inbox-title { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text, #b25a0f); }
.maint-inbox-item {
  display: grid;
  grid-template-columns: minmax(0, 160px) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}
.maint-inbox-who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.maint-inbox-what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink, #1a1a1a); }
.maint-inbox-age { color: var(--ink-soft, #555); font-size: 0.75rem; white-space: nowrap; }

/* Cards: the primary button is big; plain English leads. */
.maint-primary { min-height: 40px; padding: 0 18px; font-size: 0.95rem; }
.agent-confirm-card:focus-visible { outline: 2px solid var(--accent, #f47b20); outline-offset: 2px; }
.maint-waiting { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 0.85rem; color: var(--ink-soft, #555); }
.maint-declined-card { border-left-color: var(--danger, #b42318); margin-top: 10px; }
.maint-declined-card .maint-plain-summary { margin-bottom: 10px; }
.maint-mailto { display: inline-block; text-decoration: none; }

/* Ship-watch / "It's live" card. */
.maint-watch-card .maint-status { margin-bottom: 8px; }
.maint-live-card { border-left-color: var(--ok, #1a7f37); }
.maint-live-card .agent-confirm-title::before { content: '✓ '; color: var(--ok, #1a7f37); }
.maint-checklist { margin: 4px 0 10px; padding: 0; list-style: none; }
.maint-checklist li + li { margin-top: 4px; }
.maint-checklist label { display: flex; align-items: flex-start; gap: 8px; line-height: 1.45; cursor: pointer; }
.maint-checklist input { margin-top: 3px; }
.maint-job-list { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.75rem; color: var(--ink-soft, #555); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.maint-job-list .job-success { color: var(--ok, #1a7f37); }
.maint-job-list .job-running { color: var(--accent-text, #b25a0f); }
.maint-job-list .job-failed, .maint-job-list .job-error, .maint-job-list .job-canceled { color: var(--danger, #b42318); }
.maint-events { margin: 0; padding-left: 1.1rem; font-size: 0.75rem; line-height: 1.5; color: var(--ink-soft, #555); }

/* Readability: cap width, less dead space above the first turn. */
.maint-root .agent-transcript { padding-top: 22px; }
.maint-root .agent-transcript > * { width: min(760px, 100%); margin-left: auto; margin-right: auto; }
.maint-root .agent-empty { margin: auto; }

@media (max-width: 640px) {
  .maint-inbox { padding: 8px 12px; }
  .maint-inbox-item { grid-template-columns: 1fr auto; }
  .maint-inbox-what { grid-column: 1 / -1; white-space: normal; }
  .maint-status { flex-wrap: wrap; }
  .maint-status-time { margin-left: 24px; }
  .maint-step { font-size: 0.68rem; padding-right: 8px; }
  .agent-confirm-actions .maint-primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .maint-spinner { animation: none; border-top-color: rgba(232, 117, 17, 0.25); }
}

/* Strategist plan + reviewer repair cards (second-vendor guardrails, 2026-08-26). */
.maint-plan-card.ask { border-color: #b26a00; }
.maint-plan-card.decline { border-color: var(--danger, #b42318); }
.maint-review-card { border-color: #b26a00; }
.maint-plan-steps { margin: 6px 0 0 18px; padding: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; line-height: 1.45; word-break: break-word; }
.maint-plan-steps li { margin: 2px 0; }
