:root {
  --bg: #ffffff;
  --fg: #0b0f14;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #e5e7eb;
  --badge: #f3f4f6;
  --btn: #f3f4f6;
  --btn-fg: #111827;
  --primary: #111827;
  --primary-fg: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --link: #2563eb;
  --soft: #f9fafb;
  --accent: #06b6d4;
  --accent-hover: #0891b2;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --card-hover: rgba(0, 0, 0, 0.02);
}

body[data-theme="dark"] {
  --bg: #101C26;
  --fg: #e2e8f0;
  --muted: #A8B5BF;
  --card: #192A40;
  --border: rgba(30, 56, 89, 0.50);
  --badge: #1E3859;
  --btn: rgba(25, 42, 64, 0.8);
  --btn-fg: #e2e8f0;
  --primary: #e2e8f0;
  --primary-fg: #101C26;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  --link: #60a5fa;
  --soft: #0F1B26;
  --accent: #06b6d4;
  --accent-hover: #22d3ee;
  --success: #10b981;
  --warning: #BF964B;
  --danger: #ef4444;
  --card-hover: rgba(6, 182, 212, 0.03);
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font: 14px/1.4 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Entrance Animation ──────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

a:hover {
  text-decoration: underline
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap
}

.brand-title {
  font-weight: 700
}


/* ── Streamlined Top Bar ─────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 16px; }
.brand-title { font-weight: 700; font-size: 15px; white-space: nowrap; letter-spacing: -0.3px; }
.brand-sep { opacity: 0.4; font-weight: 400; }

.status-dots { display: flex; align-items: center; gap: 6px; }
.status-dot {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; color: var(--muted);
  background: transparent; border: 1px solid transparent;
  cursor: default; transition: background 0.15s;
}
.status-dot:hover { background: var(--hover); }
button.status-dot { cursor: pointer; }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.dot-label { font-size: 11px; opacity: 0.7; }
.dot-ok { background: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.4); }
.dot-online { background: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.4); }
.dot-active { background: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.4); }
.dot-checking { background: #94a3b8; }
.dot-offline { background: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,0.3); }
.dot-error { background: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,0.3); }
.dot-deploying { background: #3b82f6; animation: dot-pulse 1.5s ease-in-out infinite; }
@keyframes dot-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--badge);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.badge-live {
  color: var(--fg)
}

.badge-llm {
  cursor: pointer;
  font-weight: 600;
  transition: opacity .15s ease;
}

.badge-llm:hover {
  opacity: .9
}

.badge-llm-checking {
  background: #e5e7eb;
  color: #111827;
  border-color: #d1d5db;
}

.badge-llm-online {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.badge-llm-advisor {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #a5b4fc;
}

.badge-llm-configured {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.badge-llm-offline {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.badge-observing {
  font-weight: 600;
  transition: opacity .15s ease;
}

.badge-observing-offline {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.badge-observing-active {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.badge-observing-error {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

/* ---- Deploy status badge ---- */
.badge-deploy {
  cursor: pointer;
  font-weight: 600;
  transition: all .2s ease;
}

.badge-deploy:hover {
  opacity: .88;
}

.badge-deploy-checking {
  background: #e5e7eb;
  color: #111827;
  border-color: #d1d5db;
}

.badge-deploy-current {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.badge-deploy-available {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
  animation: deploy-pulse 2s ease-in-out infinite;
}

.badge-deploy-deploying {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
  animation: deploy-spin-glow 1.5s ease-in-out infinite;
}

.badge-deploy-error {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

@keyframes deploy-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .7;
  }
}

@keyframes deploy-spin-glow {

  0%,
  100% {
    box-shadow: 0 0 4px rgba(59, 130, 246, .3);
  }

  50% {
    box-shadow: 0 0 12px rgba(59, 130, 246, .6);
  }
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end
}

.search {
  width: min(560px, 68vw);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--soft);
  color: var(--fg);
}

.btn {
  border: 1px solid var(--border);
  background: var(--btn);
  color: var(--btn-fg);
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 12px;
}

.btn:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: transparent;
}

.tabs {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--badge);
  font-size: 12px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.tab:hover:not(.active) {
  background: var(--hover);
  border-color: var(--fg);
}

.tab.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: transparent;
}

.tab .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
}

.tab.active .count {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--primary-fg);
}

.content {
  padding: 18px 16px 90px
}



.hrow {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.hrow h1 {
  margin: 0;
  font-size: 22px
}

.hrow .hint {
  color: var(--muted);
  font-size: 12px
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.01em;
}
.pill-editable { cursor: pointer; }
.pill-editable:hover { background: var(--hover); border-color: var(--fg); }
.pill-sep { color: var(--muted); opacity: 0.3; font-size: 10px; margin: 0 2px; user-select: none; }

.overview-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.overview-bar {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--soft);
  padding: 10px 12px;
}

.overview-bar-key {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.overview-bar-val {
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--fg);
}

.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 12px;
}

.kv b {
  color: var(--fg);
  font-weight: 600
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border)
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card)
}

thead th {
  position: sticky;
  top: 0;
  background: var(--card);
  border-bottom: 2px solid var(--accent);
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tbody td {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 12px;
  vertical-align: top;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(6, 182, 212, 0.03);
}

body[data-theme="dark"] tbody tr:hover {
  background: rgba(6, 182, 212, 0.06);
}

body[data-theme="dark"] tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

body[data-theme="dark"] tbody tr:nth-child(even):hover {
  background: rgba(6, 182, 212, 0.06);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace
}

.right {
  text-align: right
}

.nowrap {
  white-space: nowrap
}

.trunc {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.pager {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.select {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--soft);
  color: var(--fg);
  padding: 8px 10px;
}

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

.loading {
  color: var(--muted);
  padding: 20px
}

.control-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.control-row-tight {
  margin-top: 0;
  margin-bottom: 8px;
}

.control-row-end {
  justify-content: flex-end;
  margin-top: 8px;
}

.control-row-wide-gap {
  gap: 10px;
}

.control-label-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search.control-w-120 {
  width: 120px;
  max-width: 100%;
}

.search.control-w-130 {
  width: 130px;
  max-width: 100%;
}

.search.control-w-140 {
  width: 140px;
  max-width: 100%;
}

.search.control-w-150 {
  width: 150px;
  max-width: 100%;
}

.search.control-w-170 {
  width: 170px;
  max-width: 100%;
}

.search.control-w-180 {
  width: 180px;
  max-width: 100%;
}

.search.control-w-220 {
  width: 220px;
  max-width: 100%;
}

.search.control-min-220 {
  min-width: 220px;
}

.search.control-min-250 {
  min-width: 250px;
}

.search.control-min-260 {
  min-width: 260px;
}

.search.control-min-540 {
  min-width: 540px;
}

.control-textarea-md {
  min-height: 84px;
}

.panel-half-card {
  grid-column: span 6;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.floating-chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--badge);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 18px;
}

.modal {
  display: none
}

.modal.open {
  display: block
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.modal-card {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  width: min(820px, calc(100vw - 24px));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-weight: 700
}

.modal-body {
  padding: 14px;
  color: var(--muted)
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 12px;
  margin-bottom: 10px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.form-grid-2col {
  grid-template-columns: 1fr 1fr;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

@keyframes confirmSlideIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ── QC Action Overlay (Update Branch / Merge progress) ───────────── */
.qc-action-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  animation: overlayFadeIn 0.15s ease-out;
}

.qc-action-overlay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 32px 20px;
  width: min(420px, calc(100vw - 40px));
  text-align: center;
  animation: confirmSlideIn 0.15s ease-out;
}

.qc-action-overlay-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 16px;
}

.qc-action-overlay-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 12px;
}

.qc-action-overlay-bar-fill {
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent, #3b82f6), #60a5fa);
  animation: overlayBarSlide 1.2s ease-in-out infinite;
}

.qc-action-overlay-status {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  min-height: 18px;
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes overlayBarSlide {
  0% {
    transform: translateX(-100%);
  }

  50% {
    transform: translateX(150%);
  }

  100% {
    transform: translateX(350%);
  }
}

.user-menu {
  position: relative;
}

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 44px;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 10px;
  z-index: 40;
}

.user-menu.open .user-dropdown {
  display: block;
}

.user-dropdown .note {
  margin: 0 0 8px 0;
}

.user-entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.user-name {
  font-weight: 700;
  color: var(--fg);
}

.user-role {
  font-size: 0.8rem;
  color: var(--muted);
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}


/* Clickable table rows (Projects Overview) */
.table-wrap tbody tr.clickable:hover {
  background: var(--soft);
  cursor: pointer;
}

