/* RuntimeLens SPA — dark theme consistent with the original placeholder palette
   (#0d1117 bg, #e6edf3 text, #30363d borders). Zero-build plain CSS. */

:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --bg: #0d1117;
  --panel: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-bg: #1f6feb;
  --chip: #21262d;
  --ok: #3fb950;
  --warn: #d29922;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

/* ── Header / topbar ─────────────────────────────────────────────── */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand-link {
  margin-top: 6px;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent, #58a6ff);
  text-decoration: none;
  padding: 3px 8px;
  border: 1px solid var(--accent, #58a6ff);
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.brand-link:hover,
.brand-link:focus-visible {
  background: var(--accent, #58a6ff);
  color: #0b0f14;
  outline: none;
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.tab {
  appearance: none;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
  background: var(--panel);
}

.tab[aria-selected='true'] {
  color: var(--text);
  background: var(--panel);
  border-color: var(--border);
}

.tab:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.btn {
  appearance: none;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-primary {
  background: var(--accent-bg);
  border-color: var(--accent-bg);
  color: #fff;
}

.stats {
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

/* ── Panels ──────────────────────────────────────────────────────── */

main {
  padding: 24px;
  flex: 1;
}

.panel[hidden] {
  display: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.placeholder {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 24px;
}

.note {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  margin: 0 0 16px;
}

/* ── Dashboard card grid ─────────────────────────────────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}

.health-dot.down {
  background: var(--warn);
}

.card-entry {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  color: var(--muted);
}

.chip b {
  color: var(--text);
  font-weight: 600;
}

.card-counters {
  display: flex;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.counter {
  display: flex;
  flex-direction: column;
}

.counter-value {
  font-size: 18px;
  font-weight: 700;
}

.counter-label {
  font-size: 11px;
  color: var(--muted);
}

.card-foot {
  margin-top: auto;
}

.card-foot .btn {
  width: 100%;
}

/* ── Toast ───────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-width: 360px;
  z-index: 10;
}

.toast[hidden] {
  display: none;
}

.toast.error {
  border-left-color: var(--warn);
}

/* ── Live Debugger ───────────────────────────────────────────────── */

.dbg-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.select {
  appearance: none;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
}

.select:focus-visible,
.dbg-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

.dbg-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 2fr) minmax(240px, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 960px) {
  .dbg-grid {
    grid-template-columns: 1fr;
  }
}

.dbg-col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
}

.dbg-col-head {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.dbg-col-head .muted {
  text-transform: none;
  letter-spacing: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* File tree */

.dbg-tree {
  max-height: 460px;
  overflow: auto;
  font-size: 13px;
}

.dbg-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 14px;
}

.dbg-tree > ul {
  padding-left: 0;
}

.dbg-tree details > summary {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  color: var(--text);
  user-select: none;
}

.dbg-tree details > summary:hover {
  background: var(--chip);
}

.dbg-file-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  text-align: left;
  width: 100%;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
}

.dbg-file-btn:hover {
  background: var(--chip);
}

.dbg-file-btn[aria-current='true'] {
  background: var(--accent-bg);
  color: #fff;
}

.dbg-file-btn:focus-visible,
.dbg-line-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Source viewer */

.dbg-source-view {
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.dbg-code {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
}

.dbg-code-row {
  display: flex;
  gap: 0;
}

.dbg-line-btn {
  appearance: none;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--muted);
  text-align: right;
  min-width: 48px;
  padding: 0 8px;
  font: inherit;
  cursor: pointer;
  user-select: none;
}

.dbg-line-btn:hover {
  background: var(--chip);
  color: var(--text);
}

.dbg-code-row.selected .dbg-line-btn {
  background: var(--accent-bg);
  color: #fff;
}

.dbg-code-text {
  white-space: pre;
  padding: 0 10px;
  flex: 1;
  min-width: 0;
}

/* Add-action form */

.dbg-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.field input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}

.field input[readonly] {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.form-error {
  margin: 0;
  font-size: 12px;
  color: #f85149;
}

.dbg-actions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dbg-actions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.dbg-action-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
}

.dbg-action-meta {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.dbg-action-type {
  font-weight: 700;
  color: var(--accent);
}

.dbg-del {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  flex: none;
}

.dbg-del:hover {
  border-color: #f85149;
  color: #f85149;
}

/* Event stream */

.dbg-events {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.dbg-events-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dbg-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
}

.dbg-event {
  display: flex;
  gap: 10px;
  align-items: baseline;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.dbg-event.type-log {
  border-left-color: var(--accent);
}

.dbg-event.type-snap {
  border-left-color: var(--ok);
}

.dbg-event.type-metric {
  border-left-color: var(--warn);
}

.dbg-event-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  flex: none;
}

.dbg-event-loc {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  flex: none;
}

.dbg-event-body {
  flex: 1;
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Triage panel (Task 7.3) ─────────────────────────────────────── */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.triage-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.4fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 960px) {
  .triage-grid {
    grid-template-columns: 1fr;
  }
}

.triage-chat,
.triage-real {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
}

.triage-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.triage-chat-head .muted {
  text-transform: none;
  letter-spacing: 0;
}

/* Chat log */

.chat-log {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.chat-empty {
  font-style: italic;
}

.chat-msg {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.chat-msg.user {
  background: var(--accent-bg);
  border-color: var(--accent-bg);
  color: #fff;
  align-self: flex-end;
  max-width: 85%;
}

.chat-msg.bot {
  background: var(--bg);
}

.chat-msg.bot.degraded {
  border-left: 3px solid var(--warn);
}

.chat-msg-role {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.chat-msg.user .chat-msg-role {
  color: rgba(255, 255, 255, 0.8);
}

.chat-answer p {
  margin: 0 0 8px;
}

.chat-answer ul {
  margin: 0 0 8px;
  padding-left: 18px;
}

.chat-answer code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--chip);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 12px;
}

.chat-citations {
  list-style: none;
  margin: 8px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-citation {
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-form .field {
  flex: 1;
  min-width: 0;
}

.chat-form input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.chat-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* RealTriage */

.governed-line {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ok);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  margin: 0 0 12px;
}

.governed-line.ungoverned {
  border-left-color: var(--warn);
}

.governed-steps {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.governed-step {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--muted);
}

.governed-step .decision-allow {
  color: var(--ok);
}

.governed-step .decision-deny,
.governed-step .decision-require_approval {
  color: var(--warn);
}

.ai-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.ai-card.fallback {
  border-left-color: var(--warn);
}

.ai-card-head {
  margin: 0 0 6px;
  font-size: 13px;
}

.ai-card-body {
  margin: 0;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.diagnoses {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diagnosis {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.diagnosis.sev-critical {
  border-left-color: #f85149;
}

.diagnosis.sev-high {
  border-left-color: var(--warn);
}

.diagnosis.sev-warning {
  border-left-color: var(--accent);
}

.diagnosis.sev-info {
  border-left-color: var(--ok);
}

.diagnosis-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  justify-content: space-between;
}

.diagnosis-summary {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.severity-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  color: var(--muted);
  flex: none;
}

.diagnosis-evidence {
  list-style: disc;
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted);
}

.diagnosis-evidence li {
  word-break: break-word;
}

.diagnosis-fix {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.diagnosis-fix-title {
  font-size: 12px;
}

/* Remediation card actions */

.triage-fix-actions,
.recovery-actions,
.deploy-fields {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.diff {
  margin: 0 0 12px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 0;
}

.diff-line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0 10px;
}

.diff-line.add {
  background: rgba(63, 185, 80, 0.15);
  color: #56d364;
}

.diff-line.del {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
}

.diff-line.context {
  color: var(--muted);
}

.dryrun-result,
.deploy-result,
.verify-result {
  margin: 0 0 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--bg);
  white-space: pre-wrap;
  word-break: break-word;
}

.dryrun-result.ok,
.deploy-result.ok,
.verify-result.ok {
  border-left: 3px solid var(--ok);
}

.dryrun-result.bad,
.deploy-result.bad,
.verify-result.bad {
  border-left: 3px solid var(--warn);
}

.deploy-form {
  margin-bottom: 4px;
}

.deploy-form input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}

.deploy-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.deploy-fields {
  margin-top: 8px;
}

.deploy-fields .field {
  flex: 1;
  min-width: 160px;
}

/* Recovery chart */

.recovery-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spark {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.spark-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 6px;
}

.spark-label {
  font-weight: 600;
}

.spark-last {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

.spark svg {
  display: block;
  width: 100%;
  height: 40px;
}

.spark .spark-line { fill: none; stroke-width: 1.5; }
.spark .spark-before { stroke: #f0883e; }            /* amber: pre-fix / elevated */
.spark .spark-after  { stroke: #3fb950; }            /* green: post-fix recovery */
.spark .spark-divider { stroke: rgba(240,136,62,.6); stroke-width: 1; stroke-dasharray: 3 3; }

/* ── Navigation UX: steppers, sub-tabs, chips (Live Debugger + Triage) ─ */

/* Larger primary action for the top-of-tab call-to-action. */
.btn-lg {
  padding: 10px 18px;
  font-size: 14px;
}

/* Brief, quiet highlight to draw the eye to a freshly-updated region. */
@keyframes rl-flash {
  0% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.55); }
  100% { box-shadow: 0 0 0 6px rgba(88, 166, 255, 0); }
}

.flash {
  animation: rl-flash 1s ease-out;
  border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .flash { animation: none; }
}

/* Step guide (stepper) — compact, horizontal, on-theme. */
.stepper {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
  margin: 0 0 14px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
}

.stepper .step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}

/* Separator chevron between steps. */
.stepper .step:not(:last-child)::after {
  content: '→';
  margin-left: 8px;
  color: var(--border);
}

.stepper .step-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

.stepper .step.complete {
  color: var(--text);
}

.stepper .step.complete .step-n {
  background: var(--ok);
  border-color: var(--ok);
  color: #04240f;
}

.stepper .step.current {
  background: var(--accent-bg);
  color: #fff;
}

.stepper .step.current .step-n {
  background: #fff;
  border-color: #fff;
  color: var(--accent-bg);
}

/* In-panel sub-tabs (segmented control) — Triage RealTriage ⇄ Triage Chat. */
.subtabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 16px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.subtab {
  appearance: none;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.subtab:hover {
  color: var(--text);
}

.subtab[aria-selected='true'] {
  color: #fff;
  background: var(--accent-bg);
  border-color: var(--accent-bg);
}

.subtab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.triage-subpanel[hidden] {
  display: none;
}

/* ── Redesigned guided RealTriage flow: vertical cards + status badges ── */

.triage-flow {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.triage-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}

.triage-card[hidden] {
  display: none;
}

.triage-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
}

.triage-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.triage-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Status badge (idle / in-progress / done / blocked). */
.status-badge {
  flex: none;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--bg);
}

.status-badge[data-status='in-progress'] {
  color: #fff;
  border-color: var(--accent-bg);
  background: var(--accent-bg);
}

.status-badge[data-status='done'] {
  color: var(--ok);
  border-color: var(--ok);
  background: rgba(63, 185, 80, 0.12);
}

.status-badge[data-status='blocked'] {
  color: #f85149;
  border-color: #f85149;
  background: rgba(248, 81, 73, 0.12);
}

/* The governed (🛡️) + AI (🧠) clean summary under Diagnose. */
.triage-summary {
  display: flex;
  flex-direction: column;
}

.triage-summary .governed-line,
.triage-summary .ai-card {
  margin: 0 0 10px;
}

.triage-summary .governed-line:last-child,
.triage-summary .ai-card:last-child {
  margin-bottom: 0;
}

/* Remediate card: target line + approval sub-section. */
.remediate-target {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
  word-break: break-word;
}

.approval-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.approval-head {
  margin: 0 0 10px;
  font-size: 13px;
}

/* Service quick-pick / scenario chips (Live Debugger + Triage). */
.dbg-quickpick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.svc-chip {
  appearance: none;
  background: var(--chip);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.svc-chip:hover {
  border-color: var(--accent);
}

.svc-chip[aria-current='true'] {
  background: var(--accent-bg);
  border-color: var(--accent-bg);
  color: #fff;
}

.svc-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Live Debugger empty state. */
.dbg-empty {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
}

.dbg-empty-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.dbg-empty .btn {
  margin-top: 12px;
}

/* Make the open file path prominent in the source viewer header. */
#dbg-source-path {
  color: var(--accent);
  font-weight: 600;
}

/* Triage top-of-tab controls (service picker + scenarios). */
.triage-controls {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin: 0 0 16px;
}

.triage-picker {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.triage-scenarios {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.triage-scenarios-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.triage-scenario-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.triage-scenario-status {
  margin: 8px 0 0;
}

.triage-scenario-status[hidden] {
  display: none;
}

/* Make the whole source row feel clickable (gutter already is). */
.dbg-code-row {
  cursor: pointer;
}

.dbg-code-row:hover .dbg-line-btn {
  background: var(--chip);
  color: var(--text);
}
