/* Gas Town - Component CSS */

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.btn .material-icons {
  font-size: 18px;
}

.btn-primary {
  color: var(--text-inverse);
  background: var(--accent-primary);
}

.btn-primary:hover {
  background: #4a90e2;
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
}

.btn-danger {
  color: white;
  background: var(--accent-danger);
}

.btn-danger:hover {
  background: #e53935;
}

/* === Form Elements === */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.filter-select {
  width: auto;
  min-width: 150px;
}

/* === Agent Tree === */
.tree-group {
  margin-bottom: var(--space-sm);
}

.tree-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.tree-group-header:hover {
  background: var(--bg-hover);
}

.tree-group-header .material-icons {
  font-size: 16px;
  transition: transform var(--transition-fast);
}

.tree-group.collapsed .tree-group-header .material-icons {
  transform: rotate(-90deg);
}

.tree-group-items {
  margin-left: var(--space-md);
  overflow: hidden;
}

.tree-group.collapsed .tree-group-items {
  display: none;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tree-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tree-item.selected {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.agent-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.agent-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.agent-status-dot.running {
  background: var(--status-running);
}

.agent-status-dot.working {
  background: var(--status-working);
  animation: pulse 1.5s infinite;
}

.agent-status-dot.idle {
  background: var(--status-idle);
}

.agent-status-dot.done {
  background: var(--status-done);
}

.agent-status-dot.stuck {
  background: var(--status-stuck);
  animation: pulse 1s infinite;
}

.agent-status-dot.dead {
  background: var(--status-dead);
}

/* === Convoy Card === */
.convoy-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.convoy-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-md);
}

.convoy-card.updating {
  animation: convoy-update 0.4s ease;
}

.convoy-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  cursor: pointer;
}

.convoy-icon {
  font-size: 24px;
}

.convoy-info {
  flex: 1;
  min-width: 0;
}

.convoy-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-base);
  font-weight: 600;
}

.convoy-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.convoy-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.convoy-progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 120px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}

.progress-text {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
}

.convoy-expand {
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.convoy-card.expanded .convoy-expand {
  transform: rotate(180deg);
}

.convoy-body {
  display: none;
  padding: 0 var(--space-md) var(--space-md);
  border-top: 1px solid var(--border-muted);
}

.convoy-card.expanded .convoy-body {
  display: block;
}

/* === Issue List === */
.issue-list {
  margin-top: var(--space-md);
}

.issue-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.issue-item:hover {
  background: var(--bg-hover);
}

.issue-status-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.issue-status-icon.open {
  color: var(--status-idle);
}

.issue-status-icon.in_progress {
  color: var(--status-working);
}

.issue-status-icon.closed {
  color: var(--status-done);
}

.issue-id {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.issue-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Worker Tags === */
.worker-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.worker-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  padding: 2px 8px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

.worker-tag .agent-icon {
  font-size: 12px;
}

/* === Activity Event === */
.event-item {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  animation: event-slide-in 0.3s ease;
}

.event-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.event-item.create .event-icon {
  color: var(--event-create);
}

.event-item.update .event-icon {
  color: var(--event-update);
}

.event-item.complete .event-icon {
  color: var(--event-complete);
}

.event-item.fail .event-icon {
  color: var(--event-fail);
}

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

.event-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.event-target {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-primary);
}

.event-action {
  color: var(--text-secondary);
}

.event-message {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* === Agent Card (Grid View) === */
.agent-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  transition: all var(--transition-fast);
}

.agent-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-sm);
}

.agent-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.agent-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.agent-card-info {
  flex: 1;
}

.agent-card-name {
  font-weight: 600;
  font-size: var(--text-base);
}

.agent-card-role {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
}

.agent-card-status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  border-radius: var(--radius-full);
}

.agent-card-status.running {
  color: var(--status-running);
  background: rgba(63, 185, 80, 0.15);
}

.agent-card-status.working {
  color: var(--status-working);
  background: rgba(210, 153, 34, 0.15);
}

.agent-card-status.idle {
  color: var(--status-idle);
  background: rgba(110, 118, 129, 0.15);
}

.agent-card-status.stuck {
  color: var(--status-stuck);
  background: rgba(248, 81, 73, 0.15);
}

.agent-card-work {
  padding: var(--space-sm);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.agent-card-work-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-xxs);
}

.agent-card-work-id {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent-primary);
}

.agent-card-actions {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.agent-card-actions .btn {
  flex: 1;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
}

/* === Rig Card === */
.rig-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-lg);
}

.rig-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-fast);
}

.rig-card:hover {
  border-color: var(--border-accent);
}

.rig-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.rig-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.rig-icon .material-icons {
  font-size: 24px;
  color: var(--accent-primary);
}

.rig-info {
  flex: 1;
}

.rig-name {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-xxs);
}

.rig-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.rig-github-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  color: var(--accent-primary);
  text-decoration: none;
}

.rig-github-link:hover {
  text-decoration: underline;
}

.rig-github-link .material-icons {
  font-size: 14px;
}

.rig-local {
  color: var(--text-muted);
  font-style: italic;
}

.rig-status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.rig-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.rig-status .status-dot.active {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.rig-stats {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.rig-stat {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.rig-stat .material-icons {
  font-size: 20px;
}

.rig-stat .stat-value {
  font-size: var(--text-lg);
  font-weight: 600;
}

.rig-stat .stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.rig-agents {
  margin-bottom: var(--space-md);
}

.rig-agents .agents-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.rig-agents .agents-header .material-icons {
  font-size: 16px;
}

.rig-agents .agents-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.rig-agent {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.rig-agent .agent-icon {
  font-size: 16px;
}

.rig-agent .agent-name {
  font-weight: 500;
}

.rig-agent .agent-role {
  font-size: var(--text-xs);
  margin-left: auto;
}

.rig-agent .agent-status {
  display: flex;
  align-items: center;
}

.rig-agent .agent-status .material-icons {
  font-size: 14px;
}

.rig-agent .agent-work-badge {
  font-size: 12px;
}

.rig-actions {
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-default);
}

/* === Crew Card === */
.crew-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-lg);
}

.crew-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.crew-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-fast);
}

.crew-card:hover {
  border-color: var(--border-accent);
}

.crew-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.crew-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.crew-icon .material-icons {
  font-size: 24px;
  color: var(--accent-secondary);
}

.crew-info {
  flex: 1;
}

.crew-name {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-xxs);
}

.crew-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.crew-rig {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
}

.crew-rig .material-icons {
  font-size: 14px;
}

.crew-no-rig {
  color: var(--text-muted);
  font-style: italic;
}

.crew-status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
}

.crew-status.status-active {
  color: #22c55e;
}

.crew-status.status-active .material-icons {
  color: #22c55e;
}

.crew-status.status-inactive {
  color: var(--text-muted);
}

.crew-stats {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.crew-stat {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.crew-stat .material-icons {
  font-size: 20px;
  color: var(--text-secondary);
}

.crew-stat .stat-value {
  font-size: var(--text-lg);
  font-weight: 600;
}

.crew-stat .stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.crew-members {
  margin-bottom: var(--space-md);
}

.crew-members h4 {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.member-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.member-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  padding: var(--space-xxs) var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.member-badge .material-icons {
  font-size: 14px;
  color: var(--accent-primary);
}

.crew-actions {
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-default);
}

.crew-status-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.crew-status-details .detail-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.crew-status-details .label {
  color: var(--text-secondary);
  font-weight: 500;
}

.crew-status-details .value {
  font-weight: 600;
}

/* === Mail Item === */
.mail-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mail-item:hover {
  border-color: var(--border-accent);
}

.mail-item.unread {
  border-left: 3px solid var(--accent-primary);
}

.mail-avatar {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.mail-content {
  flex: 1;
  min-width: 0;
}

.mail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xxs);
}

.mail-from {
  font-weight: 600;
  font-size: var(--text-sm);
}

.mail-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.mail-subject {
  font-size: var(--text-sm);
  margin-bottom: var(--space-xxs);
}

.mail-preview {
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-subject-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-content: space-between;
  margin-bottom: var(--space-xxs);
}

.mail-subject-row .mail-subject {
  margin-bottom: 0;
}

/* === Mail Filters === */
.mail-filters {
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
}

.filter-row {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
  flex-wrap: wrap;
}

.mail-filters .filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
  min-width: 120px;
}

.mail-filters .filter-group label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.mail-filters .filter-group.search-group {
  flex: 1;
  min-width: 150px;
}

.filter-select,
.filter-input {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}

.filter-select:focus,
.filter-input:focus {
  border-color: var(--accent-primary);
}

.filter-select {
  cursor: pointer;
}

/* === Agent Legend === */
.agent-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-default);
}

.mail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.mail-summary-chip,
.mail-signal-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.mail-summary-chip .material-icons,
.mail-signal-chip .material-icons {
  font-size: 14px;
}

