:root {
  --bg-obsidian: #090D16;
  --bg-slate: #0F1523;
  --bg-card: #151D2F;
  --bg-card-hover: #1B253B;
  --bg-elevated: #1E2942;
  --border-subtle: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(16, 185, 129, 0.35);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --emerald: #10B981;
  --emerald-bright: #34D399;
  --emerald-deep: #059669;
  --cyan: #06B6D4;
  --cyan-bright: #22D3EE;
  --amber: #F59E0B;
  --coral: #EF4444;
  --violet: #8B5CF6;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-pill: 9999px;
  --shadow-soft: 0 18px 40px -15px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 36px -8px rgba(16, 185, 129, 0.28);
}

[data-theme="light"] {
  --bg-obsidian: #F4F6FA;
  --bg-slate: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --bg-elevated: #EEF2F7;
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(16, 185, 129, 0.45);
  --text-primary: #090D16;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --shadow-soft: 0 14px 34px -12px rgba(15, 23, 42, 0.09);
  --shadow-glow: 0 10px 28px -8px rgba(16, 185, 129, 0.22);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-obsidian);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

/* Ambient Background Glow (Nubank fluidity + MeuSuperApp colors) */
.ambient-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.22;
}

[data-theme="light"] .ambient-orb {
  opacity: 0.12;
}

.orb-emerald {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #10B981 0%, transparent 70%);
  top: -180px;
  left: -100px;
}

.orb-cyan {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #06B6D4 0%, transparent 70%);
  top: -140px;
  right: -120px;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1380px;
  margin: 0 auto;
  padding: 20px 24px 64px;
  width: 100%;
}

/* Top Navigation Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: color-mix(in srgb, var(--bg-slate) 84%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  margin-bottom: 24px;
  box-shadow: var(--shadow-soft);
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--cyan) 100%);
  display: grid;
  place-items: center;
  color: #06120E;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}

.brand-titles {
  min-width: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.14);
  color: var(--emerald-bright);
  border: 1px solid rgba(16, 185, 129, 0.28);
}

[data-theme="light"] .brand-badge {
  color: var(--emerald-deep);
}

.brand-sub {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-obsidian);
  padding: 5px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.nav-pill {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.nav-pill:hover {
  color: var(--text-primary);
}

.nav-pill.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.18));
  color: var(--emerald-bright);
  border: 1px solid rgba(16, 185, 129, 0.32);
}

[data-theme="light"] .nav-pill.active {
  background: var(--emerald);
  color: #FFFFFF;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--emerald);
}

.btn-primary {
  border: none;
  background: linear-gradient(135deg, var(--emerald) 0%, #0EA5E9 100%);
  color: #04130E;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 8px 22px -6px rgba(16, 185, 129, 0.5);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -6px rgba(16, 185, 129, 0.65);
}

.btn-secondary {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  border-color: var(--emerald);
  background: var(--bg-card-hover);
}

/* Nubank-Inspired Hero Command Banner */
.hero-banner {
  background: linear-gradient(135deg, #0D1F22 0%, #0F172A 52%, #131B33 100%);
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: var(--radius-xl);
  padding: 28px 30px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-soft), var(--shadow-glow);
}

[data-theme="light"] .hero-banner {
  background: linear-gradient(135deg, #090D16 0%, #111C2D 60%, #0C2926 100%);
  color: #F8FAFC;
}

.hero-banner::after {
  content: '';
  position: absolute;
  right: -80px;
  top: -90px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.24) 0%, rgba(6, 182, 212, 0.08) 50%, transparent 72%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 24px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-greeting {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34D399;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseRing 2s infinite;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero-title {
  font-size: clamp(22px, 2.6vw, 31px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: #F8FAFC;
  margin-bottom: 8px;
}

.hero-desc {
  font-size: 14px;
  color: #94A3B8;
  max-width: 620px;
  margin-bottom: 20px;
}

/* Nubank-style Quick Action Carousel */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.qa-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #F8FAFC;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.qa-chip:hover {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.42);
  transform: translateY(-2px);
}

.qa-chip-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.18);
  color: #34D399;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.hero-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.kpi-card {
  background: rgba(9, 13, 22, 0.56);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 16px 18px;
}

