.ai-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  cursor: pointer;
  position: relative;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 2rem;
}

.ai-status-dot,
.ai-status-label,
.ai-status-queue {
  transition: opacity 0.3s ease;
}

.ai-status:not(.visible) .ai-status-dot,
.ai-status:not(.visible) .ai-status-label,
.ai-status:not(.visible) .ai-status-queue {
  opacity: 0;
  pointer-events: none;
}

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

.ai-status.active .ai-status-dot {
  animation: ai-pulse 1.2s ease-in-out infinite;
}

.ai-status.failed .ai-status-dot {
  background: var(--error, var(--accent));
  animation: none;
}

.ai-status.done .ai-status-dot {
  background: var(--success, var(--accent));
  animation: none;
}

@keyframes ai-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.ai-status-label {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-status-queue {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ── Dropdown ── */
.ai-status-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg, 12px);
  padding: 0.75rem;
  min-width: 300px;
  max-width: 380px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1001;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* Prevent overflow past viewport right edge */
.ai-status-dropdown.open {
  display: block;
}

/* ── Section headers ── */
.ai-status-dropdown h5 {
  margin: 0.75rem 0 0.4rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ai-status-dropdown h5:first-child {
  margin-top: 0;
}

/* ── Job card ── */
.ai-status-job {
  padding: 0.5rem;
  border-radius: var(--radius, 6px);
  background: var(--bg-surface);
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
}

.ai-status-job:last-child {
  margin-bottom: 0;
}

.ai-status-job-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ai-status-job-label {
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-status-job-source {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ai-status-job-step {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.ai-status-job-error {
  color: var(--error);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* ── Progress bar ── */
.ai-status-progress {
  height: 3px;
  background: var(--border-subtle);
  border-radius: 2px;
  margin-top: 0.4rem;
  overflow: hidden;
}

.ai-status-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* ── Buttons ── */
.ai-status-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm, 3px);
  font-size: 0.7rem;
  cursor: pointer;
}

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

.ai-status-btn-cancel {
  flex-shrink: 0;
  color: var(--error);
  border-color: var(--error);
  opacity: 0.7;
}

.ai-status-btn-cancel:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--error) 10%, transparent);
}

/* ── Empty state ── */
.ai-status-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  text-align: center;
}

@media (max-width: 767px) {
  .ai-status-label { max-width: 120px; }
  .ai-status-dropdown { right: -1rem; min-width: 260px; max-width: calc(100vw - 2rem); }
}