.mail-summary-chip.total {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.mail-summary-chip.action,
.mail-summary-chip.critical,
.mail-signal-chip.tone-critical {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.mail-summary-chip.warning,
.mail-signal-chip.tone-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.mail-summary-chip.info,
.mail-signal-chip.tone-info {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.legend-item .material-icons {
  font-size: 14px;
}

/* === Agent Badges === */
.agent-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  padding: 2px 6px;
  background: color-mix(in srgb, var(--agent-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--agent-color) 40%, transparent);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--agent-color);
}

.agent-badge .material-icons {
  font-size: 12px;
}

.mail-arrow {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin: 0 var(--space-xxs);
}

/* === Feed Mail Items === */
.mail-item.feed-mail {
  border-left: 3px solid var(--from-color, var(--border-default));
}

.mail-item.feed-mail.tone-critical {
  border-left-color: #ef4444;
}

.mail-item.feed-mail.tone-warning {
  border-left-color: #f59e0b;
}

.mail-item.feed-mail.tone-info {
  border-left-color: #3b82f6;
}

.mail-item .mail-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  flex-shrink: 0;
}

.mail-item .mail-status .material-icons {
  font-size: 20px;
}

.mail-item .mail-actions {
  display: flex;
  gap: var(--space-xxs);
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.mail-item:hover .mail-actions {
  opacity: 1;
}

.mail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xxs);
  margin-top: var(--space-xs);
}

.mail-tag {
  padding: 1px 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 10px;
  color: var(--text-muted);
}

/* === Empty State === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xxl);
  text-align: center;
  color: var(--text-muted);
}

.empty-state.enhanced {
  padding: var(--space-xxl) var(--space-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  max-width: 500px;
  margin: var(--space-xl) auto;
}

.empty-state-icon-wrapper {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.1) 0%, rgba(163, 113, 247, 0.1) 100%);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-lg);
}

.empty-state-icon-wrapper .material-icons {
  font-size: 40px;
  color: var(--accent-primary);
}

.empty-state.enhanced h3 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-sm) 0;
}

.empty-state.enhanced p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 0 var(--space-lg) 0;
  line-height: 1.6;
}

.empty-state-actions {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.empty-state-hint {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.empty-state-hint .material-icons {
  font-size: 14px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.empty-state-message {
  font-size: var(--text-sm);
  max-width: 300px;
}

/* === Loading Spinner === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Generic view loading state */
.view-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg);
  color: var(--text-muted);
  text-align: center;
  gap: var(--space-md);
  min-height: 300px;
  flex: 1;
  width: 100%;
}

.view-loading-state .spinner-large {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.view-loading-state .loading-text {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* === Tooltips === */
/* Tooltip styles moved to line ~2446 - single definition to avoid conflicts */

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 280px;
  max-width: 420px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transform: translateX(100%);
  opacity: 0;
  transition: all var(--transition-base);
}

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

.toast.hide {
  transform: translateX(100%);
  opacity: 0;
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: var(--text-sm);
  line-height: 1.4;
  word-break: break-word;
}

.toast-close {
  padding: var(--space-xs);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast-close .material-icons {
  font-size: 18px;
}

/* Toast Types */
.toast-success {
  border-left: 3px solid var(--status-success);
}

.toast-success .toast-icon {
  color: var(--status-success);
}

.toast-error {
  border-left: 3px solid var(--status-error);
}

.toast-error .toast-icon {
  color: var(--status-error);
}

.toast-warning {
  border-left: 3px solid var(--status-warning);
}

.toast-warning .toast-icon {
  color: var(--status-warning);
}

.toast-info {
  border-left: 3px solid var(--status-info);
}

.toast-info .toast-icon {
  color: var(--status-info);
}

.toast-loading {
  border-left: 3px solid var(--accent-primary);
}

.toast-loading .toast-icon {
  color: var(--accent-primary);
}

.toast-loading .toast-icon.spin {
  animation: spin 1s linear infinite;
}

/* === Feed Items === */
.feed-item {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--event-color, var(--border-default));
  background: var(--bg-secondary);
  transition: background var(--transition-fast);
}

.feed-item:hover {
  background: var(--bg-tertiary);
}

.feed-item.new-event {
  animation: event-slide-in 0.3s ease-out;
}

.feed-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feed-icon .material-icons {
  font-size: 18px;
}

.feed-content {
  flex: 1;
  min-width: 0;
}

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.feed-type {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.feed-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.feed-message {
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--text-primary);
}

.feed-message strong {
  font-weight: 600;
  color: var(--accent-primary);
}

.feed-agent {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 500;
}

.feed-agent .material-icons {
  font-size: 12px;
  vertical-align: middle;
}

.feed-details {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.feed-meta {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.feed-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  font-size: var(--text-xs);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.feed-tag .material-icons {
  font-size: 12px;
}

.feed-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  color: var(--text-muted);
}

.feed-empty .material-icons {
  font-size: 32px;
  opacity: 0.5;
}

/* === Detail Grid (for modals) === */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.detail-item.full-width {
  grid-column: span 2;
}

.detail-item label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mail-detail-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-default);
  margin-bottom: var(--space-md);
}

.mail-detail-body {
  white-space: pre-wrap;
  line-height: 1.6;
}

/* === Agent Pulse Animation === */
.agent-pulse {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: glow 2s infinite;
}

/* === Issue List === */
.issue-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.issue-list li {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-muted);
}

.issue-list li:last-child {
  border-bottom: none;
}

/* === Phase 3: Convoy Detail View === */
.convoy-card.expanded {
  border-color: var(--accent-primary);
}

.convoy-expand-btn {
  padding: var(--space-xs);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.convoy-expand-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.convoy-detail {
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  border-top: 1px solid var(--border-muted);
  margin: 0 var(--space-md);
  padding: var(--space-md) 0;
}

.convoy-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}

@media (max-width: 768px) {
  .convoy-detail-grid {
    grid-template-columns: 1fr;
  }
}

.convoy-detail-section {
  min-width: 0;
}

.convoy-detail-section h4 {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-muted);
}

.convoy-detail-section h4 .material-icons {
  font-size: 16px;
}

.empty-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
}