.table-wrap tbody tr.clickable td.mono {
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.btn {
  text-decoration: none;
}


/* --- ORCHDOCK 2.0 STYLES --- */
.floating-trigger {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 2000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
  display: grid;
  place-items: center;
}

.floating-trigger:hover {
  transform: scale(1.1);
}

.floating-trigger.dock-toggle-online {
  background: #166534;
}

.floating-trigger.dock-toggle-advisor {
  background: #3730a3;
}

.floating-trigger.dock-toggle-configured {
  background: #b45309;
}

.floating-trigger.dock-toggle-offline {
  background: #b91c1c;
}

.floating-trigger-icon {
  font-size: 24px;
  line-height: 1;
}

.floating-trigger-label {
  position: absolute;
  right: 62px;
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.floating-trigger.dock-toggle-online .floating-trigger-label {
  background: #14532d;
  color: #dcfce7;
  border-color: rgba(134, 239, 172, 0.5);
}

.floating-trigger.dock-toggle-advisor .floating-trigger-label {
  background: #312e81;
  color: #e0e7ff;
  border-color: rgba(165, 180, 252, 0.5);
}

.floating-trigger.dock-toggle-configured .floating-trigger-label {
  background: #78350f;
  color: #fef3c7;
  border-color: rgba(252, 211, 77, 0.5);
}

.floating-trigger.dock-toggle-offline .floating-trigger-label {
  background: #7f1d1d;
  color: #fee2e2;
  border-color: rgba(252, 165, 165, 0.5);
}

@media (max-width: 900px) {
  .floating-trigger-label {
    display: block;
    right: 68px;
    font-size: 10px;
    padding: 3px 8px;
    max-width: 160px;
  }
}

.orch-dock {
  position: fixed;
  right: 20px;
  bottom: 85px;
  width: 400px;
  height: var(--dock-height, 600px);
  max-height: calc(100vh - 100px);
  min-height: 300px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 2001;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.orch-dock.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ── Dock Resize Handle ───────────────────────────── */
.dock-resize-handle {
  height: 8px;
  cursor: ns-resize;
  background: transparent;
  border-radius: 12px 12px 0 0;
  position: relative;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}

.dock-resize-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 3px;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: #d1d5db;
  transition: background 0.15s;
}

.dock-resize-handle:hover::after,
.dock-resize-handle:active::after {
  background: #6b7280;
}

.orch-dock.dock-resizing {
  transition: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Research Progress Banner ─────────────────────── */
.dock-research-progress {
  display: none;
  /* shown by JS when research is active */
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #1e40af;
  background: linear-gradient(90deg, #eff6ff 0%, #dbeafe 50%, #eff6ff 100%);
  background-size: 200% 100%;
  animation: researchShimmer 2s ease-in-out infinite;
  border-bottom: 1px solid #bfdbfe;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}

.dock-research-progress .rp-icon {
  font-size: 14px;
  animation: researchSpin 1.5s linear infinite;
}

.dock-research-progress .rp-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes researchShimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@keyframes researchSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.dock-header {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f9fafb;
  border-radius: 12px 12px 0 0;
}

.dh-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dh-title {
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dh-controls {
  display: flex;
  gap: 8px;
}

.dock-llm-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  width: max-content;
  border: 1px solid transparent;
}

.dock-llm-checking {
  background: #e5e7eb;
  color: #111827;
}

.dock-llm-online {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.dock-llm-advisor {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #a5b4fc;
}

.dock-llm-configured {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.dock-llm-offline {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.icon-btn:hover {
  opacity: 1;
}

.dock-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.dock-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 0.9rem;
  color: #6b7280;
}

.dock-tab.active {
  border-bottom-color: #2563eb;
  color: #111827;
  font-weight: 600;
}

.dock-body {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

.dock-body.active {
  display: flex;
}

.dock-body .chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.dock-presence {
  padding: 6px 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

/* ── Signal Card ── */
.signal-card {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-left: 3px solid #94a3b8;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, box-shadow 0.15s;
}

.signal-card:hover {
  background: #f1f5f9;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.signal-card:active {
  background: #e2e8f0;
}

/* Accent left-border colors */
.signal-accent-emerald {
  border-left-color: #10b981;
}

.signal-accent-amber {
  border-left-color: #f59e0b;
}

.signal-accent-red {
  border-left-color: #ef4444;
}

.signal-accent-blue {
  border-left-color: #3b82f6;
}

.signal-accent-sky {
  border-left-color: #0ea5e9;
}

.signal-accent-slate {
  border-left-color: #94a3b8;
}

.signal-accent-violet {
  border-left-color: #8b5cf6;
  background: linear-gradient(90deg, #f5f3ff 0%, #faf5ff 100%);
}

.signal-card-icon {
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.signal-card-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.signal-card-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signal-card-sub {
  font-size: 0.68rem;
  color: #64748b;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signal-card-arrow {
  font-size: 1rem;
  color: #94a3b8;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.signal-card:hover .signal-card-arrow {
  transform: translateX(2px);
}

/* ── Dot Indicator Strip ── */
.signal-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 5px 0 2px;
}

.signal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cbd5e1;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.signal-dot:hover {
  transform: scale(1.4);
}

/* Active dot inherits accent color */
.signal-dot-active {
  transform: scale(1.3);
}

.signal-dot-active[data-accent="emerald"] {
  background: #10b981;
}

.signal-dot-active[data-accent="amber"] {
  background: #f59e0b;
}

.signal-dot-active[data-accent="red"] {
  background: #ef4444;
}

.signal-dot-active[data-accent="blue"] {
  background: #3b82f6;
}

.signal-dot-active[data-accent="sky"] {
  background: #0ea5e9;
}

.signal-dot-active[data-accent="slate"] {
  background: #94a3b8;
}

/* Remove old presence sub-selectors no longer used */

.dock-route-card {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 10px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.dock-route-drawer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  align-items: center;
  max-height: 168px;
  overflow-y: auto;
  padding-right: 2px;
}

.dock-route-card .route-k {
  font-size: 0.72rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dock-route-card .route-v {
  font-size: 0.82rem;
  color: #111827;
  font-weight: 600;
}

.dock-route-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dock-route-online {
  background: #ecfdf5;
  border-left: 3px solid #10b981;
}

.dock-route-advisor {
  background: #eef2ff;
  border-left: 3px solid #6366f1;
}

.dock-route-configured {
  background: #f8fafc;
  border-left: 3px solid #94a3b8;
}

.dock-route-offline {
  background: #fef2f2;
  border-left: 3px solid #ef4444;
}

.dock-route-checking {
  background: #f8fafc;
  border-left: 3px solid #94a3b8;
}

.dock-route-card-hidden {
  padding: 6px 10px;
}

.icon-btn.is-busy {
  opacity: 1;
  color: #1d4ed8;
}



.msg-actions {
  display: flex;
  gap: 5px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.msg-menu {
  align-self: flex-end;
  position: relative;
  margin-top: 4px;
}

.msg-menu summary {
  list-style: none;
}

.msg-menu summary::-webkit-details-marker {
  display: none;
}

.msg-menu-btn {
  border: 1px solid var(--border);
  background: var(--btn);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.msg-menu[open] .msg-menu-btn {
  color: var(--fg);
}

.msg-menu-list {
  position: absolute;
  right: 0;
  top: 24px;
  z-index: 5;
  min-width: 160px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-menu-list button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg);
  text-align: left;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.msg-menu-list button:hover {
  border-color: var(--border);
  background: var(--soft);
}

.btn-xs {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  color: #4b5563;
}

.btn-xs:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.dock-footer {
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 10px;
  background: #f9fafb;
  border-radius: 0 0 12px 12px;
}

#dockInput {
  flex: 1;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  resize: none;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

#dockInput:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background 0.2s;
}

.btn-send:hover {
  background: #1d4ed8;
}

.dock-context-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.dock-context-summary {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dock-context-stat {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.dock-context-key {
  color: #6b7280;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dock-context-val {
  color: #111827;
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 3px;
}

.dock-context-label {
  padding: 8px 12px 0 12px;
  color: #64748b;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.context-editor {
  flex: 1;
  padding: 15px;
  border: none;
  resize: none;
  font-family: monospace;
  font-size: 0.85rem;
  color: #374151;
  outline: none;
}

.dock-context-tools {
  padding: 8px 10px;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f8fafc;
}

.dock-context-assets {
  min-height: 110px;
  max-height: 180px;
  overflow: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
}

.dock-asset-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.dock-asset-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #111827;
}

.dock-asset-meta {
  font-size: 0.72rem;
  color: #6b7280;
  margin-top: 2px;
}

.dock-asset-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dock-asset-preview {
  margin-top: 8px;
  max-height: 120px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
  padding: 6px;
}

.dock-asset-preview img {
  max-width: 100%;
  max-height: 106px;
  border-radius: 4px;
}

.dock-asset-preview video {
  max-width: 100%;
  max-height: 106px;
  border-radius: 4px;
}

.dock-asset-preview audio {
  width: 100%;
}

/* ── Research Documents ── */
.dock-research-section {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.dock-research-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dock-research-header h4 {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.research-doc-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}

.research-doc-card:hover {
  border-color: #93c5fd;
}

.research-doc-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.research-doc-meta {
  font-size: 0.72rem;
  color: #6b7280;
  margin-bottom: 4px;
}

.research-doc-source {
  color: #2563eb;
  text-decoration: none;
}

.research-doc-source:hover {
  text-decoration: underline;
}

.research-doc-time,
.research-doc-size {
  color: #94a3b8;
}

.research-doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.research-tag {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #a5b4fc;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

.research-doc-summary {
  font-size: 0.82rem;
  color: #374151;
  line-height: 1.4;
  margin-bottom: 6px;
}

.research-doc-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-danger-sm {
  color: #b91c1c;
  border-color: #fca5a5;
}

.btn-danger-sm:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

/* Research Reader */
.research-reader {
  padding: 2px 0;
}

.research-reader-back {
  margin-bottom: 8px;
}

.research-reader-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px 0;
}

.research-reader-meta {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 10px;
}

.research-reader-meta a {
  color: #2563eb;
  text-decoration: none;
  word-break: break-all;
}

.research-reader-meta a:hover {
  text-decoration: underline;
}

.research-reader-content {
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.55;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

/* dock context details toggle */
.dock-context-wrap details summary {
  cursor: pointer;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  padding: 6px 10px;
  -webkit-user-select: none;
  user-select: none;
}

.dock-context-wrap details summary:hover {
  color: #334155;
}

/* ── Observer Sub-Tabs ── */
.dock-observer-subtabs {
  display: flex;
  gap: 0;
  padding: 6px 10px 0;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.dock-observer-subtab {
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #6b7280;
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.dock-observer-subtab:hover {
  color: #374151;
}

.dock-observer-subtab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.dock-observer-subtab .obs-tab-count {
  display: inline-block;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 5px;
  margin-left: 4px;
  min-width: 16px;
  text-align: center;
  line-height: 16px;
}

.dock-observer-subtab.active .obs-tab-count {
  background: #dbeafe;
  color: #2563eb;
}

.dock-observer-panels {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Scope panel (re-uses old observer-head layout) */
.dock-observer-scope-panel {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dock-observer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

/* Ignored list */
.dock-observer-ignored-list {
  flex: 1;
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dock-observer-ignored-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  font-size: 0.82rem;
  color: #374151;
}

.dock-observer-ignored-key {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: monospace;
  font-size: 0.75rem;
  color: #6b7280;
}

body[data-theme="dark"] .dock-observer-subtabs {
  background: var(--soft);
  border-bottom-color: var(--border);
}

body[data-theme="dark"] .dock-observer-subtab {
  color: var(--muted);
}

body[data-theme="dark"] .dock-observer-subtab:hover {
  color: var(--fg);
}

body[data-theme="dark"] .dock-observer-subtab.active {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
}

body[data-theme="dark"] .dock-observer-subtab .obs-tab-count {
  background: #374151;
  color: #d1d5db;
}

body[data-theme="dark"] .dock-observer-subtab.active .obs-tab-count {
  background: #1e3a5f;
  color: #60a5fa;
}

body[data-theme="dark"] .dock-observer-ignored-item {
  border-color: var(--border);
  background: var(--card);
  color: var(--fg);
}

body[data-theme="dark"] .dock-observer-ignored-key {
  color: var(--muted);
}

/* Signal Card dark mode */
body[data-theme="dark"] .dock-presence {
  background: var(--bg);
  border-bottom-color: var(--border);
}

body[data-theme="dark"] .signal-card {
  background: var(--card);
}

body[data-theme="dark"] .signal-card:hover {
  background: var(--hover);
}

body[data-theme="dark"] .signal-card-title {
  color: var(--fg);
}

body[data-theme="dark"] .signal-card-sub {
  color: var(--muted);
}

body[data-theme="dark"] .signal-card-arrow {
  color: var(--muted);
}

body[data-theme="dark"] .signal-dot {
  background: #475569;
}

/* ── Dock Panel dark mode ── */
body[data-theme="dark"] .orch-dock {
  background: transparent;
  border-color: #313244;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

body[data-theme="dark"] .dock-header {
  background: #181825;
  border-bottom-color: #313244;
}

body[data-theme="dark"] .dh-title {
  color: #cdd6f4;
}

body[data-theme="dark"] .dock-tabs {
  background: transparent;
  border-bottom-color: #313244;
}

body[data-theme="dark"] .dock-tab {
  color: #a6adc8;
}

body[data-theme="dark"] .dock-tab.active {
  color: #cdd6f4;
  border-bottom-color: #89b4fa;
}

body[data-theme="dark"] .dock-body {
  background: transparent;
}

body[data-theme="dark"] .dock-footer {
  background: #181825;
  border-top-color: #313244;
}

body[data-theme="dark"] #dockInput {
  background: #313244;
  border-color: #45475a;
  color: #cdd6f4;
}

body[data-theme="dark"] #dockInput:focus {
  border-color: #89b4fa;
  box-shadow: 0 0 0 2px rgba(137, 180, 250, 0.15);
}

body[data-theme="dark"] #dockInput::placeholder {
  color: #6c7086;
}

body[data-theme="dark"] .btn-send {
  background: #89b4fa;
  color: #1e1e2e;
}

body[data-theme="dark"] .btn-send:hover {
  background: #74c7ec;
}

body[data-theme="dark"] .dock-route-card {
  border-bottom-color: #313244;
  background: #181825;
}

body[data-theme="dark"] .dock-route-card .route-k {
  color: #a6adc8;
}

body[data-theme="dark"] .dock-route-card .route-v {
  color: #cdd6f4;
}

body[data-theme="dark"] .dock-context-wrap {
  color: #cdd6f4;
}

body[data-theme="dark"] .dock-context-summary {
  color: #a6adc8;
}

body[data-theme="dark"] .dock-context-label {
  color: #a6adc8;
}

body[data-theme="dark"] .context-editor {
  background: #313244;
  border-color: #45475a;
  color: #cdd6f4;
}

body[data-theme="dark"] .dock-research-head {
  color: #cdd6f4;
}

body[data-theme="dark"] .dock-asset-card {
  background: #313244;
  border-color: #45475a;
}

body[data-theme="dark"] .dock-asset-title {
  color: #cdd6f4;
}

body[data-theme="dark"] .dock-asset-meta {
  color: #6c7086;
}

body[data-theme="dark"] .icon-btn {
  color: #a6adc8;
}

body[data-theme="dark"] .dock-llm-checking {
  background: #313244;
  color: #a6adc8;
}

.dock-observer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dock-observer-list {
  flex: 1;
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dock-observer-card {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f9fafb;
  border-left: 4px solid #9ca3af;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dock-observer-card:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.dock-observer-card.is-focused {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Severity-specific card accents */
.dock-observer-card.sev-high {
  border-left-color: #dc2626;
  background: #fef2f2;
}

.dock-observer-card.sev-medium {
  border-left-color: #d97706;
  background: #fffbeb;
}

.dock-observer-card.sev-low {
  border-left-color: #16a34a;
  background: #f0fdf4;
}

.dock-observer-card.sev-info {
  border-left-color: #9ca3af;
  background: #f9fafb;
}

.dock-observer-meta {
  font-size: 0.72rem;
  color: #6b7280;
  margin-bottom: 5px;
}

.dock-observer-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 5px;
}

.dock-observer-body {
  font-size: 0.82rem;
  color: #374151;
  white-space: pre-wrap;
}

.dock-observer-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.observer-sev {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 2px 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.observer-high {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.observer-medium {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.observer-low {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.observer-info {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #d1d5db;
}

/* Scan Now button in subtab bar */
.obs-scan-now-btn {
  margin-left: auto;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.obs-scan-now-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.obs-scan-now-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.obs-scan-now-btn.scanning {
  color: #2563eb;
  border-color: #93c5fd;
  animation: obsScanPulse 1.2s ease-in-out infinite;
}

@keyframes obsScanPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

body[data-theme="dark"] .obs-scan-now-btn {
  background: var(--card, #1e1e2e);
  border-color: var(--border, #313244);
  color: var(--fg, #cdd6f4);
}

body[data-theme="dark"] .obs-scan-now-btn:hover {
  background: var(--hover, #313244);
}

body[data-theme="dark"] .dock-observer-card.sev-info {
  border-left-color: #4b5563;
  background: var(--card, #1e1e2e);
}

body[data-theme="dark"] .observer-info {
  background: #374151;
  color: #9ca3af;
  border-color: #4b5563;
}


/* --- Task Lifecycle & Enhance Styles --- */
.status-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7em;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: box-shadow 0.2s ease;
}

body[data-theme="dark"] .status-online {
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

body[data-theme="dark"] .status-offline {
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.status-pending {
  background: #6c757d;
  color: #fff;
}

.status-started {
  background: #007bff;
  color: #fff;
}

.status-review {
  background: #6f42c1;
  color: #fff;
}

.status-todo {
  background: #e5e7eb;
  color: #111827;
}

.status-in_progress {
  background: #bfdbfe;
  color: #1e40af;
}

.status-blocked {
  background: #fee2e2;
  color: #b91c1c;
}

.status-done {
  background: #28a745;
  color: #fff;
}

.status-pr_ready {
  background: #ede9fe;
  color: #5b21b6;
}

.status-merged {
  background: #dcfce7;
  color: #166534;
}

.status-archived {
  background: #e2e8f0;
  color: #334155;
}

.status-online {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.status-configured {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.status-offline {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.status-warn {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.status-approved {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

/* --- Task Lifecycle Stepper --- */
.task-lifecycle-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 6px 0;
  width: 100%;
  -webkit-user-select: none;
  user-select: none;
}

.lifecycle-step {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  min-width: 0;
  position: relative;
}

.lifecycle-step:last-child {
  flex: 0 0 auto;
}

.lifecycle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.lifecycle-step.completed .lifecycle-dot {
  background: #22c55e;
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

.lifecycle-step.active .lifecycle-dot {
  background: #3b82f6;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  width: 12px;
  height: 12px;
}

.lifecycle-step.blocked .lifecycle-dot {
  background: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
  width: 12px;
  height: 12px;
}

.lifecycle-step.approved .lifecycle-dot {
  background: #16a34a;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25);
  width: 12px;
  height: 12px;
}

.lifecycle-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  transition: background 0.3s ease;
  min-width: 8px;
}

.lifecycle-step.completed .lifecycle-connector {
  background: #22c55e;
}

.lifecycle-label {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.lifecycle-step.active .lifecycle-label,
.lifecycle-step.blocked .lifecycle-label,
.lifecycle-step.approved .lifecycle-label {
  opacity: 1;
  font-weight: 700;
}

.lifecycle-step.active .lifecycle-label {
  color: #3b82f6;
}

.lifecycle-step.completed .lifecycle-label {
  color: #22c55e;
  opacity: 0.8;
}

.lifecycle-step.blocked .lifecycle-label {
  color: #ef4444;
}

.lifecycle-step.approved .lifecycle-label {
  color: #16a34a;
}

body[data-theme="dark"] .lifecycle-dot {
  background: #374151;
  border-color: #4b5563;
}

body[data-theme="dark"] .lifecycle-connector {
  background: #374151;
}

body[data-theme="dark"] .lifecycle-step.completed .lifecycle-dot {
  background: #22c55e;
  border-color: #22c55e;
}

body[data-theme="dark"] .lifecycle-step.completed .lifecycle-connector {
  background: #22c55e;
}

body[data-theme="dark"] .lifecycle-step.active .lifecycle-dot {
  background: #60a5fa;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3);
}

body[data-theme="dark"] .lifecycle-step.blocked .lifecycle-dot {
  background: #f87171;
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.3);
}

/* --- Phase Accordion --- */
.task-phase-group {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  position: relative;
}

.task-phase-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--soft);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  border-bottom: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  transition: background 0.15s ease;
}

.task-phase-group.collapsed .task-phase-header {
  border-radius: 10px;
  border-bottom: none;
}

.task-phase-header:hover {
  background: var(--bg);
}

.task-phase-chevron {
  font-size: 12px;
  transition: transform 0.2s ease;
  color: var(--muted);
  width: 16px;
  text-align: center;
}

.task-phase-group.collapsed .task-phase-chevron {
  transform: rotate(-90deg);
}

.task-phase-group.collapsed .task-phase-body {
  display: none !important;
}

.task-phase-name {
  font-weight: 700;
  font-size: 14px;
  flex: 1;
}

.task-phase-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.phase-progress-track {
  width: 64px;
  height: 6px;
  background: var(--border, #e5e7eb);
  border-radius: 3px;
  overflow: hidden;
}

.phase-progress-fill {
  display: block;
  height: 100%;
  background: #16a34a;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.phase-progress-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  min-width: 24px;
}

.task-phase-body {
  padding: 8px;
}

/* --- Inline Phase Confirmation --- */
.phase-confirm-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #fef3c7;
  border-bottom: 1px solid #fcd34d;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  animation: confirmSlideIn 0.15s ease-out;
}

body[data-theme="dark"] .phase-confirm-bar {
  background: #422006;
  border-bottom-color: #92400e;
  color: #fcd34d;
}

.task-phase-group.collapsed .phase-confirm-bar {
  display: none;
}

@keyframes confirmSlideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Task Priority Indicators --- */
.task-card.priority-high {
  border-left: 4px solid #dc2626 !important;
}

.task-card.priority-low {
  border-left: 4px solid #60a5fa !important;
}

/* --- 3-Dot Menu --- */
.task-3dot-wrap {
  position: relative;
  display: inline-block;
}

.task-3dot-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--fg);
  line-height: 1;
}

.task-3dot-btn:hover {
  background: var(--soft);
}

.task-3dot-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 200;
  padding: 4px 0;
}

.task-3dot-menu.open {
  display: block;
}

.task-3dot-menu button {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: var(--fg);
}

.task-3dot-menu button:hover {
  background: var(--soft);
}

.task-3dot-menu button.active {
  font-weight: 700;
  color: var(--primary);
}

.task-3dot-menu .menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* --- Task Search + Inline Add --- */
.task-search-input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
  width: 160px;
  transition: width 0.2s ease;
}

.task-search-input:focus {
  width: 220px;
  outline: none;
  border-color: var(--primary);
}

.task-add-inline {
  display: flex;
  gap: 6px;
  padding: 8px;
  align-items: center;
}

.task-add-inline input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
}

.task-add-inline input:focus {
  outline: none;
  border-color: var(--primary);
}

/* --- Editable Task Title --- */
.task-title-editable {
  cursor: text;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.task-title-editable:hover {
  border-color: var(--border);
  background: var(--soft);
}

.task-title-editable:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg);
}

/* --- Task Context Textarea --- */
.task-context-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.5;
}

.task-context-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* --- Task Sequence Badge --- */
.task-seq-badge {
  font-family: var(--mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  min-width: 22px;
  text-align: right;
  padding: 0 2px;
  opacity: 0.5;
  -webkit-user-select: none;
  user-select: none;
  transition: opacity 0.15s;
}

.task-card:hover .task-seq-badge {
  opacity: 0.85;
}

/* --- Drag Handle --- */
.task-drag-handle {
  cursor: grab;
  padding: 4px 2px;
  margin-right: 4px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.task-drag-handle:hover {
  opacity: 1;
}

.task-card.dragging {
  opacity: 0.5;
  border: 2px dashed var(--primary) !important;
}

.task-card.drag-over {
  border-top: 3px solid var(--primary) !important;
}

.task-phase-group.phase-drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  background: rgba(99, 102, 241, 0.04);
}

/* --- Button busy / loading state --- */
.btn-busy {
  opacity: 0.65;
  pointer-events: none;
  animation: btn-pulse 1.2s ease-in-out infinite;
}

@keyframes btn-pulse {

  0%,
  100% {
    opacity: 0.65;
  }

  50% {
    opacity: 0.4;
  }
}

/* --- Phase Management --- */
.task-phase-name-editable {
  font-weight: 700;
  font-size: 14px;
  flex: 1;
  cursor: text;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  min-width: 80px;
  transition: border-color 0.15s, background 0.15s;
}

.task-phase-name-editable:hover {
  border-color: var(--border);
  background: var(--bg);
}

.task-phase-name-editable:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg);
}

.task-create-phase {
  display: flex;
  gap: 6px;
  padding: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.task-create-phase input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
}

.task-create-phase input:focus {
  outline: none;
  border-color: var(--primary);
}

/* --- 3-dot submenu --- */
.task-3dot-menu .menu-label {
  padding: 6px 14px 2px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.btn-enhance {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  font-weight: bold;
}

.btn-enhance:hover {
  opacity: 0.9;
}

.task-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

/* --- INLINE TASK CHAT --- */
.task-expansion {
  display: none;
  /* Hidden by default */
  border-top: 1px solid var(--border);
  background: var(--soft);
  padding: 10px;
  margin-top: 8px;
  border-radius: 0 0 8px 8px;
}

.task-expansion.open {
  display: block;
}

.inline-chat-layout {
  display: flex;
  flex-direction: column;
  height: 300px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.inline-chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inline-chat-history::before {
  content: "";
  margin-top: auto;
}

.question-thread-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question-thread-history::before {
  content: "";
  margin-top: auto;
}

.inline-chat-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--card);
}

.inline-chat-footer input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}

.btn-inline {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* --- Manager chat layout --- */
/* ══════════════════════════════════════════════════════════════════════════════
 * Manager Chat — Premium Redesign
 * ══════════════════════════════════════════════════════════════════════════════ */

/* ── Resize Handle ────────────────────────────────────────────────────────── */
.chat-resize-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 14px;
  margin-bottom: 14px;
  cursor: row-resize;
  -webkit-user-select: none;
  user-select: none;
  border-radius: 0 0 8px 8px;
  transition: background 0.15s;
}

.chat-resize-handle:hover {
  background: rgba(91, 127, 255, 0.08);
}

.chat-resize-handle:active {
  background: rgba(91, 127, 255, 0.14);
}

.chat-resize-grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.15s, width 0.15s;
}

.chat-resize-handle:hover .chat-resize-grip {
  background: var(--accent, #5b7fff);
  width: 56px;
}

/* ── Chat Layout ──────────────────────────────────────────────────────────── */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) 3fr 2fr;
  gap: 0;
  height: calc(100vh - 180px);
  min-height: 360px;
  max-height: 900px;
  overflow: hidden;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  background: var(--card);
}

.chat-layout.sidebar-collapsed {
  grid-template-columns: 0fr 1fr minmax(0, 500px);
}

.chat-layout.swarm-collapsed {
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) minmax(240px, 280px);
}

.chat-layout.sidebar-collapsed.swarm-collapsed {
  grid-template-columns: 0fr 1fr minmax(240px, 280px);
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.chat-sidebar {
  min-width: 0;
  padding: 12px 10px;
  background: var(--soft);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: padding 0.2s, opacity 0.2s;
}

.chat-layout.sidebar-collapsed .chat-sidebar {
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.chat-sidebar-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.chat-sidebar-toggle,
.chat-sidebar-expand {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.chat-sidebar-toggle:hover,
.chat-sidebar-expand:hover {
  color: var(--fg);
  background: var(--badge);
}

.chat-sidebar-hint {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.7;
  margin-bottom: 8px;
}

.manager-actions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.manager-action-btn {
  width: 100%;
  text-align: left;
  font-size: 11px;
  justify-content: flex-start;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.manager-action-btn:hover {
  background: var(--soft);
  border-color: var(--accent, #5b7fff);
  box-shadow: 0 0 0 1px rgba(91, 127, 255, 0.1);
}

/* ── Swarm Side Panel ─────────────────────────────────────────────────────── */
.swarm-side-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #1a1b26;
  border-left: 1px solid #2a2b3a;
  overflow: hidden;
  transition: opacity 0.2s, padding 0.2s;
  position: relative;
}

.chat-layout.swarm-collapsed .swarm-side-panel {
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

/* Resize handle on left edge */
.swarm-resize-handle {
  position: absolute;
  top: 0;
  left: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background 0.15s;
}

.swarm-resize-handle:hover,
.swarm-resize-handle.dragging {
  background: rgba(122, 162, 247, 0.4);
}

.swarm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #12131e;
  border-bottom: 1px solid #2a2b3a;
  flex-shrink: 0;
}

/* ── Mobile: swarm panel as a tab ─────────────────────────────────────────── */
.swarm-mobile-tab {
  display: none;
}

@media (max-width: 900px) {
  .chat-layout {
    grid-template-columns: 1fr !important;
  }

  .chat-sidebar {
    display: none !important;
  }

  .swarm-side-panel {
    display: none !important;
  }

  .chat-layout.swarm-mobile-active .chat-main-shell {
    display: none !important;
  }

  .chat-layout.swarm-mobile-active .swarm-side-panel {
    display: flex !important;
    border-left: none;
  }

  .swarm-resize-handle {
    display: none;
  }

  .swarm-mobile-tab {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    background: var(--card);
  }

  .swarm-mobile-tab button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
  }

  .swarm-mobile-tab button.active {
    color: var(--fg);
    border-bottom-color: var(--primary);
  }

  .swarm-mobile-tab button:hover {
    color: var(--fg);
  }
}

/* ── Activity Side Panel (right column of Manager Chat) ────────────────── */
.activity-side-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--soft, #1a1b26);
  border-left: 1px solid var(--border, #2a2b3a);
  overflow: hidden;
}

.activity-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--card, #12131e);
  border-bottom: 1px solid var(--border, #2a2b3a);
  flex-shrink: 0;
}

.activity-panel-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.activity-panel-collapse {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.activity-panel-collapse:hover {
  color: var(--fg);
  background: var(--badge);
}

.activity-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
}

.activity-panel-body .activity-feed {
  margin-top: auto;
}

.activity-panel-body .activity-entry {
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.5;
}

.activity-panel-body .activity-entry .activity-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-right: 4px;
}

.activity-panel-body .activity-entry .activity-time {
  font-size: 10px;
  color: var(--muted);
  float: right;
}

.activity-panel-body .activity-entry .activity-detail {
  margin-top: 4px;
  color: var(--fg-dim, #999);
  font-size: 11px;
}

/* Collapse state for activity panel */
.chat-layout.activity-collapsed {
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) 0fr;
}

.chat-layout.activity-collapsed .activity-side-panel {
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 900px) {
  .activity-side-panel {
    border-left: none;
    border-top: 1px solid var(--border, #2a2b3a);
    max-height: 200px;
    min-width: 0;
  }
}


.swarm-panel-title {
  font-family: var(--mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #7aa2f7;
  text-transform: uppercase;
}

.swarm-panel-toggle {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #565f89;
  cursor: pointer;
  padding: 3px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}

.swarm-panel-toggle:hover {
  color: #c0caf5;
  background: rgba(122, 162, 247, 0.1);
}

.swarm-panel-log {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: var(--mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 11px;
  line-height: 1.6;
  color: #a9b1d6;
  white-space: pre-wrap;
  word-break: break-word;
}

.swarm-panel-log::-webkit-scrollbar {
  width: 6px;
}

.swarm-panel-log::-webkit-scrollbar-track {
  background: transparent;
}

.swarm-panel-log::-webkit-scrollbar-thumb {
  background: #2a2b3a;
  border-radius: 3px;
}

.swarm-panel-log::-webkit-scrollbar-thumb:hover {
  background: #3b3d56;
}

.swarm-log-empty {
  color: #7982a9;
  font-style: italic;
  padding: 20px 0;
  text-align: center;
}

.swarm-log-line {
  padding: 1px 0;
  border-bottom: 1px solid rgba(42, 43, 58, 0.4);
}

.swarm-log-ts {
  color: #7982a9;
  margin-right: 6px;
}

.swarm-log-event {
  color: #7aa2f7;
  font-weight: 600;
  margin-right: 6px;
}

.swarm-log-agent {
  color: #9ece6a;
  margin-right: 6px;
}

.swarm-log-detail {
  color: #c0caf5;
}

/* ── Main Shell ───────────────────────────────────────────────────────────── */
.chat-main-shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── Header Bar ───────────────────────────────────────────────────────────── */
.chat-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--soft);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-header-status {
  flex-shrink: 0;
}

.chat-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  animation: statusPulse 2.5s ease-in-out infinite;
}

@keyframes statusPulse {

  0%,
  100% {
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  }

  50% {
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
  }
}

.chat-status-dot.status-offline {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
  animation: statusPulseRed 2.5s ease-in-out infinite;
}

@keyframes statusPulseRed {

  0%,
  100% {
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
  }

  50% {
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
  }
}

.chat-status-dot.status-warn {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
  animation: statusPulseAmber 2.5s ease-in-out infinite;
}

@keyframes statusPulseAmber {

  0%,
  100% {
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
  }

  50% {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.8);
  }
}

/* Authenticate button — hidden by default, shown when sandbox needs auth */
.chat-auth-btn {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid #ef4444;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s;
  margin-left: 6px;
}

.chat-auth-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.chat-auth-btn.visible {
  display: inline-flex;
}

.chat-auth-btn.authenticating {
  opacity: 0.6;
  pointer-events: none;
}

.chat-header-identity {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-scope {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.chat-header-right {
  flex-shrink: 0;
}

/* ── Tabs (in header) ─────────────────────────────────────────────────────── */
.chat-tabs {
  display: flex;
  gap: 2px;
  padding: 0;
  border-bottom: none;
  background: transparent;
}

.chat-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.chat-tab:hover {
  color: var(--fg);
  background: var(--badge);
}

.chat-tab.active {
  background: var(--card);
  color: var(--fg);
  border-color: var(--border);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chat-tab svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.chat-tab.active svg {
  opacity: 1;
}

/* ── Activity Bar ─────────────────────────────────────────────────────────── */
.chat-activity-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.06), rgba(59, 130, 246, 0.04));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

body[data-theme="dark"] .chat-activity-bar {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.08), rgba(59, 130, 246, 0.06));
}

.chat-activity-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: activityBlink 3s ease-in-out infinite;
}

@keyframes activityBlink {

  0%,
  85%,
  100% {
    opacity: 1;
  }

  92% {
    opacity: 0.3;
  }
}

.chat-activity-text {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Chat Main (message area) ─────────────────────────────────────────────── */
.chat-main {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-main::before {
  content: "";
  margin-top: auto;
}

/* ── Resources panel ──────────────────────────────────────────────────────── */
.manager-resources {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: none;
}

/* ── Activity panel ──────────────────────────────────────────────────────── */
.manager-activity {
  flex: 1 1 0;
  overflow-y: auto;
  min-height: 0;
  display: none;
}

/* ── Activity Feed ────────────────────────────────────────────────────────── */
.activity-feed {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
}

.activity-event {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  transition: background 0.15s, box-shadow 0.15s;
  animation: activityFadeIn 0.25s ease-out;
}

.activity-event:hover {
  background: var(--soft);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body[data-theme="dark"] .activity-event {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

body[data-theme="dark"] .activity-event:hover {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@keyframes activityFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.activity-event-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1.4;
  width: 24px;
  text-align: center;
}

.activity-event-body {
  flex: 1;
  min-width: 0;
}

.activity-event-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

/* ── Event Type Badge (color-coded) ───────────────────────────────────────── */
.activity-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.4;
  white-space: nowrap;
}

/* Default: indigo */
.activity-badge {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
}

/* Red: errors, issues */
.activity-badge--red {
  background: rgba(239, 68, 68, 0.10);
  color: #dc2626;
}

/* Amber: warnings, breaks, rebuilds */
.activity-badge--amber {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

/* Green: deploys, merges, task completions */
.activity-badge--green {
  background: rgba(34, 197, 94, 0.10);
  color: #16a34a;
}

/* Blue: reasoning, info */
.activity-badge--blue {
  background: rgba(59, 130, 246, 0.10);
  color: #2563eb;
}

body[data-theme="dark"] .activity-badge {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
}

body[data-theme="dark"] .activity-badge--red {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

body[data-theme="dark"] .activity-badge--amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}

body[data-theme="dark"] .activity-badge--green {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

body[data-theme="dark"] .activity-badge--blue {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.activity-agent {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.activity-ts {
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
  opacity: 0.7;
  cursor: default;
}

/* ── Detail Text ──────────────────────────────────────────────────────────── */
.activity-detail {
  font-size: 13px;
  color: var(--fg);
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-line;
}

/* Activity details are always fully visible — no collapsing */

/* ── Agent group separator ────────────────────────────────────────────────── */
.activity-agent-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 2px;
  margin-top: 4px;
}

.activity-agent-group-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.activity-agent-group-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Input Wrap ───────────────────────────────────────────────────────────── */
.chat-input-wrap {
  flex-shrink: 0;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  background: var(--soft);
}

/* ── Condition Chips ──────────────────────────────────────────────────────── */
.chat-condition-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-condition-row::-webkit-scrollbar {
  display: none;
}

.chat-condition-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.chat-condition-chips {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.chat-condition-chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 3px;
}

.chat-condition-chip:hover {
  color: var(--fg);
  border-color: var(--accent, #5b7fff);
}

.chat-condition-chip.active {
  background: var(--accent, #5b7fff);
  color: #fff;
  border-color: var(--accent, #5b7fff);
  font-weight: 600;
}

body[data-theme="dark"] .chat-condition-chip.active {
  background: rgba(91, 127, 255, 0.25);
  color: #93b5ff;
  border-color: rgba(91, 127, 255, 0.4);
}

/* ── Input Row ────────────────────────────────────────────────────────────── */
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-input-row:focus-within {
  border-color: var(--accent, #5b7fff);
  box-shadow: 0 0 0 3px rgba(91, 127, 255, 0.1);
}

.chat-input-tools {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  align-self: flex-end;
  padding-bottom: 2px;
}

.chat-tool-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.chat-tool-btn:hover {
  color: var(--fg);
  background: var(--soft);
}

.chat-tool-btn.recording {
  color: #e53e3e;
  animation: mic-pulse 1.2s ease-in-out infinite;
}

@keyframes mic-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.chat-textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  padding: 4px 0;
  overflow-y: auto;
}

.chat-textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.chat-send-btn {
  background: var(--accent, #5b7fff);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 7px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
  transition: background 0.15s, opacity 0.15s, transform 0.15s;
}

.chat-send-btn:hover {
  background: var(--accent-hover, #4a6ae8);
  transform: scale(1.05);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Stop Response Button (active during streaming) ──────────────────────── */
.chat-send-btn.btn-stop-active,
.btn-send.btn-stop-active {
  background: #ef4444;
  opacity: 1;
  cursor: pointer;
  transform: none;
  animation: stopPulse 1.5s ease-in-out infinite;
}

.chat-send-btn.btn-stop-active:hover,
.btn-send.btn-stop-active:hover {
  background: #dc2626;
  transform: scale(1.08);
}

@keyframes stopPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

.stream-stopped {
  margin-top: 8px;
  padding: 4px 8px;
  font-size: 0.8em;
  color: var(--muted, #888);
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  opacity: 0.7;
}

/* ── Message Bubbles ──────────────────────────────────────────────────────── */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  animation: msgAppear 0.2s ease-out;
}

@keyframes msgAppear {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 3px;
  margin-left: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.msg-bubble {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.55;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  word-break: break-word;
}

.msg-ai .msg-bubble {
  background: var(--badge);
  color: var(--fg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

body[data-theme="dark"] .msg-ai .msg-bubble {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.msg-user {
  align-self: flex-end;
}

.msg-user .msg-bubble {
  background: linear-gradient(135deg, #5b7fff 0%, #4a6ae8 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  border: none;
}

.msg-user .msg-meta {
  justify-content: flex-end;
  margin-right: 4px;
  margin-left: 0;
}

/* ── System Messages (Events) ─────────────────────────────────────────────── */
.msg-system {
  align-self: center;
  max-width: 100%;
  text-align: center;
  padding: 2px 0;
}

.msg-system-text {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--badge);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  display: inline-block;
  line-height: 1.4;
}

body[data-theme="dark"] .msg-system-text {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
}

.msg-system-time {
  display: block;
  font-size: 0.64rem;
  color: var(--muted);
  opacity: 0.6;
  margin-top: 2px;
}

.msg-directive {
  align-self: stretch;
  text-align: left;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  margin: 16px 0;
  background: transparent;
}

.msg-directive .msg-meta {
  justify-content: flex-start;
  margin-left: 0;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--fg);
}

.msg-directive .msg-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--fg);
}

/* ── Condition Tag (inline footnote) ──────────────────────────────────────── */
.msg-condition-tag {
  font-size: 0.65rem;
  color: var(--accent, #5b7fff);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(91, 127, 255, 0.08);
}

body[data-theme="dark"] .msg-condition-tag {
  color: #93b5ff;
  background: rgba(91, 127, 255, 0.12);
}

/* ── Streaming Chat Indicators ──────────────────────────────────────────── */

.msg-streaming .msg-bubble {
  border-left: 2px solid var(--accent, #5b7fff);
  animation: streaming-pulse 1.5s ease-in-out infinite;
}

@keyframes streaming-pulse {

  0%,
  100% {
    border-left-color: var(--accent, #5b7fff);
  }

  50% {
    border-left-color: transparent;
  }
}

.streaming-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--accent, #5b7fff);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.streaming-answering {
  color: #10b981;
}

body[data-theme="dark"] .streaming-indicator {
  color: #93b5ff;
}

body[data-theme="dark"] .streaming-answering {
  color: #34d399;
}

.thinking-dots::after {
  content: "";
  animation: thinking-dots 1.4s steps(4, end) infinite;
}

@keyframes thinking-dots {
  0% {
    content: "";
  }

  25% {
    content: ".";
  }

  50% {
    content: "..";
  }

  75% {
    content: "...";
  }

  100% {
    content: "";
  }
}

.thinking-count {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 400;
}

/* ── Token Usage Badge (shown after AI response completes) ─────────────── */
.msg-token-usage {
  margin-top: 6px;
  padding: 3px 10px;
  font-size: 0.68rem;
  color: var(--muted);
  opacity: 0.6;
  border-top: 1px solid var(--border);
  letter-spacing: 0.01em;
  transition: opacity 0.2s;
}

.msg-token-usage:hover {
  opacity: 1;
}

body[data-theme="dark"] .msg-token-usage {
  border-top-color: rgba(255, 255, 255, 0.06);
}

/* --- Manager resources --- */

/* Repo section tabs */
.repo-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

/* ─── Repo Tabs ──────────────────────────────────────────────────────────────
 * Tab bar for the Repository Control section (renderProjectQualityControl).
 * 5 tabs: PRs | QC Feed | Repo Activity | Issues | Branch Drift
 * Active tab state lives in state.repoTabByProject[project] (persisted to localStorage).
 * Tab panels are toggled via display:none on [data-repo-tab-panel] elements.
 * Follows same pattern as .chat-tabs / .chat-tab above.
 * ──────────────────────────────────────────────────────────────────────────── */
.repo-tab {
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.repo-tab:hover {
  background: var(--soft);
  color: var(--fg);
}

.repo-tab.active {
  background: var(--card);
  color: var(--fg);
  border-color: var(--border);
}

/* ─── Repo Tab Badge (count inside tab header) ─────────────────────── */
.repo-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 0 5px;
  height: 18px;
  border-radius: 9px;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--border);
  color: var(--muted);
  margin-left: 4px;
  transition: background 0.3s, color 0.3s;
}

.repo-tab.active .repo-tab-badge {
  background: var(--accent, #3b82f6);
  color: #fff;
}

.repo-tab-badge-alert {
  background: #f59e0b !important;
  color: #1a1a1a !important;
}

/* ─── Repo Tab Inline Pagination ───────────────────────────────────── */
.repo-tab-pagination {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 0.78rem;
}

.repo-tab-page-select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.75rem;
  color: var(--fg);
  cursor: pointer;
  height: 24px;
}

.repo-tab-page-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  transition: background 0.12s;
}

.repo-tab-page-btn:hover:not(:disabled) {
  background: var(--soft);
}

.repo-tab-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.repo-tab-page-info {
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 28px;
  text-align: center;
}

/* ─── Disabled button style (e.g. Merge & Squash when not ready) ─── */
.btn.btn-disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ─── Repo Header Bar ──────────────────────────────────────────────── */
.repo-header-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
}

.repo-conn-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.repo-conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.repo-conn-dot.connected {
  background: #16a34a;
  box-shadow: 0 0 6px rgba(22, 163, 106, 0.4);
}

.repo-conn-dot.degraded {
  background: #d97706;
  box-shadow: 0 0 6px rgba(217, 119, 6, 0.4);
  animation: conn-pulse 2s ease-in-out infinite;
}

@keyframes conn-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.repo-conn-dot.disconnected {
  background: #dc2626;
  box-shadow: 0 0 6px rgba(220, 38, 38, 0.3);
}

.repo-conn-dot.sandbox {
  background: #8b5cf6;
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.4);
  animation: conn-pulse 2s ease-in-out infinite;
}

.repo-header-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
}

.repo-header-label {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.repo-header-val {
  color: var(--fg);
  font-weight: 600;
}

.repo-header-link {
  color: var(--accent, #3b82f6);
  text-decoration: none;
  font-size: 0.82rem;
}

.repo-header-link:hover {
  text-decoration: underline;
}

/* ─── Branch Selector Dropdown ─────────────────────────────────────── */
.branch-selector {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.branch-selector-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.branch-selector-trigger:hover {
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.branch-selector-trigger .branch-arrow {
  font-size: 0.65rem;
  color: var(--muted);
  transition: transform 0.2s;
}

.branch-selector.open .branch-selector-trigger .branch-arrow {
  transform: rotate(180deg);
}

.branch-selector-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  min-width: 220px;
  max-width: 320px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  flex-direction: column;
  gap: 4px;
}

.branch-selector.open .branch-selector-panel {
  display: flex;
}

.branch-selector-search {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.8rem;
  background: var(--bg);
  color: var(--fg);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.branch-selector-search:focus {
  border-color: var(--accent, #3b82f6);
}

.branch-selector-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.branch-selector-item {
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s;
}

.branch-selector-item:hover {
  background: var(--soft);
}

.branch-selector-item.selected {
  background: var(--accent, #3b82f6);
  color: #fff;
  font-weight: 600;
}

.branch-selector-empty {
  padding: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

/* ─── Merge Preferences (inline auto-save) ─────────────────────────── */
.repo-merge-prefs {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 14px;
  margin-top: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.repo-merge-prefs label {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

.repo-merge-prefs label:hover {
  color: var(--fg);
}

/* ─── Toast notification (scoped to repo container) ──────────────── */
.repo-toast {
  position: absolute;
  bottom: 8px;
  right: 12px;
  z-index: 50;
  background: none;
  color: #4ade80;
  padding: 0;
  border-radius: 0;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: monospace;
  letter-spacing: 0.02em;
  box-shadow: none;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

.repo-toast.visible {
  opacity: 1;
}

/* ─── Expandable PR Rows ───────────────────────────────────────────── */
.repo-pr-row {
  cursor: pointer;
  transition: background 0.12s;
}

.repo-pr-row:hover {
  background: var(--soft);
}

.repo-pr-expand {
  display: none;
  background: var(--soft);
  border-top: 1px solid var(--border);
}

.repo-pr-expand.open {
  display: table-row;
}

.repo-pr-expand td {
  padding: 12px 14px;
}

.repo-pr-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pr-queue-badge {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}

.pr-queue-badge.q1 {
  background: rgba(22, 163, 106, 0.15);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 106, 0.3);
}

.pr-queue-badge.blocked {
  background: rgba(120, 120, 130, 0.12);
  color: var(--muted);
  border: 1px solid rgba(120, 120, 130, 0.2);
}

.pr-blocked-hint {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.8;
  margin-left: 2px;
}

.repo-pr-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.repo-pr-detail-label {
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 90px;
  font-weight: 500;
}

.repo-pr-detail-val {
  font-size: 0.82rem;
  color: var(--fg);
}

.repo-pr-body-preview {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: pre-wrap;
  max-height: 60px;
  overflow: hidden;
  line-height: 1.4;
}

.repo-pr-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* Conditional action buttons */
.btn-repo-issue {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-weight: 600;
}

.btn-repo-issue:hover {
  background: #fecaca;
}

.btn-repo-clean {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  opacity: 0.6;
  pointer-events: none;
}

.btn-repo-merge-ready {
  background: #16a34a;
  color: #fff;
  border: 1px solid #16a34a;
  font-weight: 700;
}

.btn-repo-merge-ready:hover {
  background: #15803d;
}

.btn-repo-merge-blocked {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── PR Expand Detail Row ─────────────────────────────────────────── */
.pr-expand-detail {
  display: none;
  background: var(--soft);
  border-top: 1px solid var(--border);
}

.pr-expand-detail.open {
  display: table-row;
}

/* ─── Auto-Merge Countdown ─────────────────────────────────────────── */
.auto-merge-countdown-row td {
  padding: 0 !important;
}

.auto-merge-countdown {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.12), rgba(16, 185, 129, 0.10));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.auto-merge-countdown-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.25), rgba(16, 185, 129, 0.25));
  animation: auto-merge-shrink 5s linear forwards;
  pointer-events: none;
}

@keyframes auto-merge-shrink {
  from {
    width: 100%;
  }

  to {
    width: 0%;
  }
}

.auto-merge-countdown-text {
  position: relative;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  z-index: 1;
}

.auto-merge-seconds {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #d97706;
}

.auto-merge-cancel {
  position: relative;
  z-index: 1;
  background: #dc2626 !important;
  color: #fff !important;
  border: none !important;
  font-size: 11px !important;
  padding: 2px 10px !important;
  border-radius: 4px !important;
  cursor: pointer;
}

.auto-merge-cancel:hover {
  background: #b91c1c !important;
}

/* ── Manual-merge inline bar (indeterminate animation) ──────────── */
.manual-merge-active .auto-merge-countdown-bar {
  animation: manual-merge-pulse 2s ease-in-out infinite !important;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.25), rgba(16, 185, 129, 0.35)) !important;
}

@keyframes manual-merge-pulse {
  0% {
    width: 15%;
    opacity: 0.6;
  }

  50% {
    width: 100%;
    opacity: 1;
  }

  100% {
    width: 15%;
    opacity: 0.6;
  }
}

/* ─── Auto-Merge Error ─────────────────────────────────────────────── */
.auto-merge-error-row td {
  padding: 0 !important;
}

.auto-merge-error {
  padding: 5px 14px;
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  font-size: 12px;
  border-top: 1px solid rgba(220, 38, 38, 0.2);
  border-bottom: 1px solid rgba(220, 38, 38, 0.2);
}

.pr-expand-cell {
  padding: 12px 14px;
}

/* ─── PR Detail Expand Grid ────────────────────────────────────── */
.pr-expand-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 18px;
  align-items: start;
}

.pr-detail-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.pr-detail-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pr-detail-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 42px;
  padding-top: 5px;
  text-align: right;
  flex-shrink: 0;
}

.pr-detail-field input,
.pr-detail-field textarea {
  flex: 1;
  font-size: 0.82rem;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  color: var(--fg);
  font-family: inherit;
  resize: vertical;
}

.pr-detail-field textarea {
  min-height: 60px;
  line-height: 1.4;
}

.pr-detail-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--muted);
  padding-top: 2px;
}

.pr-detail-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pr-detail-meta .mono {
  font-weight: 600;
  color: var(--fg);
}

.pr-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  min-width: 150px;
}

/* ─── Auto-merge scope select ──────────────────────────────────── */
.auto-merge-scope {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

.auto-merge-scope select {
  font-size: 0.78rem;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--fg);
}

/* ─── PR Action Buttons (inline expand row) ────────────────────────── */
.pr-action-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.pr-action-btn:hover:not(:disabled) {
  background: var(--soft);
  border-color: var(--muted);
}

.pr-action-btn-ready {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}

.pr-action-btn-ready:hover:not(:disabled) {
  background: #15803d;
  border-color: #15803d;
}

.pr-action-btn-danger {
  background: transparent;
  color: #dc2626;
  border-color: #fca5a5;
}

.pr-action-btn-danger:hover {
  background: #fee2e2;
  border-color: #dc2626;
}

.pr-action-btn-issue {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.pr-action-btn-issue:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.pr-action-btn-close {
  background: transparent;
  color: #2563eb;
  border-color: #93c5fd;
}

.pr-action-btn-close:hover {
  background: #dbeafe;
  border-color: #2563eb;
}

.pr-action-btn-inactive {
  opacity: 0.45;
  cursor: default;
}

.pr-action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

[data-repo-tab-panel] {
  min-height: 500px;
}

/* ─── PR History search ────────────────────────────────────────────── */
.repo-history-search {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.repo-history-search input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  background: var(--card);
  color: var(--fg);
}

/* ─── Live Preview Controls ──────────────────────────────────────────────────
 * Styles for the Live Preview panel (renderPreviewPanel in _05d_views.js).
 *
 * Components:
 *   .preview-toggle-switch  — Pill-shaped Live↔Local toggle (replaces old buttons)
 *   .preview-toggle-track   — Sliding track with thumb indicator
 *   .preview-toggle-label   — "Live" / "Local" labels on each side
 *   .preview-note-header    — (removed; replaced by Pin Log table)
 *   .preview-note-menu-btn  — (removed; replaced by Pin Log inline actions)
 *   .preview-note-dropdown  — (removed; replaced by Pin Log)
 *   .preview-note-extra     — (removed; notes are editable inline)
 *   .pin-log-section        — Unified Pin Log table wrapper
 *   .pin-log-filter         — Status dropdown (Active / Completed / Deleted)
 *   .pin-priority-select    — Inline priority select in active rows
 *   .pin-action-btn         — Compact 28×28 square action buttons
 *
 * The toggle switch works by toggling .toggled class on .preview-toggle-track
 * which slides the thumb from left to right (or vice versa).
 * ──────────────────────────────────────────────────────────────────────────── */
/* Preview toggle switch */
.preview-toggle-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.preview-toggle-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.15s;
}

.preview-toggle-label.active {
  color: var(--fg);
  font-weight: 600;
}

.preview-toggle-track {
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
}

.preview-toggle-track.toggled {
  background: var(--accent, #3b82f6);
}

.preview-toggle-thumb {
  width: 18px;
  height: 18px;
  background: var(--card);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.preview-toggle-track.toggled .preview-toggle-thumb {
  left: 20px;
}

/* ── Pin Log ────────────────────────────────────────────────────────────
 * Unified Pin Log table – replaces old card-based notes + separate table.
 *
 * Components:
 *   .pin-log-section      — Wrapper for the entire pin log area
 *   .pin-log-filter       — Status dropdown (Active / Completed / Deleted)
 *   .pin-priority-select  — Inline priority <select> in active rows
 *   .pin-priority-badge   — Read-only priority badge in completed/deleted view
 *   .pin-note-cell        — Note text: wraps, truncated, expands on hover
 *   .pin-action-btn       — Compact 28×28 square icon buttons
 *   .pin-actions-cell     — Flex container for action buttons
 * ──────────────────────────────────────────────────────────────────────── */

.pin-log-section {
  margin-top: 10px;
}

/* Status filter dropdown */
.pin-log-filter {
  font-size: 0.8rem;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
}

/* Inline priority select */
.pin-priority-select {
  font-size: 0.75rem;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  width: 78px;
  border-left: 3px solid var(--border);
}

/* Color indicator bar on left edge of priority dropdown */
.pin-priority-select.pin-priority-low {
  border-left-color: #facc15;
}

.pin-priority-select.pin-priority-medium {
  border-left-color: #f97316;
}

.pin-priority-select.pin-priority-high {
  border-left-color: #ef4444;
}

.pin-priority-select.pin-priority-critical {
  border-left-color: #991b1b;
}

/* Priority badges (read-only in completed/deleted views) */
.pin-priority-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.pin-priority-low {
  background: #d1fae5;
  color: #065f46;
}

.pin-priority-medium {
  background: #dbeafe;
  color: #1e40af;
}

.pin-priority-high {
  background: #fef3c7;
  color: #92400e;
}

.pin-priority-critical {
  background: #fee2e2;
  color: #991b1b;
}

/* Note cell — wraps text, truncates with hover expand */
.pin-note-cell {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  cursor: default;
  transition: max-height 0.2s, white-space 0.15s;
}

.pin-note-cell:hover {
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}

/* Compact square action buttons */
.pin-actions-cell {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pin-action-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  color: var(--fg);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s;
}

.pin-action-btn:hover {
  background: var(--soft);
  border-color: var(--muted);
}

.pin-action-complete {
  color: #16a34a;
}

.pin-action-complete:hover {
  background: #d1fae5;
  border-color: #16a34a;
}

.pin-action-delete {
  color: #dc2626;
}

.pin-action-delete:hover {
  background: #fee2e2;
  border-color: #dc2626;
}

/* ── Pin Annotation Popover ────────────────────────────────────────────
 * Inline card that appears at the click position inside the preview
 * frame when the user places a pin. Contains a textarea + action buttons.
 * ──────────────────────────────────────────────────────────────────── */
.pin-annotation-popover {
  position: absolute;
  z-index: 30;
  width: 260px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  padding: 10px;
  transform: translate(-50%, 8px);
}

.pin-annotation-text {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 0.82rem;
  resize: vertical;
  min-height: 54px;
  background: var(--bg);
  color: var(--fg);
  font-family: inherit;
}

.pin-annotation-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 6px;
}

/* ── Snapshot Image Thumbnail ──────────────────────────────────────── */
.pin-snapshot-img {
  display: block;
  width: 48px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  float: left;
  margin-right: 8px;
  margin-bottom: 2px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.pin-snapshot-img:hover {
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.35);
}

/* ── Markup Editor Overlay ─────────────────────────────────────────────
 * Fullscreen overlay with a toolbar and dual-canvas for drawing
 * annotations on pin snapshots.
 * ──────────────────────────────────────────────────────────────────── */
.markup-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
}

.markup-editor {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
}

.markup-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--soft);
  border-bottom: 1px solid var(--border);
}

.markup-spacer {
  flex: 1;
}

.markup-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 8px;
  transition: background 0.12s, border-color 0.12s;
}

.markup-tool:hover {
  background: var(--soft);
}

.markup-tool.active {
  background: var(--accent, #3b82f6);
  color: #fff;
  border-color: var(--accent, #3b82f6);
}

.markup-save {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
  font-weight: 600;
}

.markup-save:hover {
  background: #15803d;
}

.markup-cancel {
  color: #dc2626;
}

.markup-cancel:hover {
  background: #fee2e2;
  border-color: #dc2626;
}

.markup-color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.markup-canvas-wrap {
  position: relative;
  overflow: auto;
  max-height: calc(95vh - 54px);
}

.markup-canvas-bg {
  display: block;
}

.markup-canvas-draw {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
}

.resource-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.resource-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--bg);
  margin-bottom: 10px;
}

.resource-title {
  font-weight: 600;
  color: var(--fg);
}

.resource-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.resource-body {
  margin-top: 8px;
}

.resource-list audio {
  width: 100%;
}

.resource-media {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* --- Preview panel --- */
.preview-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.preview-config {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.preview-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}
.preview-label input.search {
  flex: 1;
  min-width: 0;
}

.preview-frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  background: var(--soft);
  min-height: 220px;
  height: 320px;
  resize: vertical;
}

/* Visual grab-bar indicator on the resize handle */
.preview-frame::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  opacity: 0.6;
  pointer-events: none;
}

.preview-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.preview-empty {
  padding: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.03);
  cursor: crosshair;
}

.preview-pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.preview-pin {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
  transform: translate(-50%, -50%);
}

.preview-notes {
  margin-top: 12px;
}

.preview-note {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
  align-items: start;
}

.preview-note:first-child {
  border-top: none;
}

.preview-note-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.preview-note-text {
  font-size: 0.85rem;
  color: var(--fg);
}

/* --- Job completion output --- */
.job-completion {
  border-top: 1px solid var(--border);
  margin-top: 10px;
  padding-top: 10px;
}

.job-completion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.job-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--bg);
}

.job-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.job-pre {
  white-space: pre-wrap;
  margin: 0;
  font-size: 12px;
  max-height: 260px;
  overflow: auto;
}

.artifact-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.artifact-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  border-top: 1px dashed var(--border);
  padding-top: 6px;
}

.gpu-pill {
  min-width: 92px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gpu-pill-label {
  font-size: 11px;
}

.gpu-pill-line {
  font-size: 11px;
}

.wd-doc-item {
  text-align: left;
  justify-content: flex-start;
  width: 100%;
  margin-bottom: 6px;
}

.wd-doc-item-active {
  background: var(--soft);
}

.wd-pane-list {
  grid-column: span 3;
  max-height: 260px;
  overflow: auto;
  border-right: 1px solid var(--border);
  padding-right: 8px;
}

.wd-pane-editor {
  grid-column: span 9;
  padding-left: 8px;
  min-width: 0;
}

.wd-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  background: var(--soft);
  color: var(--fg);
}

.wd-textarea {
  width: 100%;
  min-height: 220px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--soft);
  color: var(--fg);
}

/* ─── File Manager ───────────────────────────────────────────────────────────
 * Styles for the Project File Manager (renderWorkingDocs in _05d_views.js).
 * Replaces the old "Working Docs" editor with a split-pane file manager.
 *
 * Layout:
 *   .fm-categories     — Horizontal pill button bar for category filtering
 *     .fm-category-btn — Individual category pill (active state = blue fill)
 *     .fm-category-count — Badge showing file count per category
 *   .fm-layout         — CSS Grid split: 280px file list | 1fr viewer
 *     .fm-file-list    — Left pane: scrollable list of file items
 *       .fm-file-item  — Single file row (icon + name + date)
 *     .fm-viewer       — Right pane: read-only content or edit form
 *       .fm-viewer-header  — File title bar with edit/read-only toggle
 *       .fm-viewer-body    — Read-only content area
 *       .fm-rendered-body  — Pre-formatted text display
 *       .fm-viewer-empty   — Centered empty state (📂 icon + message)
 *
 * Responsive: At <768px, layout stacks vertically (file list on top).
 * ──────────────────────────────────────────────────────────────────────────── */
/* File Manager */
.fm-categories {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.fm-category-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}

.fm-category-btn:hover {
  background: var(--soft);
  color: var(--fg);
}

.fm-category-btn.active {
  background: var(--accent, #3b82f6);
  color: #fff;
  border-color: var(--accent, #3b82f6);
}

.fm-category-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 0 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}

.fm-category-btn:not(.active) .fm-category-count {
  background: var(--soft);
}

.fm-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  min-height: 300px;
}

.fm-file-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: 400px;
  background: var(--soft);
}

.fm-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.fm-file-item:hover {
  background: var(--card);
}

.fm-file-item-active {
  background: var(--card);
  border-left: 3px solid var(--accent, #3b82f6);
}

.fm-file-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.fm-file-info {
  min-width: 0;
  flex: 1;
}

.fm-file-name {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fm-file-date {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

.fm-viewer {
  padding: 14px;
  overflow-y: auto;
  max-height: 400px;
}

.fm-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.fm-viewer-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.fm-viewer-body {
  padding: 8px 0;
}

.fm-rendered-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--fg);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
}

.fm-viewer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  gap: 8px;
}

.fm-viewer-empty-icon {
  font-size: 2.5rem;
  opacity: 0.4;
}

/* ── Context menu (⋯) on file items ── */
.fm-file-item {
  position: relative;
}

.fm-ctx-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.fm-file-item:hover .fm-ctx-btn,
.fm-file-item-active .fm-ctx-btn {
  opacity: 1;
}

.fm-ctx-btn:hover {
  background: var(--soft);
  color: var(--fg);
}

.fm-ctx-menu {
  position: absolute;
  right: 4px;
  top: 100%;
  z-index: 50;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  min-width: 160px;
  padding: 4px 0;
  font-size: 0.8rem;
}

.fm-ctx-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--fg);
  transition: background 0.1s;
}

.fm-ctx-menu-item:hover {
  background: var(--soft);
}

.fm-ctx-menu-item.danger {
  color: var(--danger, #ef4444);
}

.fm-ctx-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

.fm-ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Save button + flash ── */
.fm-save-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.fm-save-flash {
  font-size: 0.78rem;
  color: var(--success, #22c55e);
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s;
}

.fm-save-flash.show {
  opacity: 1;
}

/* ── Markdown rendered body ── */
.fm-md h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.fm-md h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 14px 0 6px;
}

.fm-md h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 12px 0 4px;
}

.fm-md p {
  margin: 6px 0;
  line-height: 1.65;
}

.fm-md code {
  background: var(--soft);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.82em;
}

.fm-md pre {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
  line-height: 1.5;
}

.fm-md pre code {
  background: none;
  padding: 0;
}

.fm-md blockquote {
  border-left: 3px solid var(--accent, #3b82f6);
  margin: 8px 0;
  padding: 4px 12px;
  color: var(--muted);
  font-style: italic;
}

.fm-md ul,
.fm-md ol {
  padding-left: 20px;
  margin: 6px 0;
}

.fm-md li {
  margin: 3px 0;
  line-height: 1.55;
}

.fm-md hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.fm-md a {
  color: var(--accent, #3b82f6);
  text-decoration: underline;
}

.fm-md strong {
  font-weight: 600;
}

.fm-md em {
  font-style: italic;
}

/* ── File type badge ── */
.fm-type-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  background: var(--soft);
  color: var(--muted);
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Confirmation dialog overlay ── */
.fm-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fm-confirm-dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.fm-confirm-dialog h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.fm-confirm-dialog p {
  margin: 0 0 16px;
  font-size: 0.84rem;
  color: var(--muted);
}

.fm-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .fm-layout {
    grid-template-columns: 1fr;
  }

  .fm-file-list {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 320px;
  }
}

@media (max-width: 1100px) {

  .chat-layout {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 260px);
    grid-template-rows: 1fr;
    height: calc(100vh - 160px);
    min-height: 300px;
  }

  .chat-sidebar {
    display: none;
  }

  .chat-sidebar-expand {
    display: flex !important;
  }

  .chat-header-bar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .chat-header-right {
    flex-basis: 100%;
  }

  .chat-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }

  .chat-main-shell {
    min-height: 0;
    flex: 1 1 auto;
  }

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

  .chat-condition-row {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .panel-half-card {
    grid-column: span 12;
  }
}

@media (max-width: 900px) {

  .search.control-w-120,
  .search.control-w-130,
  .search.control-w-140,
  .search.control-w-150,
  .search.control-w-170,
  .search.control-w-180,
  .search.control-w-220 {
    width: 100%;
  }

  .search.control-min-220,
  .search.control-min-250,
  .search.control-min-260,
  .search.control-min-540 {
    min-width: 0;
    width: 100%;
  }

  .control-row-end {
    justify-content: flex-start;
  }

  .preview-note {
    grid-template-columns: 1fr;
  }

  .wd-pane-list,
  .wd-pane-editor {
    grid-column: span 12;
    border-right: 0;
    padding-right: 0;
    padding-left: 0;
  }
}


/* ══════════════════════════════════════════════════════════════════════════
 * PREMIUM ANALYTICS DASHBOARD — Design System
 * ══════════════════════════════════════════════════════════════════════════ */

/* ── Analytics Color Tokens ─────────────────────────────────────────────── */
:root {
  --an-cyan: #06b6d4;
  --an-emerald: #10b981;
  --an-amber: #f59e0b;
  --an-red: #ef4444;
  --an-violet: #8b5cf6;
  --an-blue: #3b82f6;
  --an-pink: #ec4899;
  --an-slate: #64748b;
  --an-card-glow: rgba(6, 182, 212, 0.04);
  --an-grid-line: rgba(148, 163, 184, 0.08);
  --an-surface: var(--soft);
}

body[data-theme="dark"] {
  --an-card-glow: rgba(6, 182, 212, 0.10);
  --an-grid-line: rgba(148, 163, 184, 0.06);
  --an-surface: #1E3859;
}

/* ── Section Header ─────────────────────────────────────────────────────── */
.an-section-hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.an-section-hdr h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.an-section-hdr .an-section-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.an-section-hdr .an-hdr-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ── Stat Cards Row ─────────────────────────────────────────────────────── */
.an-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.an-stat-card {
  background: var(--an-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  animation: fadeSlideUp 0.35s ease both;
}

.an-stat-card:hover {
  border-color: var(--an-cyan);
  box-shadow: 0 0 0 1px var(--an-card-glow), 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

body[data-theme="dark"] .an-stat-card {
  background: rgba(25, 42, 64, 0.85);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-color: rgba(30, 56, 89, 0.50);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

body[data-theme="dark"] .an-stat-card:hover {
  border-color: rgba(6, 182, 212, 0.30);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.08);
  transform: translateY(-2px);
}

.an-stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--an-accent, var(--an-cyan));
}

.an-stat-card[data-accent="emerald"] {
  --an-accent: var(--an-emerald);
}

.an-stat-card[data-accent="amber"] {
  --an-accent: var(--an-amber);
}

.an-stat-card[data-accent="red"] {
  --an-accent: var(--an-red);
}

.an-stat-card[data-accent="violet"] {
  --an-accent: var(--an-violet);
}

.an-stat-card[data-accent="blue"] {
  --an-accent: var(--an-blue);
}

.an-stat-card[data-accent="pink"] {
  --an-accent: var(--an-pink);
}

.an-stat-card[data-accent="slate"] {
  --an-accent: var(--an-slate);
}

.an-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.an-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--an-accent, var(--fg));
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.an-stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.an-stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
}

.an-stat-trend.up {
  color: var(--an-emerald);
}

.an-stat-trend.down {
  color: var(--an-red);
}

.an-stat-trend.flat {
  color: var(--muted);
}

/* ── Chart Container ────────────────────────────────────────────────────── */
.an-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.an-chart-box {
  background: var(--an-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px 12px;
  position: relative;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  animation: fadeSlideUp 0.35s ease both;
}

.an-chart-box:hover {
  border-color: rgba(6, 182, 212, 0.2);
}

body[data-theme="dark"] .an-chart-box {
  background: rgba(25, 42, 64, 0.80);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-color: rgba(30, 56, 89, 0.50);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

body[data-theme="dark"] .an-chart-box:hover {
  border-color: rgba(6, 182, 212, 0.30);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.08);
}

.an-chart-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.an-chart-canvas-wrap {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 120px;
}

.an-chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.an-chart-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.an-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
}

.an-chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.an-chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.an-chart-tooltip.visible {
  opacity: 1;
}

/* ── Health Composite Panels ────────────────────────────────────────────── */
.an-health-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 330px;
  gap: 14px;
  margin-bottom: 0;
}

.an-health-panel {
  background: var(--an-surface);
  border: 0.5px solid turquoise;
  border-left: 4px solid var(--an-accent, var(--an-cyan));
  border-radius: 16px;
  padding: 14px 16px 10px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  animation: fadeSlideUp 0.35s ease both;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.an-health-panel[data-accent="emerald"] {
  --an-accent: var(--an-emerald);
}

.an-health-panel[data-accent="pink"] {
  --an-accent: var(--an-pink);
}

.an-health-panel[data-accent="violet"] {
  --an-accent: var(--an-violet);
}

.an-health-panel[data-accent="cyan"] {
  --an-accent: var(--an-cyan);
}

.an-health-panel[data-accent="amber"] {
  --an-accent: var(--an-amber);
}

.an-health-panel[data-accent="red"] {
  --an-accent: var(--an-red);
}

.an-health-panel[data-accent="blue"] {
  --an-accent: var(--an-blue);
}

.an-health-panel[data-accent="slate"] {
  --an-accent: var(--an-slate);
}

.an-health-panel:hover {
  border-color: rgba(6, 182, 212, 0.2);
}

body[data-theme="dark"] .an-health-panel {
  background: rgba(25, 42, 64, 0.80);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-color: rgba(30, 56, 89, 0.50);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

body[data-theme="dark"] .an-health-panel:hover {
  border-color: rgba(6, 182, 212, 0.30);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.08);
}

.an-health-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: 0.02em;
}

.an-health-panel-inner {
  display: flex;
  gap: 14px;
  min-height: 0;
  flex: 1 1 auto;
}

.an-health-chart-col {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.an-health-chart-note {
  font-size: 10px;
  color: var(--muted);
  padding-top: 4px;
  min-height: 14px;
  margin-top: auto;
}

.an-health-chart-col .an-chart-box {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  animation: none;
}

.an-health-chart-col .an-chart-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-theme="dark"] .an-health-chart-col .an-chart-box {
  background: transparent;
  border: none;
  box-shadow: none;
}

body[data-theme="dark"] .an-health-chart-col .an-chart-box:hover {
  border: none;
  box-shadow: none;
}

.an-health-chart-col .an-chart-title {
  display: none;
}

/* ── Compact process tables inside health panels ─── */
.an-health-panel .an-table-wrap {
  font-size: 11px;
}

.an-health-panel .an-table-toolbar {
  padding: 4px 6px;
}

.an-health-panel .an-table-title {
  font-size: 11px;
}

.an-health-panel table th,
.an-health-panel table td,
.an-health-tongue table th,
.an-health-tongue table td {
  padding: 0 6px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 18px;
}

.an-health-panel .an-table-footer,
.an-health-tongue .an-table-footer {
  padding: 2px 6px;
  font-size: 10px;
}

/* Scroll instead of paginate inside health panels + tongues */
.an-health-panel .an-table-wrap table,
.an-health-tongue .an-table-wrap table {
  display: block;
}

.an-health-panel .an-table-wrap thead,
.an-health-panel .an-table-wrap tbody,
.an-health-panel .an-table-wrap tr,
.an-health-tongue .an-table-wrap thead,
.an-health-tongue .an-table-wrap tbody,
.an-health-tongue .an-table-wrap tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.an-health-panel .an-table-wrap tbody,
.an-health-tongue .an-table-wrap tbody {
  display: block;
  max-height: 260px;
  overflow-y: auto;
}

.an-health-panel .an-table-wrap tbody tr,
.an-health-tongue .an-table-wrap tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.an-health-panel .an-table-pager,
.an-health-tongue .an-table-pager {
  display: none;
}

/* Data Feeds table: let tbody handle scroll, no wrapper scroll */
#serverDataFeedsTable .an-table-wrap {
  overflow: visible;
}

#serverDataFeedsTable table {
  font-size: 11px;
  line-height: 18px;
}

#serverDataFeedsTable th,
#serverDataFeedsTable td {
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.an-health-info-col {
  flex: 0 0 auto;
  width: 340px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
  gap: 8px;
}

.an-health-info-col .an-stat-card {
  margin: 0;
  padding: 6px 0 4px;
  border-radius: 0;
  flex-shrink: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.an-health-info-col .an-stat-card::before {
  display: none;
}

.an-health-info-col .an-stat-card:hover {
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

body[data-theme="dark"] .an-health-info-col .an-stat-card {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body[data-theme="dark"] .an-health-info-col .an-stat-card:hover {
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.an-health-info-col .an-stat-value {
  font-size: 22px;
}

.an-health-info-col .an-stat-sub {
  font-size: 10px;
  line-height: 1.35;
}

.an-health-info-col .tbl-wrap {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 11px;
}

.an-health-info-col .tbl-wrap .an-table-hdr {
  display: none;
}

.an-health-info-col .tbl-wrap .tbl {
  font-size: 11px;
}

.an-health-info-col .tbl-wrap .tbl th {
  font-size: 10px;
  padding: 3px 6px;
}

.an-health-info-col .tbl-wrap .tbl td {
  font-size: 10.5px;
  padding: 3px 6px;
}

.an-health-info-col .tbl-wrap .tbl-pagination {
  display: none;
}

/* ── Compact stat cards inside AI & Agents ──────────────── */
#aiaGrid .an-health-panel .an-stat-card {
  padding: 10px 14px;
  border-radius: 10px;
}

#aiaGrid .an-health-panel .an-stat-card .an-stat-value {
  font-size: 16px;
}

#aiaGrid .an-health-panel .an-stat-card .an-stat-sub {
  font-size: 10px;
  line-height: 1.35;
}

#aiaGrid .an-health-panel .an-stat-card .an-stat-label {
  font-size: 10px;
}

body[data-theme="dark"] #aiaGrid .an-health-panel .an-stat-card {
  border-color: rgba(30, 56, 89, 0.50);
}

/* ── AI & Agents responsive layout ──────────────────────── */
@media (max-width: 900px) {
  #aiaGrid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Agents Card Tabs (per-project) ─────────────────────── */
.an-agents-tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.an-agent-tab {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.an-agent-tab:hover {
  color: var(--fg);
}

.an-agent-tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent, #06b6d4);
}

.an-agent-tab .pill-count {
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
  opacity: 0.7;
}

.an-agents-api-strip {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.an-agents-api-strip .an-stat-card {
  padding: 6px 10px;
  font-size: 12px;
  min-width: 0;
  flex: 1;
}

.an-agents-api-strip .an-stat-card .an-stat-sub {
  font-size: 11px;
}

.an-heartbeat-scroll {
  max-height: 210px;
  overflow-y: auto;
  border-radius: 8px;
}

.an-heartbeat-scroll::-webkit-scrollbar {
  width: 4px;
}

.an-heartbeat-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.an-agents-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .an-agents-stat-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Execution Breakdown Bar (Metrics tab) ─────────────── */
.an-exec-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--border);
  gap: 1px;
}

.an-exec-seg {
  min-width: 2px;
  transition: width 0.4s ease;
}

.an-exec-mgr {
  background: var(--an-cyan, #06b6d4);
}

.an-exec-wrk {
  background: var(--an-emerald, #10b981);
}

.an-exec-wat {
  background: var(--an-amber, #f59e0b);
}

.an-agents-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.an-agents-detail-grid .detail-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  padding: 4px 0;
}

.an-agents-detail-grid .detail-item .detail-label {
  color: var(--muted);
  font-size: 11px;
  min-width: 70px;
}

.an-agents-detail-grid .detail-item .detail-value {
  color: var(--fg);
  font-weight: 500;
}

/* ── Fan speed indicators inside Thermal panel ──────────── */
.an-health-fans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
  justify-items: center;
}

.an-fan-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 6px;
  border-radius: 8px;
  background: rgba(30, 56, 89, 0.25);
  border: 1px solid transparent;
  transition: border-color 0.2s;
  min-width: 60px;
}

body[data-theme="dark"] .an-fan-icon {
  background: rgba(30, 56, 89, 0.4);
}

.an-fan-icon:hover {
  border-color: rgba(6, 182, 212, 0.3);
}

.an-fan-icon .fan-blade {
  font-size: 28px;
  line-height: 1;
}

.an-fan-icon .fan-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
}

.an-fan-icon .fan-label {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
  text-align: center;
}

.an-fan-icon.fan-off .fan-blade {
  color: #64748b;
}

.an-fan-icon.fan-low .fan-blade {
  color: #06b6d4;
}

.an-fan-icon.fan-mid .fan-blade {
  color: #f59e0b;
}

.an-fan-icon.fan-high .fan-blade {
  color: #ef4444;
}

/* ── Tongue tabs below grid (GPU dials left, Data Feeds right) ── */
.an-health-tongues {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 0;
  margin-bottom: 16px;
}

.an-health-tongue {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.an-health-tongue-body {
  width: 90%;
  background: var(--an-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  padding: 10px 12px 8px;
  overflow: hidden;
  max-height: 400px;
  transition: max-height 0.35s ease, padding 0.35s ease, opacity 0.25s ease;
  opacity: 1;
}

.an-health-tongue.collapsed .an-health-tongue-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

.an-health-tongue-handle {
  width: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 0;
  background: var(--an-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  cursor: pointer;
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s ease, background 0.2s ease;
  user-select: none;
}

.an-health-tongue-handle:hover {
  color: var(--text);
  background: var(--an-surface-hover, var(--an-surface));
}

.an-health-tongue-handle .chevron {
  display: inline-block;
  transition: transform 0.35s ease;
  font-size: 8px;
}

.an-health-tongue.collapsed .an-health-tongue-handle {
  border-radius: 0 0 10px 10px;
}

.an-health-tongue.collapsed .an-health-tongue-handle .chevron {
  transform: rotate(180deg);
}

body[data-theme="dark"] .an-health-tongue-body {
  background: rgba(25, 42, 64, 0.60);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-color: rgba(30, 56, 89, 0.50);
}

body[data-theme="dark"] .an-health-tongue-handle {
  background: rgba(25, 42, 64, 0.50);
  border-color: rgba(30, 56, 89, 0.50);
}

.an-health-tongue .an-dial-row {
  margin-bottom: 0;
}

/* Data Feeds tongue – compact */
.an-health-tongue .tbl-wrap {
  font-size: 10px;
  max-height: 130px;
  overflow-y: auto;
}

.an-health-tongue .tbl-wrap .tbl th {
  font-size: 9px;
  padding: 3px 5px;
  white-space: nowrap;
}

.an-health-tongue .tbl-wrap .tbl td {
  font-size: 9.5px;
  padding: 3px 5px;
}

.an-health-tongue .tbl-wrap .tbl-pagination {
  font-size: 9px;
  padding: 3px 0;
}

.an-health-tongue .an-table-search {
  font-size: 9px;
  padding: 3px 6px;
  height: 22px;
}

/* ── Radial Dials ───────────────────────────────────────────────────────── */
.an-dial-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, 88px);
  gap: 10px;
  margin-bottom: 16px;
  justify-content: center;
}

.an-dial {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: var(--an-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.an-dial:hover {
  border-color: var(--an-cyan);
}

body[data-theme="dark"] .an-dial {
  background: rgba(25, 42, 64, 0.75);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-color: rgba(30, 56, 89, 0.50);
}

body[data-theme="dark"] .an-dial:hover {
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.1);
}

.an-dial svg {
  width: 64px;
  height: 64px;
}

.an-dial-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
  stroke-linecap: round;
}

.an-dial-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s ease;
  filter: drop-shadow(0 0 6px var(--an-dial-color, var(--an-cyan)));
}

.an-dial-value-text {
  font-size: 13px;
  font-weight: 700;
  fill: var(--fg);
  text-anchor: middle;
  dominant-baseline: central;
  font-variant-numeric: tabular-nums;
}

.an-dial-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--fg);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.an-dial-sub {
  font-size: 8px;
  color: var(--muted);
  text-align: center;
}

/* ── Paginated Table ────────────────────────────────────────────────────── */
.an-table-wrap {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}

.an-table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--an-surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.an-table-toolbar .an-table-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-right: auto;
}

.an-table-search {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  font-size: 12px;
  width: 180px;
  max-width: 100%;
}

.an-table-search::placeholder {
  color: var(--muted);
}

.an-table-wrap table {
  border-collapse: collapse;
  width: 100%;
}

.an-table-wrap thead th {
  background: var(--an-surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.an-table-wrap thead th:hover {
  color: var(--fg);
}

.an-table-wrap thead th.sorted-asc::after {
  content: ' ▲';
  font-size: 9px;
}

.an-table-wrap thead th.sorted-desc::after {
  content: ' ▼';
  font-size: 9px;
}

.an-table-wrap tbody td {
  padding: 8px 10px;
  font-size: 12px;
  border-top: 1px solid var(--border);
}

.an-table-wrap tbody tr:nth-child(even) {
  background: var(--an-surface);
}

.an-table-wrap tbody tr:hover {
  background: var(--an-card-glow);
}

.an-table-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--an-surface);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.an-table-pager .an-pager-info {
  margin-right: auto;
}

.an-table-pager button {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
  font-size: 12px;
  cursor: pointer;
}

.an-table-pager button:hover:not(:disabled) {
  background: var(--badge);
}

.an-table-pager button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.an-table-pager .an-pager-jump {
  width: 48px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
  font-size: 12px;
  text-align: center;
}

/* ── Live Pulse Animation ───────────────────────────────────────────────── */
@keyframes anPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.an-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--an-emerald);
  animation: anPulse 2s ease-in-out infinite;
  margin-right: 6px;
  vertical-align: middle;
}

.an-live-dot.offline {
  background: var(--an-red);
  animation: none;
}

.an-live-dot.warn {
  background: var(--an-amber);
}

/* ── Sparkline Inline ───────────────────────────────────────────────────── */
.an-sparkline {
  display: inline-block;
  vertical-align: middle;
  height: 24px;
}

.an-sparkline svg {
  height: 100%;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .an-chart-grid {
    grid-template-columns: 1fr;
  }

  .an-health-grid {
    grid-template-columns: 1fr;
  }

  .an-health-tongues {
    grid-template-columns: 1fr;
  }

  .an-stat-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .an-dial-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .an-table-search {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .an-stat-row {
    grid-template-columns: 1fr;
  }

  .an-health-panel-inner {
    flex-direction: column;
  }

  .an-dial-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Research Watchtower ─────────────────────────────────────────────── */
.research-tag {
  display: inline-block;
  background: var(--badge);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  color: var(--muted);
  margin-right: 3px;
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.research-news-item {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.research-news-item:hover {
  border-color: var(--primary);
  background: var(--card);
}

.research-doc-row {
  cursor: pointer;
  transition: background 0.1s ease;
}

.research-doc-row:hover {
  background: rgba(6, 182, 212, 0.04);
}

/* Active Research progress bar */
.rp-progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.rp-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

.rp-progress-animate {
  background-image: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.3) 50%,
      transparent 100%);
  background-size: 200% 100%;
  animation: rp-shimmer 1.5s ease-in-out infinite;
}

@keyframes rp-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Depth badge */
.rp-depth-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dc) 12%, transparent);
  color: var(--dc);
  border: 1px solid color-mix(in srgb, var(--dc) 25%, transparent);
  white-space: nowrap;
}

@media (max-width: 768px) {
  [data-sec="research"] [style*="grid-template-columns:1fr 300px"] {
    grid-template-columns: 1fr !important;
  }

  [data-sec="research"] [style*="grid-template-columns:1fr 1fr auto"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── Custom narrow tooltips for quick action buttons ────────────────────── */
.manager-action-btn {
  position: relative;
}

.manager-action-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  max-width: 200px;
  width: max-content;
  padding: 8px 10px;
  background: var(--an-surface, #1e293b);
  color: var(--fg, #e2e8f0);
  border: 1px solid var(--border, #334155);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-line;
  word-wrap: break-word;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Ensure tooltip doesn't overflow right edge — flip below on mobile */
@media (max-width: 600px) {
  .manager-action-btn[data-tip]:hover::after {
    left: auto;
    right: 0;
    top: 100%;
    transform: none;
    margin-left: 0;
    margin-top: 6px;
  }
}

/* ── Break Enforcement Clocks ─────────────────────────────────────── */
.break-clock {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.02em;
  line-height: 1.4;
  vertical-align: middle;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.4s, color 0.4s;
}

.break-clock[data-mode="countdown"] {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.break-clock[data-mode="break"] {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  animation: break-pulse 2s ease-in-out infinite;
}

@keyframes break-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* VP dock variant — slightly smaller */
.break-clock--dock {
  font-size: 10px;
  padding: 1px 6px;
  margin-left: 6px;
}

/* Chat header variant */
.break-clock--chat {
  margin-right: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   QC Interactive UI — Pipeline Stepper, AI Output, Progress, Animations
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Pipeline Stepper ──────────────────────────────────────────────────── */
.qc-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 16px;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.qc-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.3s ease;
  color: var(--muted);
  background: transparent;
}

.qc-step-connector {
  width: 28px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.4s ease;
}

.qc-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.qc-step.done .qc-step-dot {
  background: var(--success);
  border-color: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.qc-step.done {
  color: var(--success);
}

.qc-step.done+.qc-step-connector {
  background: var(--success);
}

.qc-step.active .qc-step-dot {
  background: #3b82f6;
  border-color: #3b82f6;
  animation: qcPulse 1.8s ease-in-out infinite;
}

.qc-step.active {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

.qc-step.error .qc-step-dot {
  background: var(--danger);
  border-color: var(--danger);
  animation: qcPulse 1.2s ease-in-out infinite;
}

.qc-step.error {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

@keyframes qcPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
  }
}

/* ── AI Output Terminal ────────────────────────────────────────────────── */
.qc-ai-output {
  background: #0f172a;
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 10px;
  padding: 12px 14px;
  flex: 1;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11px;
  line-height: 1.7;
  color: #94a3b8;
  scrollbar-width: thin;
  position: relative;
}

body[data-theme="dark"] .qc-ai-output {
  background: #050d1a;
  border-color: rgba(59, 130, 246, 0.15);
}

.qc-ai-output .qc-ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.qc-ai-output .qc-ai-header strong {
  color: #60a5fa;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.qc-ai-output .qc-ai-header .qc-ai-live {
  font-size: 9px;
  color: #10b981;
  text-transform: uppercase;
  letter-spacing: 1px;
  animation: qcLiveBlink 2s ease-in-out infinite;
}

@keyframes qcLiveBlink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.qc-ai-line {
  animation: qcSlideIn 0.3s ease-out;
  padding: 2px 0;
}

@keyframes qcSlideIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.qc-ai-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: #60a5fa;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: qcBlink 1s step-end infinite;
}

@keyframes qcBlink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* Provider progress chips */
.qc-provider-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  margin: 2px 3px;
}

.qc-provider-chip.pending {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.qc-provider-chip.running {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  animation: qcChipPulse 1.5s ease-in-out infinite;
}

.qc-provider-chip.pass {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.qc-provider-chip.fail {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Keep provider chips bar pinned at top of scrollable AI Output terminal */
[data-provider-chips] {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0f172a;
  padding: 4px 0 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  margin-bottom: 4px;
}

body[data-theme="dark"] [data-provider-chips] {
  background: #050d1a;
}

@keyframes qcChipPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* ── Progress Bars ─────────────────────────────────────────────────────── */
.qc-progress-wrap {
  background: var(--badge);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  width: 100%;
  margin: 6px 0;
}

.qc-progress-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
  position: relative;
  overflow: hidden;
}

.qc-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: qcShimmer 2s infinite;
}

@keyframes qcShimmer {
  from {
    left: -100%;
  }

  to {
    left: 100%;
  }
}

.qc-progress-bar.approved {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.qc-progress-bar.staged {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.qc-progress-bar.rejected {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.qc-progress-bar.merged {
  background: linear-gradient(90deg, #6b7280, #9ca3af);
}

/* ── Live Counter ──────────────────────────────────────────────────────── */
.qc-counter {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  background: var(--badge);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.qc-counter .qc-count-value {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 14px;
  text-align: center;
}

.qc-counter.highlight {
  animation: qcCountBounce 0.4s ease;
}

@keyframes qcCountBounce {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

.qc-counter.blue {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.25);
  background: rgba(59, 130, 246, 0.06);
}

.qc-counter.green {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.06);
}

.qc-counter.red {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.06);
}

.qc-counter.gray {
  color: var(--muted);
}

.qc-counter.amber {
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.25);
  background: rgba(217, 119, 6, 0.06);
}

/* ── Activity Feed Entries ─────────────────────────────────────────────── */
.qc-feed-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 10px;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  margin: 2px 0;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  line-height: 1.5;
  animation: qcSlideIn 0.3s ease-out;
  transition: background 0.2s ease;
}

.qc-feed-entry:hover {
  background: rgba(59, 130, 246, 0.04);
}

.qc-feed-entry.approve {
  border-left-color: #10b981;
}

.qc-feed-entry.reject {
  border-left-color: #ef4444;
}

.qc-feed-entry.comment {
  border-left-color: #d97706;
}

.qc-feed-entry.info {
  border-left-color: #3b82f6;
}

.qc-feed-entry .qc-feed-ts {
  color: var(--muted);
  font-size: 10px;
  flex-shrink: 0;
  min-width: 55px;
}

/* ── Agent Status Panel ────────────────────────────────────────────────── */
.qc-agent-panel {
  padding: 8px 10px;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.qc-agent-panel .qc-agent-title {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Compact health badges for QC left panel */
.qc-health-compact {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.qc-health-compact .status-badge,
.qc-health-compact .pill {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
}

.qc-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.qc-status-dot.online {
  background: #10b981;
  box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
}

.qc-status-dot.offline {
  background: #6b7280;
}

.qc-status-dot.active {
  background: #3b82f6;
  animation: qcPulse 1.8s ease-in-out infinite;
}

/* ─── QC Split Layout (side-by-side panels) ─────────────────────────────── */
.qc-split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
  min-height: 500px;
  max-height: calc(100vh - 300px);
}

.qc-left-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.qc-right-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.qc-left-panel .qc-ai-output {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.qc-left-panel .qc-ai-output #qc-ai-entries-console,
.qc-left-panel .qc-ai-output [id^="qc-ai-entries-"] {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
}

@media (max-width: 900px) {
  .qc-split-layout {
    grid-template-columns: 1fr;
  }

  .qc-left-panel {
    max-height: none;
  }

  .qc-left-panel .qc-ai-output {
    min-height: 300px;
  }
}
/* ═══════════════════════════════════════════════════════
   Chat Markdown Rendering Styles
   ═══════════════════════════════════════════════════════ */

/* -- Code blocks -- */
.msg-text pre {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  margin: 8px 0;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}

.msg-text pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
  color: #cdd6f4;
}

/* -- Inline code -- */
.msg-text code {
  background: rgba(139, 148, 186, 0.15);
  color: #cba6f7;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9em;
}

/* -- Lists inside chat -- */
.msg-text ul, .msg-text ol {
  margin: 6px 0;
  padding-left: 24px;
}

.msg-text li {
  margin: 3px 0;
  line-height: 1.5;
}

.msg-text ul li {
  list-style: disc;
}

/* -- Task list checkboxes (GFM) -- */
.msg-text li input[type="checkbox"] {
  margin-right: 6px;
  accent-color: #a6e3a1;
  pointer-events: none;  /* read-only display */
}

/* -- Tables inside chat -- */
.msg-text table {
  border-collapse: collapse;
  margin: 8px 0;
  width: 100%;
  font-size: 13px;
}

.msg-text th, .msg-text td {
  border: 1px solid rgba(255,255,255,0.12);
  padding: 6px 10px;
  text-align: left;
}

.msg-text th {
  background: rgba(139, 148, 186, 0.12);
  font-weight: 600;
}

/* -- Bold and emphasis -- */
.msg-text strong {
  font-weight: 600;
  color: #f5c2e7;
}

.msg-text em {
  font-style: italic;
  color: #94e2d5;
}

/* -- Blockquotes -- */
.msg-text blockquote {
  border-left: 3px solid #89b4fa;
  margin: 8px 0;
  padding: 4px 12px;
  color: rgba(205, 214, 244, 0.8);
  background: rgba(137, 180, 250, 0.06);
  border-radius: 0 4px 4px 0;
}

/* -- Headers inside chat (h1-h3 only, compact) -- */
.msg-text h1, .msg-text h2, .msg-text h3 {
  margin: 10px 0 4px;
  font-weight: 600;
  line-height: 1.3;
}
.msg-text h1 { font-size: 1.15em; color: #89b4fa; }
.msg-text h2 { font-size: 1.08em; color: #89b4fa; }
.msg-text h3 { font-size: 1.02em; color: #a6adc8; }

/* Hide h4-h6 (these are the template garbage) */
.msg-text h4, .msg-text h5, .msg-text h6 {
  font-size: 0.95em;
  font-weight: 600;
  margin: 6px 0 2px;
  color: #a6adc8;
}

/* -- Horizontal rules -- */
.msg-text hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 10px 0;
}

/* -- Paragraphs (tighten spacing for chat) -- */
.msg-text p {
  margin: 4px 0;
}

/* -- Links -- */
.msg-text a {
  color: #89b4fa;
  text-decoration: underline;
  text-decoration-color: rgba(137, 180, 250, 0.4);
}

.msg-text a:hover {
  text-decoration-color: #89b4fa;
}

/* -- Copy button for code blocks (added via JS post-render) -- */
.code-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  color: #a6adc8;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.msg-text pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #cdd6f4;
}

/* -- Light theme overrides -- */
body:not([data-theme="dark"]) .msg-text pre {
  background: #f5f5f7;
  border-color: #ddd;
}

body:not([data-theme="dark"]) .msg-text pre code {
  color: #1e1e2e;
}

body:not([data-theme="dark"]) .msg-text code {
  background: rgba(0,0,0,0.06);
  color: #7c3aed;
}

body:not([data-theme="dark"]) .msg-text strong { color: #c026d3; }
body:not([data-theme="dark"]) .msg-text em { color: #059669; }
body:not([data-theme="dark"]) .msg-text h1,
body:not([data-theme="dark"]) .msg-text h2 { color: #2563eb; }
body:not([data-theme="dark"]) .msg-text blockquote {
  border-left-color: #2563eb;
  background: rgba(37, 99, 235, 0.04);
}
body:not([data-theme="dark"]) .msg-text th {
  background: rgba(0,0,0,0.04);
}
body:not([data-theme="dark"]) .msg-text th,
body:not([data-theme="dark"]) .msg-text td {
  border-color: #ddd;
}

/* ═══════════════════════════════════════════════════════
   Interactive Chat Widgets
   ═══════════════════════════════════════════════════════ */

/* -- Action token widget cards -- */
.widget-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(137, 180, 250, 0.08);
  border: 1px solid rgba(137, 180, 250, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0;
  font-size: 13px;
}

.widget-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.widget-body {
  flex: 1;
  min-width: 0;
}

.widget-body strong {
  color: #89b4fa;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.widget-detail {
  color: #cdd6f4;
  margin-top: 3px;
  line-height: 1.4;
}

.widget-worker {
  border-color: rgba(166, 227, 161, 0.2);
  background: rgba(166, 227, 161, 0.06);
}

.widget-worker strong { color: #a6e3a1; }

.widget-research {
  border-color: rgba(249, 226, 175, 0.2);
  background: rgba(249, 226, 175, 0.06);
}

.widget-research strong { color: #f9e2af; }

/* -- Code expand/collapse button -- */
.code-expand-btn {
  display: block;
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-top: none;
  border-radius: 0 0 8px 8px;
  color: #a6adc8;
  padding: 4px 12px;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  margin-top: -2px;
}

.code-expand-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #cdd6f4;
}

/* -- Light theme widget overrides -- */
body:not([data-theme="dark"]) .widget-card {
  background: rgba(37, 99, 235, 0.04);
  border-color: rgba(37, 99, 235, 0.12);
}

body:not([data-theme="dark"]) .widget-body strong { color: #2563eb; }
body:not([data-theme="dark"]) .widget-detail { color: #1e293b; }
body:not([data-theme="dark"]) .widget-worker {
  background: rgba(22, 163, 74, 0.04);
  border-color: rgba(22, 163, 74, 0.12);
}
body:not([data-theme="dark"]) .widget-worker strong { color: #16a34a; }
body:not([data-theme="dark"]) .widget-research {
  background: rgba(202, 138, 4, 0.04);
  border-color: rgba(202, 138, 4, 0.12);
}
body:not([data-theme="dark"]) .widget-research strong { color: #ca8a04; }

body:not([data-theme="dark"]) .code-expand-btn {
  background: rgba(0,0,0,0.02);
  border-color: #ddd;
  color: #6b7280;
}

/* Fix double-layered backgrounds in code blocks */
.msg-text pre code,
.msg-text pre code.hljs,
.msg-bubble pre code,
.msg-bubble pre code.hljs,
.msg-text .hljs {
  background: transparent !important;
}

/* ── Phase 5: Thinker stage animations ── */
.streaming-analyzing {
  color: #cba6f7;
  animation: analyzing-pulse 1.5s ease-in-out infinite;
}
@keyframes analyzing-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
body:not([data-theme="dark"]) .streaming-analyzing {
  color: #7c3aed;
}
/* ═══════════════════════════════════════════════════════════════
   v2 Code Lifecycle styles
   ═══════════════════════════════════════════════════════════════ */
.v2-code-lifecycle {
    font-family: inherit;
}

.v2-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: var(--card-header-bg, #f8fafc);
}

.v2-card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--fg, #1e293b);
}

.v2-header-actions {
    display: flex;
    gap: 8px;
}

.v2-top-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    flex-wrap: wrap;
    font-size: 14px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.v2-repo-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
}

.v2-repo-dot.online {
    background: #22c55e;
}

.v2-repo-name {
    cursor: pointer;
}

.v2-badge {
    background: #0ea5e9;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.v2-link {
    color: #0ea5e9;
    text-decoration: none;
    font-size: 13px;
}

.v2-link:hover {
    text-decoration: underline;
}

.v2-repo-input {
    border: 1px solid var(--border, #334155);
    background: transparent;
    color: inherit;
    padding: 2px 6px;
    border-radius: 4px;
    width: 200px;
    font-size: 13px;
}

.v2-settings-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--muted, #94a3b8);
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.v2-settings-row label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.v2-settings-row input[type="checkbox"] {
    accent-color: #22c55e;
    cursor: pointer;
}

.v2-pull-state {
    background: var(--bg, #fff);
    color: inherit;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 13px;
}

.v2-main-content {
    display: flex;
    gap: 0;
    min-height: 260px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.v2-pipeline-sidebar {
    width: 240px;
    min-width: 240px;
    padding: 14px 16px;
    border-right: 1px solid var(--border, #e2e8f0);
    font-size: 13px;
    line-height: 1.9;
}

.v2-sidebar-title {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted, #94a3b8);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.v2-step {
    padding: 1px 0;
    color: var(--muted, #94a3b8);
}

.v2-step.done {
    color: var(--fg, #334155);
}

.v2-step.active {
    color: #0ea5e9;
    font-weight: 600;
}

.v2-step-dot {
    display: inline-block;
    width: 14px;
    text-align: center;
    font-size: 12px;
}

.v2-step.sub {
    padding-left: 14px;
}

.v2-branch-label {
    margin-top: 6px;
    font-size: 13px;
    color: var(--fg, #334155);
}

.v2-step-divider {
    height: 1px;
    background: var(--border, #e2e8f0);
    margin: 6px 0;
}

.v2-sidebar-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--border, #e2e8f0);
    font-size: 13px;
    color: var(--muted, #94a3b8);
}

.v2-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.v2-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.v2-tab {
    padding: 8px 16px;
    font-size: 13px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted, #94a3b8);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.v2-tab.active {
    color: var(--fg, #1e293b);
    border-bottom-color: #0ea5e9;
    font-weight: 600;
}

.v2-tab-badge {
    background: var(--border, #e2e8f0);
    color: var(--fg, #64748b);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
}

.v2-tab-content {
    flex: 1;
    overflow: auto;
}

.v2-pr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.v2-pr-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted, #94a3b8);
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.v2-pr-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border, #f1f5f9);
}

.v2-pr-table .note {
    text-align: center;
    color: var(--muted, #94a3b8);
    padding: 24px;
}

.v2-state-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.v2-state-badge.pass {
    background: #dcfce7;
    color: #166534;
}

.v2-state-badge.fail {
    background: #fee2e2;
    color: #991b1b;
}

.v2-pr-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 180px;
}

.v2-pr-dropdown a {
    display: block;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--fg, #1e293b);
    text-decoration: none;
}

.v2-pr-dropdown a:hover {
    background: var(--hover, #f1f5f9);
}

.v2-pr-dropdown hr {
    margin: 2px 0;
    border: 0;
    border-top: 1px solid var(--border, #e2e8f0);
}

.v2-ai-section {}

.v2-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 14px;
}

.v2-ai-live {
    color: #22c55e;
    font-size: 13px;
}

.v2-ai-terminal {
    background: var(--terminal-bg, #0f172a);
    color: #94a3b8;
    padding: 10px 14px;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 12px;
    line-height: 1.6;
    min-height: 100px;
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
}
/* v2 Dark mode fixes */
[data-theme="dark"] .v2-card-header,
.dark .v2-card-header {
  background: var(--card-bg, #1e293b) !important;
  color: var(--text, #e2e8f0) !important;
  border-color: var(--border, #334155) !important;
}
[data-theme="dark"] .v2-code-lifecycle,
.dark .v2-code-lifecycle {
  background: var(--card-bg, #1e293b) !important;
  border-color: var(--border, #334155) !important;
}
[data-theme="dark"] .v2-top-bar,
.dark .v2-top-bar {
  background: var(--surface, #0f172a) !important;
}


/* ── UX Architect Panel ─────────────────────────────────────────────── */
.ux-architect-panel {
  background: var(--card, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.ux-architect-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(74,108,247,0.12), rgba(125,211,252,0.06));
  border-bottom: 1px solid var(--border, #334155);
}
.ux-architect-icon { font-size: 1.1rem; }
.ux-architect-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg, #e2e8f0);
  flex: 1;
}
.ux-architect-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(74,108,247,0.15);
  color: #7dd3fc;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.ux-architect-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Config grid: PRD | Model | Options */
.ux-config-grid {
  display: grid;
  grid-template-columns: 1fr 200px auto;
  gap: 10px;
  align-items: end;
}
.ux-field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted, #94a3b8);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ux-select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border, #334155);
  background: var(--bg, #0f172a);
  color: var(--fg, #e2e8f0);
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
}
.ux-select:focus { border-color: #4a6cf7; }
.ux-checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--fg, #e2e8f0);
  padding-bottom: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.ux-checkbox-row input[type="checkbox"] { accent-color: #4a6cf7; }

/* Style notes */
.ux-notes-row { position: relative; }
.ux-textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #334155);
  background: var(--bg, #0f172a);
  color: var(--fg, #e2e8f0);
  font-size: 0.78rem;
  font-family: inherit;
  resize: vertical;
  min-height: 44px;
  outline: none;
  transition: border-color 0.2s;
}
.ux-textarea:focus { border-color: #4a6cf7; }
.ux-textarea::placeholder { color: var(--muted, #64748b); font-style: italic; }

/* Generate row */
.ux-generate-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ux-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #4a6cf7, #6366f1);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(74,108,247,0.25);
  white-space: nowrap;
}
.ux-generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(74,108,247,0.35);
}
.ux-generate-btn:active { transform: translateY(0); }
.ux-generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.ux-gen-icon { font-size: 0.9rem; }
.ux-status-text {
  font-size: 0.72rem;
  color: var(--muted, #94a3b8);
  flex: 1;
}

/* ── Saved Designs Panel ────────────────────────────────────────────── */
.ux-designs-panel {
  background: var(--card, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.ux-designs-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border, #334155);
}
.ux-designs-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg, #e2e8f0);
  flex: 1;
}
.ux-designs-count {
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--muted, #94a3b8);
}
.ux-designs-body { padding: 4px 0; }
.ux-designs-empty {
  padding: 16px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted, #64748b);
  font-style: italic;
}

/* Individual design item */
.ux-design-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.ux-design-item:last-child { border-bottom: none; }
.ux-design-item:hover { background: rgba(255,255,255,0.03); }
.ux-design-assigned {
  background: rgba(74,108,247,0.06) !important;
  border-left: 3px solid #4a6cf7;
}
.ux-design-info { flex: 1; min-width: 0; }
.ux-design-name {
  font-size: 0.78rem;
  color: var(--fg, #e2e8f0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ux-design-meta {
  font-size: 0.65rem;
  color: var(--muted, #64748b);
  margin-top: 2px;
}
.ux-assigned-badge {
  display: inline-block;
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(74,108,247,0.2);
  color: #7dd3fc;
  font-weight: 600;
  margin-right: 4px;
  vertical-align: middle;
}
.ux-design-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.ux-design-btn {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border, #334155);
  background: transparent;
  color: var(--fg, #e2e8f0);
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.15s;
}
.ux-btn-assign {
  background: rgba(74,108,247,0.12);
  border-color: rgba(74,108,247,0.3);
  color: #93bbfc;
}
.ux-btn-assign:hover {
  background: rgba(74,108,247,0.25);
  border-color: #4a6cf7;
}
.ux-btn-unassign {
  color: var(--muted, #94a3b8);
}
.ux-btn-unassign:hover { color: var(--fg); }
.ux-btn-delete {
  color: #ef4444;
  border-color: transparent;
  font-weight: 700;
}
.ux-btn-delete:hover {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .ux-config-grid {
    grid-template-columns: 1fr;
  }
}

/* -- UX Reference Image Upload -- */
.ux-notes-with-upload { display: flex; gap: 8px; align-items: stretch; }
.ux-notes-with-upload .ux-textarea { flex: 1; }
.ux-upload-area { flex: 0 0 70px; display: flex; }
.ux-upload-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; width: 100%; padding: 6px; border-radius: 8px;
  border: 1px dashed var(--border, #475569); background: rgba(255,255,255,0.02);
  color: var(--muted, #94a3b8); cursor: pointer; transition: all 0.2s; font-size: 0.65rem;
}
.ux-upload-btn:hover { border-color: #4a6cf7; background: rgba(74,108,247,0.06); color: #93bbfc; }
.ux-upload-icon { font-size: 1.2rem; }
.ux-upload-label { text-align: center; line-height: 1.2; }
.ux-ref-thumbs { display: none; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ux-ref-thumb {
  position: relative; width: 64px; height: 48px; border-radius: 6px;
  overflow: hidden; border: 1px solid var(--border, #334155);
}
.ux-ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ux-ref-thumb-remove {
  position: absolute; top: 1px; right: 1px; width: 16px; height: 16px;
  border-radius: 50%; border: none; background: rgba(0,0,0,0.7); color: #fff;
  font-size: 11px; line-height: 1; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}
.ux-ref-thumb-remove:hover { background: #ef4444; }

/* -- UX Design item style notes + view button -- */
.ux-design-style {
  font-size: 0.65rem;
  color: var(--muted, #64748b);
  font-style: italic;
  margin-top: 2px;
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ux-btn-view {
  background: rgba(74,108,247,0.1);
  color: #7cc4fa;
  border: 1px solid rgba(74,108,247,0.3);
}
.ux-btn-view:hover {
  background: rgba(74,108,247,0.2);
  color: #a5d8ff;
}

/* -- UX Stack badge -- */
.ux-stack-badge {
  display: inline-block;
  padding: 1px 5px;
  font-size: 0.6rem;
  font-weight: 600;
  border-radius: 3px;
  background: rgba(94,106,210,0.15);
  color: #a5b4fc;
  letter-spacing: 0.02em;
}


/* ── Interactive Design Editor ──────────────────────────── */
.ux-editor-wrapper {
  display: flex;
  gap: 0;
  height: 100%;
  position: relative;
}
.ux-editor-preview {
  flex: 1;
  position: relative;
  min-height: 400px;
}
.ux-editor-preview .preview-frame {
  height: 100%;
}
.ux-annotation-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  cursor: crosshair;
  pointer-events: none;
}
.ux-annotation-canvas.drawing {
  pointer-events: auto;
}

/* Drawing Toolbar */
.ux-draw-toolbar {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  background: var(--card, rgba(15,23,42,0.92));
  border-radius: 10px;
  border: 1px solid var(--border, rgba(148,163,184,0.15));
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.ux-draw-toolbar button {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted, #94a3b8);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.ux-draw-toolbar button:hover {
  background: rgba(99,102,241,0.12);
  color: var(--fg, #e2e8f0);
}
.ux-draw-toolbar button.active {
  background: rgba(99,102,241,0.18);
  color: var(--accent, #6366f1);
  box-shadow: 0 0 0 1px var(--accent, #6366f1);
}
.ux-draw-toolbar .tb-sep {
  width: 1px;
  background: rgba(148,163,184,0.2);
  margin: 4px 2px;
}

/* Note popup */
.ux-note-popup {
  position: absolute;
  z-index: 20;
  background: var(--card, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  width: 240px;
}
.ux-note-popup textarea {
  width: 100%;
  padding: 6px 8px;
  border-radius: 5px;
  border: 1px solid #475569;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.75rem;
  resize: none;
  font-family: inherit;
}
.ux-note-popup .note-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  justify-content: flex-end;
}
.ux-note-popup button {
  padding: 4px 10px;
  border-radius: 5px;
  border: none;
  font-size: 0.7rem;
  cursor: pointer;
}
.ux-note-popup .note-save {
  background: #4a6cf7;
  color: white;
}
.ux-note-popup .note-cancel {
  background: #334155;
  color: #94a3b8;
}

/* AI Chat Panel */
.ux-chat-panel {
  width: 0;
  overflow: hidden;
  transition: width 0.3s ease;
  background: #0f172a;
  border-left: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
}
.ux-chat-panel.open {
  width: 340px;
}
.ux-chat-header {
  padding: 10px 14px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ux-chat-header h4 {
  margin: 0;
  font-size: 0.82rem;
  color: #e2e8f0;
  font-weight: 600;
}
.ux-chat-header .ux-chat-close {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px;
}

/* Pin list */
.ux-pin-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.ux-pin-item {
  padding: 8px 10px;
  border-radius: 7px;
  margin-bottom: 6px;
  background: #1e293b;
  border: 1px solid #334155;
  transition: all 0.15s;
}
.ux-pin-item:hover {
  border-color: #475569;
}
.ux-pin-item .pin-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.ux-pin-item .pin-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}
.ux-pin-item .pin-num.wip { background: #854d0e; color: #fbbf24; }
.ux-pin-item .pin-num.review { background: #1e3a5f; color: #60a5fa; }
.ux-pin-item .pin-num.done { background: #14532d; color: #4ade80; }
.ux-pin-item .pin-note {
  font-size: 0.72rem;
  color: #cbd5e1;
  line-height: 1.35;
  margin-bottom: 6px;
}
.ux-pin-item .pin-element {
  font-size: 0.62rem;
  color: #64748b;
  font-family: monospace;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ux-pin-item .pin-ai-response {
  font-size: 0.7rem;
  color: #94a3b8;
  background: rgba(74,108,247,0.06);
  padding: 6px 8px;
  border-radius: 5px;
  margin-bottom: 6px;
  border-left: 2px solid #4a6cf7;
}
.ux-pin-item .pin-actions {
  display: flex;
  gap: 5px;
}
.ux-pin-item .pin-actions button {
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #334155;
  background: transparent;
  color: #94a3b8;
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.15s;
}
.ux-pin-item .pin-actions button:hover {
  background: #334155;
  color: #e2e8f0;
}
.ux-pin-item .pin-actions .pin-approve {
  border-color: #166534;
  color: #4ade80;
}
.ux-pin-item .pin-actions .pin-approve:hover {
  background: #166534;
}

/* Chat input */
.ux-chat-input-area {
  padding: 8px;
  border-top: 1px solid #1e293b;
  flex-shrink: 0;
}
.ux-chat-input-area .chat-reply-context {
  font-size: 0.65rem;
  color: #64748b;
  padding: 4px 8px;
  background: #1e293b;
  border-radius: 4px;
  margin-bottom: 4px;
  display: none;
}
.ux-chat-input-area .chat-input-row {
  display: flex;
  gap: 6px;
}
.ux-chat-input-area input {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.75rem;
}
.ux-chat-input-area button {
  padding: 7px 12px;
  border-radius: 6px;
  border: none;
  background: #4a6cf7;
  color: white;
  font-size: 0.75rem;
  cursor: pointer;
}
.ux-chat-input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Chat toggle button */
.ux-chat-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 15;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: rgba(15,23,42,0.9);
  color: #94a3b8;
  font-size: 0.72rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.15s;
}
.ux-chat-toggle:hover {
  background: rgba(74,108,247,0.15);
  color: #e2e8f0;
}

/* Archived section */
.ux-archived-toggle {
  font-size: 0.68rem;
  color: #64748b;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid #1e293b;
}
.ux-archived-list {
  display: none;
  padding: 0 8px 8px;
}
.ux-archived-list.open {
  display: block;
}
.ux-archived-list .ux-pin-item {
  opacity: 0.5;
}


/* Task drag-over visual feedback */
.task-drag-over {
  border-color: var(--accent, #6366f1) !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
  transition: box-shadow 0.15s ease;
}

/* Large diff warning hint */
.diff-large-file-hint {
  padding: 8px 12px;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: 6px;
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0;
}

/* ── Error Bubble — Console Health Monitor ───────────────────────── */

/* ── Health Monitor Auto-Pulse ───────────────────────────────────── */
.error-bubble-pulse {
  animation: health-pulse 0.6s ease-in-out 3;
}
@keyframes health-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); box-shadow: 0 0 12px rgba(239,68,68,0.5); }
}
.error-bubble-btn .dot {
  width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; flex-shrink: 0;
}

.error-bubble-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
}
.error-bubble-btn {
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.3s;
  border: 1px solid transparent;
}
/* Green = healthy */
.error-bubble-clean {
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.3);
  color: #4ade80;
}
.error-bubble-clean:hover { background: rgba(34,197,94,0.2); }
/* Red = issues */
.error-bubble-active {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
  color: #f87171;
  animation: errorPulse 2s infinite;
}
.error-bubble-active:hover { background: rgba(239,68,68,0.25); }
@keyframes errorPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
  50% { box-shadow: 0 0 8px 2px rgba(239,68,68,0.15); }
}
.error-bubble-count {
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
}
.error-bubble-count-error { background: #ef4444; }
.error-bubble-count-warn { background: #f59e0b; }
.error-bubble-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 460px;
  max-height: 380px;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 9999;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.error-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #334155);
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
}
.error-bubble-subtitle {
  font-size: 0.65rem;
  font-weight: 400;
  color: #64748b;
}
.error-bubble-list {
  overflow-y: auto;
  max-height: 320px;
  padding: 4px;
}
.error-bubble-empty {
  padding: 20px;
  text-align: center;
  color: #4ade80;
  font-size: 0.8rem;
}
.error-bubble-item {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.72rem;
  color: #e2e8f0;
  word-break: break-word;
  line-height: 1.4;
}
.error-bubble-item:last-child { border-bottom: none; }
.error-bubble-item.level-error { border-left: 3px solid #ef4444; }
.error-bubble-item.level-warn { border-left: 3px solid #f59e0b; }
.error-bubble-item.level-info { border-left: 3px solid #3b82f6; }
.error-bubble-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.error-bubble-item .error-time {
  color: #64748b;
  font-size: 0.65rem;
  font-family: 'SF Mono', Monaco, monospace;
}
.error-bubble-item .error-badge { font-size: 0.7rem; }
.error-bubble-item-msg {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.7rem;
  color: #cbd5e1;
  white-space: pre-wrap;
}
.error-repeat-count {
  font-size: 0.6rem;
  background: rgba(255,255,255,0.1);
  color: #94a3b8;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 600;
}

/* ── Slim Section Tabs ───────────────────────────────────────────────── */
[data-sec="route-nav"] .btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
}

/* ── Agents Overview Compact Strip ────────────────────────────────── */
.an-overview-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.an-ov-block {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card, var(--soft));
}
.an-ov-block[data-accent="cyan"] { border-left: 3px solid #06b6d4; }
.an-ov-block[data-accent="emerald"] { border-left: 3px solid #10b981; }
.an-ov-block[data-accent="red"] { border-left: 3px solid #ef4444; }
.an-ov-block[data-accent="amber"] { border-left: 3px solid #f59e0b; }
.an-ov-block[data-accent="slate"] { border-left: 3px solid var(--border); }
.an-ov-val {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.an-ov-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 1px;
}
.an-ov-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.an-ov-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  padding: 0 2px;
}
.an-ov-alerts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.an-ov-alerts:empty { display: none; }
.an-ov-alert {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #f59e0b33;
  background: #f59e0b0a;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}


/* ── Ultra-compact Metric Cards (6-across) ────────────────────────── */
.an-metrics-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.an-m-card {
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  text-align: center;
  background: var(--bg-card, var(--soft));
}
.an-m-card[data-accent="cyan"] { border-top: 2px solid #06b6d4; }
.an-m-card[data-accent="blue"] { border-top: 2px solid #3b82f6; }
.an-m-card[data-accent="emerald"] { border-top: 2px solid #10b981; }
.an-m-card[data-accent="amber"] { border-top: 2px solid #f59e0b; }
.an-m-card[data-accent="violet"] { border-top: 2px solid #8b5cf6; }
.an-m-card[data-accent="teal"] { border-top: 2px solid #14b8a6; }
.an-m-val {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.an-m-lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 1px;
}
.an-ov-alert-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid #f59e0b33;
  background: #f59e0b0a;
  font-size: 10px;
}

/* ── Section Separator ────────────────────────────────────────────── */
.section-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0 8px;
  opacity: 0.5;
}

/* ── Agent Status Badge Styles ────────────────────────────────────── */
.badge-info {
  background: #0ea5e910;
  color: #0ea5e9;
  border-color: #0ea5e940;
}
.badge-warn {
  background: #f59e0b10;
  color: #f59e0b;
  border-color: #f59e0b40;
}