.kpi-label {
  font-size: 12px;
  color: #94A3B8;
  font-weight: 600;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #F8FAFC;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.kpi-tag {
  font-size: 11px;
  font-weight: 700;
  color: #34D399;
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title-group h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-title-group p {
  font-size: 13px;
  color: var(--text-secondary);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-slate);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-pill.active,
.filter-pill:hover {
  border-color: var(--emerald);
  color: var(--emerald-bright);
  background: rgba(16, 185, 129, 0.1);
}

[data-theme="light"] .filter-pill.active {
  color: var(--emerald-deep);
}

/* WORKTREE VISUAL GRAPH WORKSPACE */
.worktree-workspace {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
  margin-bottom: 28px;
  align-items: stretch;
}

.graph-card {
  background: var(--bg-slate);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
  min-height: 580px;
  position: relative;
}

.graph-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-card) 65%, transparent);
}

.graph-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.graph-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.16s ease;
}

.mini-btn:hover {
  color: var(--text-primary);
  border-color: var(--cyan);
}

.btn-label-short {
  display: none;
}

.graph-stage-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 580px;
  overflow: hidden;
  background-image: radial-gradient(rgba(148, 163, 184, 0.14) 1px, transparent 1px);
  background-size: 24px 24px;
}

.graph-stage {
  position: relative;
  width: 100%;
  height: 600px;
}

.edges-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: visibleStroke;
}

.edge-group {
  cursor: pointer;
}

.edge-bg {
  fill: none;
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 2.2;
  transition: stroke 0.25s ease, stroke-width 0.25s ease;
}

.edge-flow {
  fill: none;
  stroke-width: 2.6;
  stroke-dasharray: 8 10;
  animation: dashFlow 1.6s linear infinite;
  opacity: 0.85;
}

.edge-group:hover .edge-bg,
.edge-group.selected .edge-bg {
  stroke: rgba(16, 185, 129, 0.55);
  stroke-width: 4;
}

.edge-group.burst .edge-bg {
  stroke: #34D399;
  stroke-width: 5;
  filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.85));
}

.edge-pill-label {
  font-size: 10px;
  font-weight: 700;
  fill: #CBD5E1;
  pointer-events: none;
}

@keyframes dashFlow {
  from { stroke-dashoffset: 36; }
  to { stroke-dashoffset: 0; }
}

.nodes-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.agent-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 210px;
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  backdrop-filter: blur(14px);
  border: 1.5px solid var(--border-subtle);
  border-radius: 22px;
  padding: 13px 15px;
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.55);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  z-index: 2;
}

.agent-node:hover {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 18px 34px -10px rgba(16, 185, 129, 0.25);
}

.agent-node.selected {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22), 0 18px 36px -10px rgba(0, 0, 0, 0.6);
}

.agent-node.root-node {
  width: 242px;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.16) 0%, var(--bg-card) 65%);
  border-color: rgba(16, 185, 129, 0.48);
}

.agent-node.pulsing {
  animation: nodeCallFlash 0.9s ease;
}

@keyframes nodeCallFlash {
  0% { transform: translate(-50%, -50%) scale(1); }
  40% { transform: translate(-50%, -50%) scale(1.06); box-shadow: 0 0 32px rgba(16, 185, 129, 0.7); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.node-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.node-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.node-meta {
  min-width: 0;
  flex: 1;
}

.node-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-role {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  flex-shrink: 0;
}

.node-status-dot.busy {
  background: var(--amber);
}

.node-chips {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 10.5px;
}

.node-branch {
  color: var(--cyan-bright);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 7px;
  border-radius: 8px;
  max-width: 126px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .node-branch {
  color: #0E7490;
}

.node-calls-count {
  color: var(--text-secondary);
  font-weight: 700;
}

/* Mobile/Compact Stacked Tree View (automatically activates on narrow screens for zero overflow) */
.mobile-worktree-list {
  display: none;
  padding: 16px;
  gap: 12px;
  flex-direction: column;
}

.m-node-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.18s ease;
}

.m-node-card.selected {
  border-color: var(--emerald);
}

.m-connections {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.m-conn-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald-bright);
  border: 1px solid rgba(16, 185, 129, 0.28);
}

[data-theme="light"] .m-conn-badge {
  color: var(--emerald-deep);
}

/* Inspector Sidebar Panel */
.inspector-card {
  background: var(--bg-slate);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-soft);
}