/* === Issue Tree === */
.issue-tree {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.issue-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.issue-item:hover {
  background: var(--bg-hover);
}

.issue-item .issue-status-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.issue-item.status-open .issue-status-icon {
  color: var(--text-muted);
}

.issue-item.status-in-progress .issue-status-icon {
  color: var(--status-working);
}

.issue-item.status-done .issue-status-icon {
  color: var(--status-done);
}

.issue-item.status-blocked .issue-status-icon {
  color: var(--status-stuck);
}

.issue-title {
  flex: 1;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.issue-assignee {
  font-size: var(--text-xs);
  color: var(--accent-primary);
  flex-shrink: 0;
}

/* === Worker Panel === */
.worker-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.worker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.worker-item:hover {
  background: var(--bg-hover);
}

.worker-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.worker-avatar {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.worker-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.worker-name {
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worker-status {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: capitalize;
}

.worker-item.status-working .worker-avatar {
  background: var(--status-working);
  animation: pulse 1.5s infinite;
}

.worker-item.status-idle .worker-avatar {
  background: var(--status-idle);
}

.worker-item.status-done .worker-avatar {
  background: var(--status-done);
}

.worker-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.worker-task {
  color: var(--text-muted);
}

.worker-task .material-icons {
  font-size: 16px;
}

.btn-sm {
  padding: 2px;
}

.btn-sm .material-icons {
  font-size: 16px;
}

/* === Progress Breakdown === */
.progress-breakdown {
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.progress-bar-stacked {
  display: flex;
  height: 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.progress-segment {
  height: 100%;
  transition: width var(--transition-base);
}

.progress-segment.done {
  background: var(--status-done);
}

.progress-segment.in-progress {
  background: var(--status-working);
}

.progress-segment.pending {
  background: var(--bg-secondary);
}

.progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.legend-item.done .legend-dot {
  background: var(--status-done);
}

.legend-item.in-progress .legend-dot {
  background: var(--status-working);
}

.legend-item.pending .legend-dot {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
}

/* === Issue Chips (with status) === */
.issue-chip.status-open {
  border-left: 2px solid var(--text-muted);
}

.issue-chip.status-in-progress {
  border-left: 2px solid var(--status-working);
}

.issue-chip.status-done {
  border-left: 2px solid var(--status-done);
  text-decoration: line-through;
  opacity: 0.7;
}

.issue-chip.status-blocked {
  border-left: 2px solid var(--status-stuck);
}

/* === Animated Progress Fill === */
.animate-progress {
  animation: progress-fill 0.5s ease-out;
}

@keyframes progress-fill {
  from {
    width: 0;
  }
}

/* === Spin Animation for Running Status === */
.spin {
  animation: spin 1s linear infinite;
}

/* === Convoy Name Styles === */
.convoy-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

/* === Convoy Priority === */
.convoy-priority {
  font-size: var(--text-xs);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  font-weight: 600;
}

.convoy-priority.priority-high {
  color: var(--status-stuck);
  background: rgba(248, 81, 73, 0.15);
}

.convoy-priority.priority-normal {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.convoy-priority.priority-low {
  color: var(--text-muted);
  background: var(--bg-tertiary);
}

/* === Convoy Footer === */
.convoy-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.convoy-stats {
  display: flex;
  gap: var(--space-md);
}

.convoy-stats span {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
}

.convoy-stats .material-icons {
  font-size: 14px;
}

/* === Convoy Issues (chips) === */
.convoy-issues {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: 0 var(--space-md) var(--space-sm);
}

.issue-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  padding: var(--space-xxs) var(--space-sm);
  font-size: var(--text-xs);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.issue-chip .material-icons {
  font-size: 12px;
}

.issue-chip.more {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
}

/* === Convoy Progress Bar === */
.convoy-progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-md) var(--space-md);
}

/* === Convoy Status Icon === */
.convoy-status {
  flex-shrink: 0;
}

.convoy-status .material-icons {
  font-size: 24px;
}

.convoy-status.status-pending .material-icons {
  color: var(--text-muted);
}

.convoy-status.status-running .material-icons {
  color: var(--status-running);
}

.convoy-status.status-complete .material-icons {
  color: var(--status-done);
}

.convoy-status.status-failed .material-icons {
  color: var(--status-stuck);
}

.convoy-status.status-cancelled .material-icons {
  color: var(--text-muted);
}

/* ============================================
   AUTOCOMPLETE
   ============================================ */

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  margin-top: var(--space-xs);
}

.autocomplete-dropdown.hidden {
  display: none;
}

.autocomplete-item {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.15s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--bg-hover);
}

.autocomplete-item.selected {
  background: rgba(88, 166, 255, 0.1);
}

.autocomplete-label {
  font-weight: 500;
}

.autocomplete-desc {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.autocomplete-empty {
  padding: var(--space-md);
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* Bead Item in Autocomplete */
.bead-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.bead-item .bead-icon {
  font-size: 1.2rem;
}

.bead-item .bead-id {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-primary);
}

.bead-item .bead-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bead-item .bead-desc {
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.bead-item .bead-status {
  font-size: var(--text-xs);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  background: var(--bg-tertiary);
}

.bead-item.formula {
  background: rgba(242, 201, 76, 0.05);
}

/* Agent Item in Autocomplete */
.agent-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.agent-item .agent-name {
  font-weight: 500;
}

.agent-item .agent-path {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.agent-item .agent-status {
  margin-left: auto;
  font-size: var(--text-xs);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* Target Select Option Styles */
.target-busy {
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   ESCALATION MODAL
   ============================================ */

.escalation-header {
  background: linear-gradient(135deg, var(--accent-danger) 0%, #dc2626 100%);
  color: white;
  margin: calc(var(--space-md) * -1);
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.escalation-header h2 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: white;
}

.escalation-header .warning-icon {
  font-size: 1.5rem;
  animation: pulse 1.5s infinite;
}

.escalation-header .modal-close {
  color: white;
}

.escalation-header .modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.escalation-info {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.escalation-info p {
  margin: 0;
}

.escalation-info p + p {
  margin-top: var(--space-xs);
}

.escalation-warning {
  color: var(--accent-danger);
  font-size: var(--text-sm);
  font-style: italic;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

/* ============================================
   NUDGE ENHANCEMENTS
   ============================================ */

.nudge-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.nudge-quick-btn {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nudge-quick-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

/* Pulse Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

/* ============================================
   HELP MODAL & ONBOARDING
   ============================================ */

.modal-lg {
  max-width: 800px;
  width: 90%;
}

.help-content {
  max-height: 70vh;
  overflow-y: auto;
}

.help-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-default);
  padding-bottom: var(--space-sm);
}

.help-tab {
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.help-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.help-tab.active {
  color: var(--accent-primary);
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--accent-primary);
  margin-bottom: -1px;
}

.help-panel {
  display: none;
}

.help-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glossary Grid */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md);
}

.glossary-item {
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--accent-primary);
}

.glossary-term {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.glossary-term .material-icons {
  font-size: 20px;
  color: var(--accent-primary);
}

.glossary-def {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Roles Grid */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md);
}

.role-card {
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  transition: all var(--transition-fast);
}

.role-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-sm);
}

.role-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.role-icon {
  font-size: 24px;
}

.role-header h4 {
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0;
}

.role-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Role-specific colors */
.role-card.role-mayor {
  border-left: 3px solid var(--role-mayor);
}
.role-card.role-mayor .role-header h4 {
  color: var(--role-mayor);
}

.role-card.role-deacon {
  border-left: 3px solid var(--role-deacon);
}
.role-card.role-deacon .role-header h4 {
  color: var(--role-deacon);
}

.role-card.role-witness {
  border-left: 3px solid var(--role-witness);
}
.role-card.role-witness .role-header h4 {
  color: var(--role-witness);
}

.role-card.role-refinery {
  border-left: 3px solid var(--role-refinery);
}
.role-card.role-refinery .role-header h4 {
  color: var(--role-refinery);
}

.role-card.role-polecat {
  border-left: 3px solid var(--role-polecat);
}
.role-card.role-polecat .role-header h4 {
  color: var(--role-polecat);
}

/* Workflow Steps */
.workflow-steps {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.workflow-step {
  display: flex;
  gap: var(--space-sm);
  flex: 1;
  min-width: 180px;
  max-width: 220px;
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.step-content h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 var(--space-xs) 0;
  color: var(--text-primary);
}

.step-content p {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.workflow-arrow {
  display: flex;
  align-items: center;
  font-size: 24px;
  color: var(--text-muted);
  padding-top: var(--space-lg);
}

@media (max-width: 768px) {
  .workflow-arrow {
    display: none;
  }
  .workflow-step {
    max-width: none;
  }
}

.workflow-tip {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.workflow-tip .material-icons {
  color: var(--accent-primary);
  font-size: 20px;
  flex-shrink: 0;
}

/* Shortcuts Grid */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-lg);
}

.shortcut-group h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-sm) 0;
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-default);
}

.shortcut {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.shortcut kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  color: var(--text-primary);
}

/* ============================================
   IMPROVED TOOLTIPS (appear BELOW elements)
   ============================================ */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-md);
  font-size: var(--text-xs);
  font-weight: normal;
  text-align: center;
  max-width: 280px;
  min-width: 120px;
  width: max-content;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  z-index: var(--z-tooltip);
  /* Force background to cover all content */
  box-sizing: border-box;
  display: block;
}

/* Tooltip arrow pointing up */
[data-tooltip]::before {
  content: '';
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--bg-elevated);
  filter: drop-shadow(0 -1px 0 var(--border-default));
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  z-index: calc(var(--z-tooltip) + 1);
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   SIDEBAR ROLE COLORS
   ============================================ */

.role-mayor {
  color: var(--role-mayor) !important;
}

.role-deacon {
  color: var(--role-deacon) !important;
}

.role-witness {
  color: var(--role-witness) !important;
}

.role-refinery {
  color: var(--role-refinery) !important;
}

.role-polecat {
  color: var(--role-polecat) !important;
}

/* Tree View Improvements */
.tree-view {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tree-view ul {
  list-style: none;
  padding-left: var(--space-md);
  margin: 0;
}

.tree-node {
  margin: var(--space-xxs) 0;
}

.tree-node-content {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tree-node-content:hover {
  background: var(--bg-hover);
}

.tree-icon {
  font-size: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tree-label {
  flex: 1;
  font-size: var(--text-sm);
}

.tree-badge {
  padding: 2px 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.tree-children {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.tree-node.expandable:not(.expanded) .tree-children {
  max-height: 0;
}

.tree-node.expandable .tree-icon {
  transition: transform var(--transition-fast);
}

.tree-node.expandable:not(.expanded) .tree-icon {
  transform: rotate(-90deg);
}

.tree-task {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status icon colors in tree */
.status-idle {
  color: var(--status-idle);
}

.status-working {
  color: var(--status-working);
}

.status-running {
  color: var(--status-running);
}

.status-complete {
  color: var(--status-done);
}

.status-error {
  color: var(--status-stuck);
}

/* Sidebar Section Styling */
.sidebar-section {
  margin-bottom: var(--space-lg);
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  padding: 0 var(--space-sm);
}

.sidebar-title .material-icons {
  font-size: 16px;
}

.hook-section .hook-card {
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-primary);
}

.hook-bead {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent-primary);
}

.hook-meta {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.hook-status {
  font-size: var(--text-xs);
  text-transform: uppercase;
  font-weight: 500;
}

.hook-title {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.stat-icon {
  font-size: 18px;
  color: var(--accent-primary);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ============================================
   AGENT QUICK ACTIONS POPOVER
   ============================================ */

.agent-quick-actions {
  font-size: var(--text-sm);
}

.agent-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-default);
}

.agent-popover-name {
  font-weight: 600;
  color: var(--text-primary);
}

.agent-popover-status {
  font-size: var(--text-xs);
  text-transform: uppercase;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
}

.agent-popover-status.status-working {
  color: var(--status-working);
  background: rgba(210, 153, 34, 0.15);
}

.agent-popover-status.status-idle {
  color: var(--status-idle);
  background: rgba(110, 118, 129, 0.15);
}

.agent-popover-task {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: var(--space-md);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.agent-popover-actions {
  display: flex;
  gap: var(--space-xs);
}

.agent-popover-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: var(--text-xs);
  padding: var(--space-xs) var(--space-sm);
}

.agent-popover-actions .btn .material-icons {
  font-size: 14px;
}

/* Agent card highlight animation */
.agent-card.highlight {
  animation: highlightPulse 0.5s ease 3;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.3);
}

@keyframes highlightPulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(88, 166, 255, 0.5);
  }
}

/* Dynamic tooltip styling */
.dynamic-tooltip {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
}

/* ============================================
   INTERACTIVE TUTORIAL
   ============================================ */

.tutorial-modal {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 10000;
  animation: slideUp 0.3s ease;
  pointer-events: none;
}

.tutorial-content {
  background: var(--bg-secondary);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(88, 166, 255, 0.3);
  max-width: 420px;
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  pointer-events: auto;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.tutorial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-default);
}

.tutorial-progress {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.tutorial-step-num {
  font-weight: 600;
  color: var(--accent-primary);
}

.tutorial-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.tutorial-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tutorial-title {
  font-size: var(--text-xl);
  font-weight: 600;
  padding: var(--space-lg);
  padding-bottom: 0;
  color: var(--text-primary);
}

.tutorial-body {
  padding: var(--space-lg);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-secondary);
}

.tutorial-body p {
  margin: 0 0 var(--space-md) 0;
}

.tutorial-body ul, .tutorial-body ol {
  margin: var(--space-sm) 0 var(--space-md) var(--space-lg);
  padding: 0;
}

.tutorial-body li {
  margin-bottom: var(--space-xs);
}

.tutorial-body code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.tutorial-body kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-default);
  gap: var(--space-md);
}

.tutorial-dots {
  display: flex;
  gap: var(--space-xs);
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tutorial-dot:hover {
  background: var(--text-muted);
}

.tutorial-dot.active {
  background: var(--accent-primary);
  transform: scale(1.2);
}

.tutorial-dot.completed {
  background: var(--status-done);
}

/* Tutorial content styling */
.tutorial-concepts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}

.concept-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
}

.concept-pill .material-icons {
  font-size: 14px;
  color: var(--accent-primary);
}

.role-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.role-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--text-muted);
}

.role-item .material-icons {
  font-size: 24px;
}

.role-item div {
  display: flex;
  flex-direction: column;
}

.role-item strong {
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.role-item span {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.role-item.role-mayor { border-left-color: var(--role-mayor); }
.role-item.role-mayor .material-icons { color: var(--role-mayor); }

.role-item.role-deacon { border-left-color: var(--role-deacon); }
.role-item.role-deacon .material-icons { color: var(--role-deacon); }

.role-item.role-polecat { border-left-color: var(--role-polecat); }
.role-item.role-polecat .material-icons { color: var(--role-polecat); }

.role-item.role-witness { border-left-color: var(--role-witness); }
.role-item.role-witness .material-icons { color: var(--role-witness); }

.role-item.role-refinery { border-left-color: var(--role-refinery); }
.role-item.role-refinery .material-icons { color: var(--role-refinery); }

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}

.status-dot.running { background: var(--status-running); }
.status-dot.working { background: var(--status-working); }
.status-dot.idle { background: var(--status-idle); }

.sling-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  margin: var(--space-md) 0;
}

.sling-from, .sling-to {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.sling-from .material-icons { color: var(--accent-warning); }
.sling-to .material-icons { color: var(--accent-primary); }

.sling-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--status-running);
  font-weight: 600;
}

.sling-arrow .material-icons {
  font-size: 32px;
  animation: pulse 1.5s infinite;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

.shortcut-grid div {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
}

.workflow-checklist {
  list-style: none;
  padding: 0;
  margin: var(--space-md) 0;
}

.workflow-checklist li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xs);
}

.workflow-checklist .material-icons {
  color: var(--status-done);
}

/* Tutorial highlight overlay - no blackout, just border */
.tutorial-highlight {
  position: fixed;
  border: 3px solid var(--accent-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 15px rgba(88, 166, 255, 0.5), 0 0 30px rgba(88, 166, 255, 0.3);
  pointer-events: none;
  z-index: 9999;
  animation: highlightPulse 2s infinite;
  display: none;
  background: transparent;
}

/* ================================================
   ONBOARDING WIZARD
   ================================================ */

/* Wizard Container */
.onboarding-wizard {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wizard-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.wizard-container {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(88, 166, 255, 0.15);
  overflow: hidden;
  animation: wizardSlideIn 0.4s ease-out;
}

@keyframes wizardSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Progress Bar */
.wizard-progress {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-default);
  overflow-x: auto;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  min-width: 80px;
  opacity: 0.4;
  transition: all 0.3s ease;
}

.progress-step.active {
  opacity: 1;
}

.progress-step.completed {
  opacity: 0.7;
}

.progress-dot {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 2px solid var(--border-default);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.progress-step.active .progress-dot {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px rgba(88, 166, 255, 0.4);
}

.progress-step.completed .progress-dot {
  background: var(--status-done);
  border-color: var(--status-done);
}

.progress-dot .material-icons {
  font-size: 20px;
  color: var(--text-secondary);
}

.progress-step.active .progress-dot .material-icons,
.progress-step.completed .progress-dot .material-icons {
  color: white;
}

.progress-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
}

.progress-step.active .progress-label {
  color: var(--text-primary);
  font-weight: 600;
}

/* Wizard Content */
.wizard-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.wizard-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.wizard-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-primary), #7c3aed);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 15px rgba(88, 166, 255, 0.3);
}

.wizard-icon .material-icons {
  font-size: 28px;
  color: white;
}

.wizard-titles {
  flex: 1;
}

.wizard-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.wizard-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: var(--space-xs) 0 0;
}

.wizard-close {
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.wizard-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Wizard Body */
.wizard-body {
  flex: 1;
  padding: var(--space-xl);
  overflow-y: auto;
}

/* Wizard Error */
.wizard-error {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0 var(--space-xl);
  padding: var(--space-md);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: var(--accent-danger);
}

.wizard-error .material-icons {
  font-size: 20px;
}

/* Wizard Footer */
.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-default);
}

.wizard-step-indicator {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.wizard-footer .btn {
  min-width: 120px;
}

/* Spinning animation for loading */
.spinning {
  animation: spin 1s linear infinite;
}

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

/* ================================================
   ONBOARDING STEP CONTENT STYLES
   ================================================ */

/* Welcome Step */
.onboard-welcome {
  text-align: center;
}

.onboard-lead {
  font-size: var(--text-lg);
  color: var(--text-primary);
  margin-bottom: var(--space-xl);
}

.onboard-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin: var(--space-xl) 0;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  min-width: 100px;
}

.flow-icon {
  font-size: 32px;
}

.flow-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.flow-arrow {
  font-size: var(--text-xl);
  color: var(--text-muted);
}

.onboard-note {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* Setup Checks */
.onboard-checks {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.check-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.check-item.checking {
  opacity: 0.7;
}

.check-item.success .check-status .material-icons {
  color: var(--status-done);
}

.check-item.warning .check-status .material-icons {
  color: var(--status-working);
}

.check-item.error .check-status .material-icons {
  color: var(--accent-danger);
}

.check-status {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.check-label {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
}

.check-detail {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.onboard-setup-result {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  text-align: center;
}

.setup-success {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  color: var(--status-done);
  font-weight: 500;
}

.setup-issues {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  color: var(--status-working);
  font-weight: 500;
}

/* Form Styles */
.onboard-form .form-group {
  margin-bottom: var(--space-lg);
}

.onboard-explain {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}

.form-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.selected-bead {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.selected-bead .material-icons {
  color: var(--accent-primary);
}

.selected-bead code {
  font-family: var(--font-mono);
  color: var(--accent-primary);
}

.created-bead,
.created-convoy,
.sling-success {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-md);
  color: var(--status-done);
  margin-top: var(--space-md);
}

.created-bead .material-icons,
.created-convoy .material-icons,
.sling-success .material-icons {
  color: var(--status-done);
}

/* Sling Preview */
.sling-preview {
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
}

.sling-arrow-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}

.sling-from,
.sling-to {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  min-width: 100px;
}

.sling-arrow {
  color: var(--accent-primary);
}

.sling-arrow .material-icons {
  font-size: 32px;
  animation: slingSway 1.5s ease-in-out infinite;
}

@keyframes slingSway {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(8px); }
}

/* Complete Step */
.onboard-complete {
  text-align: center;
}

.complete-icon {
  font-size: 64px;
  margin-bottom: var(--space-lg);
}

.complete-message {
  font-size: var(--text-lg);
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.complete-list {
  list-style: none;
  padding: 0;
  margin: 0 auto var(--space-xl);
  max-width: 300px;
}

.complete-list li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  text-align: left;
}

.complete-list .material-icons {
  color: var(--status-done);
}

.next-steps {
  text-align: left;
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
}

.next-steps h4 {
  color: var(--text-primary);
  margin: 0 0 var(--space-sm);
}

.next-steps p {
  color: var(--text-secondary);
  margin: 0 0 var(--space-md);
}

.tips {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.tip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.tip .material-icons {
  font-size: 18px;
  color: var(--accent-primary);
}

.tip kbd {
  padding: 2px 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

/* Help Modal Actions */
.help-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-default);
}

.help-actions .btn {
  flex: 1;
}

/* === Work/Bead Cards === */
.work-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  flex: 1;
  min-height: 0;
  padding: var(--space-lg);
  overflow-y: auto;
}

.bead-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bead-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-muted);
}