.inspector-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.inspector-emoji {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(16, 185, 129, 0.35);
  display: grid;
  place-items: center;
  font-size: 24px;
  flex-shrink: 0;
}

.inspector-title h3 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.inspector-title span {
  font-size: 12px;
  color: var(--emerald-bright);
  font-weight: 600;
}

[data-theme="light"] .inspector-title span {
  color: var(--emerald-deep);
}

.inspector-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.info-kv-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-kv {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 15px;
  padding: 10px 13px;
}

.info-kv-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.info-kv-val {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.handoff-list-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.handoff-mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.16s ease;
}

.handoff-mini-item:hover {
  border-color: var(--emerald);
}

/* Git Worktrees Cards Grid */
.cards-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.nubank-card {
  background: var(--bg-slate);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.nubank-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.35);
}

.wt-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wt-project-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald-bright);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

[data-theme="light"] .wt-project-pill {
  color: var(--emerald-deep);
}

.wt-title {
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wt-branch-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wt-branch-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wt-commit-msg {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wt-agents-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--bg-slate);
  display: grid;
  place-items: center;
  font-size: 13px;
  margin-left: -6px;
}

.avatar-chip:first-child {
  margin-left: 0;
}

.wt-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--emerald-bright);
  text-decoration: none;
}

[data-theme="light"] .wt-link {
  color: var(--emerald-deep);
}

/* Bottom Split: Live Call Trace + Ecosystem Domains Health */
.bottom-split {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 18px;
}

.trace-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trace-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.trace-route {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 3px;
  flex-wrap: wrap;
}

.trace-arrow {
  color: var(--emerald);
  font-weight: 800;
}

.trace-action {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.trace-meta {
  text-align: right;
  flex-shrink: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.14);
  color: var(--emerald-bright);
}

[data-theme="light"] .status-pill {
  color: var(--emerald-deep);
}

.status-pill.running {
  background: rgba(6, 182, 212, 0.16);
  color: var(--cyan-bright);
}

.health-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.health-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.health-name {
  font-size: 13.5px;
  font-weight: 700;
}

.health-url {
  font-size: 11.5px;
  color: var(--text-secondary);
  text-decoration: none;
}

.health-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.76);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-panel {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-slate);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 28px;
  padding: 26px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-head h3 {
  font-size: 19px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 11px 13px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--emerald);
}

.checkbox-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  cursor: pointer;
}

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

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  background: #0F172A;
  color: #F8FAFC;
  border: 1px solid var(--emerald);
  border-radius: 18px;
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  transform: translateY(120%);
  opacity: 0;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Responsive Breakpoints (Tri-Viewport QA Ready: 1440px, 768px, 375px) */
@media (max-width: 1140px) {
  .worktree-workspace {
    grid-template-columns: 1fr;
  }
  .cards-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .bottom-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 14px 16px 48px;
  }
  .nav-pills {
    display: none;
  }
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .graph-stage-wrap {
    display: none;
  }
  .mobile-worktree-list {
    display: flex;
  }
  .graph-card {
    min-height: auto;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 10px 12px;
    border-radius: 20px;
    gap: 8px;
  }
  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 15px;
    border-radius: 11px;
  }
  .brand-name {
    font-size: 13.5px;
    gap: 6px;
  }
  .brand-badge {
    display: none;
  }
  .brand-sub {
    display: none;
  }
  .topbar-actions {
    gap: 6px;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
  }
  .btn-secondary {
    padding: 8px 11px;
    font-size: 12px;
  }
  .btn-primary {
    padding: 8px 13px;
    font-size: 12px;
  }
  .btn-label-hide-sm {
    display: none;
  }
  .btn-label-short {
    display: inline;
  }
  .hero-banner {
    padding: 20px 18px;
    border-radius: 24px;
  }
  .hero-kpis {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi-value {
    font-size: 22px;
  }
  .cards-grid-3 {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .trace-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .trace-meta {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
  }
}