.bead-card.status-closed {
  border-left: 3px solid var(--accent-success);
}

.bead-card.status-open {
  border-left: 3px solid var(--accent-warning);
}

.bead-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.bead-status {
  flex-shrink: 0;
}

.bead-status .material-icons {
  font-size: 20px;
}

.status-closed .bead-status .material-icons {
  color: var(--accent-success);
}

.status-open .bead-status .material-icons {
  color: var(--accent-warning);
}

.bead-info {
  flex: 1;
  min-width: 0;
}

.bead-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs) 0;
}

.bead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.bead-meta .material-icons {
  font-size: 14px;
  vertical-align: middle;
}

.bead-id {
  font-family: var(--font-mono);
  color: var(--accent-primary);
}

.bead-type {
  display: flex;
  align-items: center;
  gap: 2px;
}

.bead-assignee {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--text-secondary);
}

.bead-priority {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
}

.bead-priority.priority-0 {
  background: #dc262620;
  color: #dc2626;
}

.bead-priority.priority-1 {
  background: #f9731620;
  color: #f97316;
}

.bead-priority.priority-2 {
  background: #3b82f620;
  color: #3b82f6;
}

.bead-result {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: var(--accent-success)10;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.bead-result .material-icons {
  font-size: 16px;
  color: var(--accent-success);
  flex-shrink: 0;
}

.result-text {
  line-height: 1.4;
}

.bead-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* === Commit/PR Links in Work List === */
.commit-link,
.pr-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  background: var(--accent-primary)15;
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
  font-family: var(--font-mono);
  font-size: 0.9em;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.commit-link:hover,
.pr-link:hover {
  background: var(--accent-primary)30;
  color: var(--accent-primary);
}

.commit-link .material-icons,
.pr-link .material-icons {
  font-size: 14px;
}

/* === Bead Detail Modal === */
.bead-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.bead-detail-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.bead-detail-title-row h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.bead-detail-title-row .status-icon {
  font-size: 24px;
}

.bead-detail-title-row .status-icon.status-closed {
  color: var(--accent-success);
}

.bead-detail-title-row .status-icon.status-open {
  color: var(--accent-warning);
}

.bead-detail-body {
  max-height: 60vh;
  overflow-y: auto;
}

.bead-detail-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-muted);
}

.meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.meta-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  min-width: 80px;
}

.meta-value {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.meta-value .material-icons {
  font-size: 16px;
  color: var(--text-muted);
}

.bead-id-code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
}

.btn-xs {
  width: 24px;
  height: 24px;
  padding: 0;
}

.btn-xs .material-icons {
  font-size: 14px;
}

.priority-badge {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
}

.priority-badge.priority-0 {
  background: #dc262620;
  color: #dc2626;
}

.priority-badge.priority-1 {
  background: #f9731620;
  color: #f97316;
}

.priority-badge.priority-2 {
  background: #3b82f620;
  color: #3b82f6;
}

.priority-badge.priority-3,
.priority-badge.priority-4 {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.status-badge {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: capitalize;
}

.status-badge.status-open {
  background: #f9731620;
  color: #f97316;
}

.status-badge.status-closed {
  background: #22c55e20;
  color: #22c55e;
}

.status-badge.status-in-progress,
.status-badge.status-in_progress {
  background: #3b82f620;
  color: #3b82f6;
}

.status-badge.status-blocked {
  background: #dc262620;
  color: #dc2626;
}

.bead-detail-section {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-muted);
}

.bead-detail-section h4 {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm) 0;
}

.bead-detail-section h4 .material-icons {
  font-size: 18px;
  color: var(--accent-success);
}

.bead-description {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.bead-close-reason {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.6;
  padding: var(--space-sm);
  background: var(--accent-success)08;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-success);
}

.completion-section h4 {
  color: var(--accent-success);
}

/* Bead Links Section */
.bead-links-section h4 .material-icons {
  color: var(--accent-primary);
}

.bead-links-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.loading-inline {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  padding: var(--space-sm);
}

.loading-inline .spinning {
  animation: spin 1s linear infinite;
}

.no-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-sm);
}

.pr-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s ease;
}

.pr-link:hover {
  background: var(--bg-hover);
}

.pr-link > .material-icons:first-child {
  font-size: 20px;
  color: var(--accent-primary);
}

.pr-link.pr-state-merged > .material-icons:first-child {
  color: var(--accent-purple, #a855f7);
}

.pr-link.pr-state-closed > .material-icons:first-child {
  color: var(--accent-danger);
}

.pr-link.pr-state-open > .material-icons:first-child {
  color: var(--accent-success);
}

.pr-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pr-title {
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pr-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.pr-link .open-icon {
  font-size: 16px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.pr-link:hover .open-icon {
  opacity: 1;
}

.code-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent-primary)15;
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-decoration: none;
  cursor: pointer;
}

.code-link:hover {
  background: var(--accent-primary)25;
}

.code-link .material-icons {
  font-size: 14px;
}

.filename {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: 1px 4px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  color: var(--text-secondary);
}

.bead-labels {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.label-tag {
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* Copy toast animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* === Peek Modal === */
#peek-modal .modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

#peek-modal .modal-header h2 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.peek-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.peek-auto-refresh {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.peek-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.peek-status .status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.peek-status.running .status-indicator {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  animation: pulse 2s infinite;
}

.peek-status.stopped .status-indicator {
  background: #6b7280;
}

.peek-status.error .status-indicator {
  background: #ef4444;
}

.peek-output {
  background: #0d1117;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  max-height: 500px;
  overflow: auto;
}

.peek-output pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: #c9d1d9;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ANSI color support in output */
.peek-output .ansi-bold { font-weight: bold; }
.peek-output .ansi-red { color: #f85149; }
.peek-output .ansi-green { color: #3fb950; }
.peek-output .ansi-yellow { color: #d29922; }
.peek-output .ansi-blue { color: #58a6ff; }
.peek-output .ansi-magenta { color: #bc8cff; }
.peek-output .ansi-cyan { color: #39c5cf; }

.peek-status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
}

.peek-status-badge .material-icons {
  font-size: 1rem;
}

.peek-status-badge.status-running {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.peek-status-badge.status-stopped {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

.peek-status-badge.status-error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.peek-session-info {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--surface-lighter);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* === Pull Requests View === */

.pr-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-md);
}

.pr-state-tab {
  background: transparent;
  border: 1px solid var(--surface-lighter);
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.pr-state-tab:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none;
}

.pr-state-tab:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: none;
}

.pr-state-tab:not(:first-child):not(:last-child) {
  border-radius: 0;
}

.pr-state-tab:hover {
  background: var(--surface-lighter);
  color: var(--text-primary);
}

.pr-state-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.pr-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--surface-lighter);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pr-card:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}

.pr-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--surface-lighter);
  color: var(--text-muted);
  flex-shrink: 0;
}

.pr-icon .material-icons {
  font-size: 20px;
}

.pr-icon.open {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.pr-icon.merged {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.pr-icon.closed {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.pr-icon.draft {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

.pr-content {
  flex: 1;
  min-width: 0;
}

.pr-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.pr-number {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.pr-title {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pr-draft-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-lighter);
  color: var(--text-muted);
}

.pr-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

.pr-meta .material-icons {
  font-size: 14px;
}

.pr-review .material-icons {
  font-size: 16px;
}

.pr-review .approved { color: #22c55e; }
.pr-review .changes-requested { color: #f59e0b; }
.pr-review .review-required { color: #6b7280; }

.pr-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Loading and Empty States */
.pr-list .loading-state,
.pr-list .empty-state,
.pr-list .error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--text-muted);
  text-align: center;
  min-height: 300px;
  flex: 1;
  width: 100%;
}

.non-github-state .empty-state-actions {
  margin-top: var(--space-md);
}

.pr-list .loading-state .loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-md);
}

.pr-list .empty-state .material-icons,
.pr-list .error-state .material-icons {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.pr-list .error-state .material-icons {
  color: var(--error);
}

.pr-list .error-state small {
  margin-top: var(--space-xs);
  font-size: 0.75rem;
}

/* === Agent Controls === */

.agent-controls {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
}

.btn-success-ghost {
  color: #22c55e;
}

.btn-success-ghost:hover {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.btn-danger-ghost {
  color: #ef4444;
}

.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.spinning {
  animation: spin 1s linear infinite;
}

.rig-agent {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}

.rig-agent:hover {
  background: var(--surface-lighter);
}

.rig-agent .agent-icon {
  font-size: 18px;
}

.rig-agent .agent-name {
  font-weight: 500;
  color: var(--text-primary);
}

.rig-agent .agent-role {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rig-agent .agent-status .material-icons {
  font-size: 14px;
}

.rig-agent .agent-work-badge {
  font-size: 14px;
}

/* === Formula Cards === */
.formula-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-md);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
  padding: var(--space-md);
}

.formula-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: all var(--transition-fast);
}

.formula-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.formula-header {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.formula-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.formula-icon .material-icons {
  font-size: 24px;
  color: white;
}

.formula-info {
  flex: 1;
  min-width: 0;
}

.formula-name {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs);
}

.formula-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.formula-template {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  overflow: hidden;
}

.formula-template code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.formula-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: auto;
}

/* Formula detail view (in peek modal) */
.formula-detail h3 {
  font-size: var(--text-xl);
  color: var(--text-primary);
  margin: 0 0 var(--space-sm);
}

.formula-detail .description {
  color: var(--text-secondary);
  margin: 0 0 var(--space-lg);
}

.formula-detail .template-section,
.formula-detail .args-section {
  margin-bottom: var(--space-lg);
}

.formula-detail h4 {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 var(--space-sm);
}

.formula-detail .template-code,
.formula-detail .args-code {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: pre-wrap;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
}

/* === Service Controls === */
.service-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}

.service-item:hover {
  background: var(--bg-tertiary);
}

.service-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.service-icon {
  font-size: 18px;
}

.service-name {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.service-status {
  font-size: var(--text-xs);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.service-status.status-running {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.service-status.status-stopped {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.service-actions {
  display: flex;
  gap: var(--space-xs);
}

.btn-icon.btn-xs {
  width: 28px;
  height: 28px;
  padding: 0;
}

.btn-icon.btn-xs .material-icons {
  font-size: 16px;
}

/* === Work/Bead Action Buttons === */
.bead-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.bead-actions {
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.bead-card:hover .bead-actions {
  opacity: 1;
}

.btn-xs {
  padding: 4px 8px;
  font-size: var(--text-xs);
}

.btn-xs .material-icons {
  font-size: 16px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-success-ghost {
  background: transparent;
  color: #22c55e;
  border: none;
}

.btn-success-ghost:hover {
  background: rgba(34, 197, 94, 0.15);
}

.btn-danger-ghost {
  background: transparent;
  color: #ef4444;
  border: none;
}

.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* === GitHub Issues === */
.issue-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-md);
}

.issue-state-tab {
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.issue-state-tab:hover {
  color: var(--text-primary);
}

.issue-state-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.issue-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: all var(--transition-fast);
}

.issue-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.issue-card.issue-closed {
  opacity: 0.7;
}

.issue-header {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  margin-bottom: var(--space-sm);
}

.issue-state-icon .material-icons {
  font-size: 20px;
}

.issue-info {
  flex: 1;
  min-width: 0;
}

.issue-title {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  display: block;
  margin-bottom: var(--space-xs);
}

.issue-title:hover {
  color: var(--accent-primary);
}

.issue-meta {
  display: flex;
  gap: var(--space-md);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.issue-number {
  color: var(--text-tertiary);
}

.issue-repo {
  font-family: var(--font-mono);
}

.issue-rig {
  color: var(--accent-secondary);
}

.issue-labels {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.issue-label {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: white;
}

.issue-footer {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.issue-author,
.issue-assignees {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.issue-author .material-icons,
.issue-assignees .material-icons {
  font-size: 14px;
}

.issue-time {
  color: var(--text-tertiary);
  margin-left: auto;
}

.issue-actions {
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.issue-card:hover .issue-actions {
  opacity: 1;
}

.text-success {
  color: #22c55e;
}

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

/* Generic loading/empty/error states for list containers */
.issue-list .loading-state,
.issue-list .empty-state,
.issue-list .error-state,
.formula-list .loading-state,
.formula-list .empty-state,
.formula-list .error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--text-muted);
  text-align: center;
  min-height: 300px;
  flex: 1;
  width: 100%;
  grid-column: 1 / -1; /* Span full width in grid layouts */
}

.issue-list .loading-state .loading-spinner,
.formula-list .loading-state .loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-md);
}

.issue-list .empty-state .material-icons,
.issue-list .error-state .material-icons,
.formula-list .empty-state .material-icons,
.formula-list .error-state .material-icons {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

/* === Mail Detail Modal === */
.mail-detail-meta {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
}

.mail-detail-row {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
}

.mail-detail-row:not(:last-child) {
  border-bottom: 1px solid var(--border-subtle);
}

.mail-detail-label {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 60px;
}

.mail-detail-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.mail-detail-body {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  max-height: 400px;
  overflow-y: auto;
}

.mail-detail-body pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
}

/* === Transcript Modal === */
#transcript-modal {
  max-width: 900px;
  max-height: 85vh;
}

#transcript-modal .modal-header h2 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

#transcript-modal .modal-header h2 .material-icons {
  color: var(--accent-primary);
}

.transcript-body {
  max-height: 70vh;
  overflow-y: auto;
}

.transcript-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
}

.transcript-loading .loading-spinner {
  width: 36px;
  height: 36px;
  margin-bottom: var(--space-md);
}

.transcript-section {
  margin-bottom: var(--space-xl);
}

.transcript-section:last-child {
  margin-bottom: 0;
}

.transcript-section h3 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  color: var(--text-primary);
  font-size: var(--text-md);
}

.transcript-section h3 .material-icons {
  color: var(--accent-primary);
  font-size: 20px;
}

.transcript-files {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.transcript-file {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.transcript-file-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-default);
}

.transcript-file-header .material-icons {
  color: var(--text-secondary);
  font-size: 18px;
}

.transcript-filename {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
  flex: 1;
}

.transcript-date {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.transcript-content {
  margin: 0;
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.transcript-content.tmux-output {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.transcript-empty,
.transcript-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  text-align: center;
}

.transcript-empty .material-icons {
  font-size: 48px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.transcript-error .material-icons {
  font-size: 48px;
  color: var(--accent-danger);
  margin-bottom: var(--space-md);
}

.transcript-empty p,
.transcript-error p {
  margin: 0;
  color: var(--text-secondary);
}

.transcript-empty .hint {
  margin-top: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* === Health Check === */
.health-check-container {
  padding: var(--space-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0; /* Allow flex shrinking */
}

.health-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
  min-height: 300px;
  gap: var(--space-lg);
}

.health-loading .loading-spinner {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-lg);
}

.health-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  text-align: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
}

.health-error .material-icons {
  font-size: 64px;
  color: var(--accent-danger);
  margin-bottom: var(--space-md);
}

.health-error h3 {
  margin: 0 0 var(--space-sm);
  color: var(--text-primary);
}

.health-error p {
  margin: 0 0 var(--space-lg);
  color: var(--text-secondary);
}

/* Health Summary */
.health-summary {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  margin-bottom: var(--space-xl);
}

.health-summary.health-pass {
  border-color: var(--accent-success);
  background: rgba(76, 175, 80, 0.05);
}

.health-summary.health-warn {
  border-color: var(--accent-warning);
  background: rgba(255, 152, 0, 0.05);
}

.health-summary.health-fail {
  border-color: var(--accent-danger);
  background: rgba(244, 67, 54, 0.05);
}

.health-summary-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.health-pass .health-summary-icon {
  background: rgba(76, 175, 80, 0.15);
}

.health-warn .health-summary-icon {
  background: rgba(255, 152, 0, 0.15);
}

.health-fail .health-summary-icon {
  background: rgba(244, 67, 54, 0.15);
}

.health-summary-icon .material-icons {
  font-size: 36px;
}

.health-pass .health-summary-icon .material-icons {
  color: var(--accent-success);
}

.health-warn .health-summary-icon .material-icons {
  color: var(--accent-warning);
}

.health-fail .health-summary-icon .material-icons {
  color: var(--accent-danger);
}

.health-summary-info {
  flex: 1;
}

.health-summary-info h2 {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-xl);
}

.health-summary-stats {
  display: flex;
  gap: var(--space-md);
}

.health-stat {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
}

.health-stat .material-icons {
  font-size: 16px;
}

.health-stat.pass {
  color: var(--accent-success);
}

.health-stat.warn {
  color: var(--accent-warning);
}

.health-stat.fail {
  color: var(--accent-danger);
}

.health-summary-time {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* Health Checks List */
.health-checks {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.health-check-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  transition: all var(--transition-fast);
}

.health-check-item:hover {
  background: var(--bg-tertiary);
}

.health-check-item.health-pass {
  border-left: 3px solid var(--accent-success);
}

.health-check-item.health-warn {
  border-left: 3px solid var(--accent-warning);
}

.health-check-item.health-fail {
  border-left: 3px solid var(--accent-danger);
}

.health-check-status {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.health-pass .health-check-status .material-icons {
  color: var(--accent-success);
}

.health-warn .health-check-status .material-icons {
  color: var(--accent-warning);
}

.health-fail .health-check-status .material-icons {
  color: var(--accent-danger);
}

.health-check-info {
  flex: 1;
  min-width: 0;
}

.health-check-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.health-check-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.health-check-details {
  margin-top: var(--space-sm);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.health-check-details pre {
  margin: 0;
  padding: var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text-secondary);
}

.health-check-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.health-pass .health-check-label {
  color: var(--accent-success);
  background: rgba(76, 175, 80, 0.1);
}

.health-warn .health-check-label {
  color: var(--accent-warning);
  background: rgba(255, 152, 0, 0.1);
}

.health-fail .health-check-label {
  color: var(--accent-danger);
  background: rgba(244, 67, 54, 0.1);
}

/* Health Empty State */
.health-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl);
  color: var(--text-secondary);
}

.health-empty .material-icons {
  font-size: 48px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

/* Health Recommendations */
.health-recommendations {
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
}

.health-recommendations h3 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0 0 var(--space-md);
  color: var(--accent-primary);
}

.health-recommendations h3 .material-icons {
  font-size: 20px;
}

.health-recommendations ul {
  margin: 0;
  padding-left: var(--space-xl);
}

.health-recommendations li {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.health-recommendations li:last-child {
  margin-bottom: 0;
}

/* Health Raw Output */
.health-raw {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  overflow: hidden;
}

.health-raw pre {
  margin: 0;
  padding: var(--space-lg);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text-primary);
}

/* ============================================
   DASHBOARD - EXPERT UI/UX DESIGN
   Color Theory: Using AGENT_TYPES palette with
   harmonious gradients and accessible contrast
   ============================================ */

/* Dashboard Layout - Fill all available space */
.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Loading Skeleton */
.dashboard-loading {
  padding: var(--space-lg);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.skeleton-card {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-lg);
  height: 120px;
}

.skeleton-card.large {
  height: 80px;
  grid-column: 1 / -1;
}

.skeleton-card.wide {
  grid-column: span 2;
  height: 200px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Error State */
.dashboard-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xxl);
  text-align: center;
  color: var(--text-secondary);
}

.dashboard-error .material-icons {
  font-size: 64px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-lg);
}

.dashboard-error h3 {
  margin: 0 0 var(--space-sm);
  color: var(--text-primary);
}

.dashboard-error p {
  margin: 0 0 var(--space-lg);
  color: var(--text-secondary);
}

/* Health Banner - Balanced design */
.health-banner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    135deg,
    rgba(var(--health-color-rgb, 34, 197, 94), 0.15) 0%,
    rgba(var(--health-color-rgb, 34, 197, 94), 0.05) 100%
  );
  border: 1px solid var(--health-color, #22c55e);
  flex-shrink: 0;
}

.health-banner:hover {
  background: linear-gradient(
    135deg,
    rgba(var(--health-color-rgb, 34, 197, 94), 0.2) 0%,
    rgba(var(--health-color-rgb, 34, 197, 94), 0.08) 100%
  );
}

.health-banner-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--health-color);
  color: white;
  flex-shrink: 0;
}

.health-banner-icon .material-icons {
  font-size: 20px;
}

.health-banner-text {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.health-label {
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--text-primary);
}

.health-hint {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Health status variations */
.health-healthy {
  --health-color-rgb: 34, 197, 94;
  --health-color: #22c55e;
}

.health-warning {
  --health-color-rgb: 245, 158, 11;
  --health-color: #f59e0b;
}

.health-error {
  --health-color-rgb: 239, 68, 68;
  --health-color: #ef4444;
}

.health-unknown {
  --health-color-rgb: 107, 114, 128;
  --health-color: #6b7280;
}

/* Getting Started Banner */
.getting-started-banner {
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.1) 0%, rgba(163, 113, 247, 0.1) 100%);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  animation: fadeIn 0.5s ease;
}

.getting-started-content {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.getting-started-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.getting-started-icon .material-icons {
  font-size: 32px;
  color: white;
}

.getting-started-text {
  flex: 1;
}

.getting-started-text h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 0 0 var(--space-xs) 0;
  color: var(--text-primary);
}

.getting-started-text p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

.getting-started-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-base);
}

.getting-started-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

.getting-started-steps .step {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.getting-started-steps .step-number {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: white;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.getting-started-steps .step-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

.getting-started-steps .step-arrow {
  color: var(--text-muted);
}

.getting-started-steps .step-arrow .material-icons {
  font-size: 20px;
}

@media (max-width: 1024px) {
  .getting-started-content {
    flex-direction: column;
    text-align: center;
  }
  
  .getting-started-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .getting-started-steps {
    flex-wrap: wrap;
  }
  
  .getting-started-steps .step-arrow {
    display: none;
  }
}

/* Metrics Grid - 4-column balanced design */
.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  flex-shrink: 0;
}

.metric-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--metric-color);
  transition: width 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border-color: var(--metric-color);
}

.metric-card:hover::before {
  width: 8px;
}

.metric-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: rgba(var(--metric-color-rgb, 59, 130, 246), 0.1);
  color: var(--metric-color);
  flex-shrink: 0;
}

.metric-icon .material-icons {
  font-size: 24px;
}

.metric-content {
  flex: 1;
  min-width: 0;
}

.metric-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.metric-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

.metric-secondary {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.metric-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--bg-tertiary);
}

.metric-progress-bar {
  height: 100%;
  background: var(--metric-color);
  transition: width 0.5s ease;
}

/* Agent metric card - dual segment progress bar */
.metric-progress.agent-progress {
  position: relative;
}

.metric-progress.agent-progress .metric-progress-bar {
  position: absolute;
  top: 0;
  height: 100%;
}

.metric-progress.agent-progress .metric-progress-bar.working {
  background: var(--metric-color);
  z-index: 2;
}

.metric-progress.agent-progress .metric-progress-bar.available {
  background: var(--metric-color);
  opacity: 0.4;
  z-index: 1;
}

/* Main Content Grid - 2x2 layout filling space */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: var(--space-md);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Dashboard Card - Fill available space */
.dashboard-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dashboard-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.card-header .material-icons {
  font-size: 18px;
  color: var(--accent-primary);
}

.card-header h3 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: var(--space-md);
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Quick Actions - 3x2 grid filling space */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: var(--space-sm);
  height: 100%;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.quick-action-btn:hover {
  background: rgba(var(--action-color-rgb, 59, 130, 246), 0.1);
  border-color: var(--action-color);
  color: var(--action-color);
  transform: translateY(-2px);
}

.quick-action-btn .material-icons {
  font-size: 28px;
  color: var(--action-color);
}

.quick-action-btn .action-label {
  font-size: var(--text-xs);
  font-weight: 500;
  text-align: center;
}

/* Agent Status Overview - Fill space */
.agent-status-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  height: 100%;
}

.agent-status-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
  flex: 1;
}

.agent-status-row:hover {
  border-color: var(--agent-color);
  background: rgba(var(--agent-color-rgb, 59, 130, 246), 0.05);
}

.agent-status-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(var(--agent-color-rgb, 59, 130, 246), 0.1);
  color: var(--agent-color);
  flex-shrink: 0;
}

.agent-status-icon .material-icons {
  font-size: 18px;
}

.agent-status-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
}

.agent-type-label {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.agent-count {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.agent-status-bar {
  position: relative;
  width: 60px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.status-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transition: width 0.3s ease;
}

.status-bar-fill.working {
  background: var(--agent-color);
  z-index: 2;
}

.status-bar-fill.available {
  background: var(--agent-color);
  opacity: 0.4;
  z-index: 1;
}

.agent-status-indicator {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.agent-status-indicator .material-icons {
  font-size: 18px;
}

.agent-status-indicator.active {
  color: var(--accent-success);
}

.agent-status-indicator.working {
  color: var(--accent-warning);
}

.agent-status-indicator.working .material-icons {
  animation: spin 1.5s linear infinite;
}

/* Recent Work List - Fill space */
.recent-work-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
}

.recent-work-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

.recent-work-item:hover {
  border-color: var(--border-default);
  background: var(--bg-hover);
}

.work-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.work-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.work-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.work-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.work-status-badge {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: capitalize;
  flex-shrink: 0;
}

/* Rig Overview - Fill space */
.rig-overview-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
}

.rig-overview-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

.rig-overview-item:hover {
  border-color: var(--accent-primary);
  background: rgba(88, 166, 255, 0.05);
}

.rig-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent-primary);
  flex-shrink: 0;
}

.rig-icon .material-icons {
  font-size: 20px;
}

.rig-info {
  flex: 1;
  min-width: 0;
}

.rig-name {
  display: block;
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rig-agents {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.rig-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.rig-status-indicator.active {
  background: var(--accent-success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.rig-status-indicator.working {
  background: var(--accent-warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* View All Link */
.view-all-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  color: var(--accent-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.view-all-link:hover {
  background: rgba(88, 166, 255, 0.1);
}

.view-all-link .material-icons {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.view-all-link:hover .material-icons {
  transform: translateX(4px);
}

/* Empty State (small) */
.empty-state.small {
  padding: var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.empty-state.small .material-icons {
  font-size: 32px;
}

.empty-state.small p {
  font-size: var(--text-sm);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .dashboard-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    height: auto;
    overflow: auto;
  }

  .dashboard-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-card {
    padding: var(--space-xs) var(--space-sm);
  }

  .metric-icon {
    width: 32px;
    height: 32px;
  }

  .metric-value {
    font-size: var(--text-md);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .health-banner .btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
  }
}

@media (max-width: 480px) {
  .dashboard-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   IMPROVED STATUS BADGES & VISUAL INDICATORS
   Expert color theory with semantic meaning
   ============================================ */

/* Universal Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
}

.status-badge .material-icons {
  font-size: 14px;
}

/* Status Colors - Semantic palette */
.status-badge.status-idle,
.status-badge.status-stopped,
.status-badge.status-pending {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

.status-badge.status-running,
.status-badge.status-working,
.status-badge.status-active {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  animation: pulse-glow 2s ease-in-out infinite;
}

.status-badge.status-waiting,
.status-badge.status-queued {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.status-error,
.status-badge.status-failed,
.status-badge.status-stuck {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-badge.status-complete,
.status-badge.status-done,
.status-badge.status-closed {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Pulse animation for running status */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0);
  }
}

/* Status Dot - Compact indicator */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.status-dot.idle,
.status-dot.stopped {
  background: #6b7280;
}

.status-dot.running,
.status-dot.active {
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
  animation: dot-pulse 1.5s ease-in-out infinite;
}

.status-dot.waiting {
  background: #f59e0b;
  animation: dot-pulse 2s ease-in-out infinite;
}

.status-dot.error {
  background: #ef4444;
  animation: dot-pulse 0.8s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.7;
  }
}

/* Priority Indicators */
.priority-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
}

.priority-1,
.priority-high,
.priority-urgent {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.priority-2,
.priority-normal {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.priority-3,
.priority-low {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Agent Type Badges */
.agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: var(--text-xs);
  font-weight: 500;
  background: rgba(var(--agent-color-rgb, 168, 85, 247), 0.15);
  color: var(--agent-color, #a855f7);
  border: 1px solid rgba(var(--agent-color-rgb, 168, 85, 247), 0.3);
}

.agent-badge .material-icons {
  font-size: 14px;
}

/* Agent type specific colors */
.agent-badge.type-mayor {
  --agent-color-rgb: 168, 85, 247;
  --agent-color: #a855f7;
}

.agent-badge.type-witness {
  --agent-color-rgb: 59, 130, 246;
  --agent-color: #3b82f6;
}

.agent-badge.type-deacon {
  --agent-color-rgb: 245, 158, 11;
  --agent-color: #f59e0b;
}

.agent-badge.type-refinery {
  --agent-color-rgb: 239, 68, 68;
  --agent-color: #ef4444;
}

.agent-badge.type-polecat {
  --agent-color-rgb: 34, 197, 94;
  --agent-color: #22c55e;
}

.agent-badge.type-crew {
  --agent-color-rgb: 6, 182, 212;
  --agent-color: #06b6d4;
}

.agent-badge.type-human {
  --agent-color-rgb: 236, 72, 153;
  --agent-color: #ec4899;
}

/* Issue Type Badges */
.issue-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-2xs);
  font-weight: 600;
  text-transform: uppercase;
}

.issue-type-badge.type-task {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.issue-type-badge.type-bug {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.issue-type-badge.type-feature {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.issue-type-badge.type-chore {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

.issue-type-badge.type-epic {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

/* Spinning animation for loading states */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin,
.spinning {
  animation: spin 1s linear infinite;
}

/* Notification/Count Badge */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-primary);
  color: white;
}

.count-badge.count-0 {
  display: none;
}

.count-badge.count-alert {
  background: #ef4444;
  animation: badge-pop 0.3s ease-out;
}

@keyframes badge-pop {
  0% { transform: scale(0.5); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Keyboard Shortcut Hint */
.kbd-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  box-shadow: 0 1px 0 var(--border-default);
}

/* Online/Offline Connection Indicator */
.connection-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  transition: all 0.3s ease;
}

.connection-indicator.connected {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.connection-indicator.connected::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.connection-indicator.disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.connection-indicator.disconnected::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: disconnect-pulse 1s ease-in-out infinite;
}

@keyframes disconnect-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.connection-indicator.connecting {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.connection-indicator.connecting::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  animation: dot-pulse 1s ease-in-out infinite;
}

/* ============================================
   KEYBOARD HELP OVERLAY
   ============================================ */

.keyboard-help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.keyboard-help-modal {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.keyboard-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
}

.keyboard-help-header h2 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
}

.keyboard-help-header .material-icons {
  color: var(--accent-primary);
}

.keyboard-help-content {
  padding: var(--space-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-xl);
  max-height: 60vh;
  overflow-y: auto;
}

.shortcut-group h3 {
  margin: 0 0 var(--space-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  font-size: var(--text-sm);
}

.shortcut-row span {
  flex: 1;
  color: var(--text-secondary);
}

.shortcut-row kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  box-shadow: 0 2px 0 var(--border-default);
}

.keyboard-help-footer {
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-default);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.keyboard-help-footer kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  box-shadow: 0 1px 0 var(--border-default);
}

/* Focus visible styles for accessibility */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
  position: fixed;
  top: -100%;
  left: 0;
  padding: var(--space-md);
  background: var(--accent-primary);
  color: white;
  font-weight: 600;
  z-index: 10000;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .status-badge,
  .agent-badge,
  .priority-indicator {
    border-width: 2px;
  }

  .status-dot {
    border: 2px solid var(--text-primary);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .spin,
  .spinning,
  .status-dot,
  .status-badge {
    animation: none;
  }

  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ============= Health Check Enhanced Styles ============= */

.health-filters {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.health-filter-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: all 0.2s;
}

.health-filter-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
}

.health-filter-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.health-filter-btn .material-icons {
  font-size: 16px;
}

.health-checks-scroll {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  min-height: 0; /* Allow flex shrinking */
}

.health-checks {
  padding: var(--space-md);
}

.health-check-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--border-default);
}

.health-check-item.health-pass {
  border-left-color: #4caf50;
}

.health-check-item.health-warn {
  border-left-color: #ff9800;
}

.health-check-item.health-fail {
  border-left-color: #f44336;
  background: rgba(244, 67, 54, 0.05);
}

.health-check-status {
  flex-shrink: 0;
}

.health-check-status .material-icons {
  font-size: 24px;
}

.health-check-content {
  flex: 1;
  min-width: 0;
}

.health-check-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.health-check-name {
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.health-check-label {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
  font-weight: 600;
  text-transform: uppercase;
}

.health-check-description {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-sm);
}

.health-check-details {
  background: var(--bg-tertiary);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.health-detail-line {
  color: var(--text-secondary);
  padding: 2px 0;
}

.health-detail-more {
  color: var(--text-tertiary);
  font-style: italic;
  padding-top: var(--space-xs);
}

.health-check-fix {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: rgba(33, 150, 243, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(33, 150, 243, 0.3);
}

.health-check-fix .material-icons {
  font-size: 16px;
  color: var(--accent-info);
}

.health-check-fix code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent-info);
  word-break: break-all;
}

.health-check-fix .copy-fix {
  padding: var(--space-xs);
}

.health-footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-default);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-align: center;
}

.health-summary-actions {
  margin-left: auto;
}

.health-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--text-tertiary);
}

.health-empty .material-icons {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

/* ============= GitHub Repo Picker ============= */

.github-repo-picker {
  position: relative;
}

.github-repo-picker .btn-block {
  width: 100%;
  justify-content: center;
}

.github-repo-list {
  margin-top: var(--space-sm);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  max-height: 300px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.github-repo-search {
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.github-repo-search:focus {
  outline: none;
  background: var(--bg-tertiary);
}

.github-repo-items {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.github-repo-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  border-bottom: 1px solid var(--border-muted);
  transition: background 0.15s;
}

.github-repo-item:hover {
  background: var(--bg-tertiary);
}

.github-repo-item:last-child {
  border-bottom: none;
}

.github-repo-item .repo-icon {
  font-size: 18px;
  color: var(--text-tertiary);
}

.github-repo-item.private .repo-icon {
  color: var(--accent-warning);
}

.github-repo-item .repo-info {
  flex: 1;
  min-width: 0;
}

.github-repo-item .repo-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.github-repo-item .repo-desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.github-repo-item .repo-meta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.github-repo-item .repo-lang {
  display: flex;
  align-items: center;
  gap: 4px;
}

.github-repo-item .lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.github-repo-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  color: var(--text-secondary);
}

.github-repo-empty {
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-tertiary);
}

.form-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  text-transform: uppercase;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}

/* === Sling Error States === */
.sling-error {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
}

.sling-error-icon {
  flex-shrink: 0;
}

.sling-error-icon .material-icons {
  color: #ef4444;
  font-size: 24px;
}

.sling-error-content {
  flex: 1;
  min-width: 0;
}

.sling-error-title {
  font-weight: 600;
  color: #ef4444;
  margin-bottom: var(--space-xs);
}

.sling-error-message {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-xs);
}

.sling-error-message code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.sling-error-hint {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  margin-bottom: var(--space-sm);
}

.sling-error-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.sling-error-actions .btn {
  font-size: var(--text-xs);
}
