/* 任务状态 */
.task-bubble {
  z-index: var(--z-overlay);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--border-emphasis);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-glow);
  cursor: pointer;
  transition:
    transform var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
  user-select: none;
  font-size: 13px;
}
.task-bubble.is-floating {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
}
.task-bubble.is-topbar {
  position: static;
  z-index: auto;
  height: 32px;
  padding: 0 12px;
  min-width: 74px;
  background: rgba(255, 255, 255, .055);
  border-color: var(--border-subtle);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  flex: 0 0 auto;
}
.task-bubble:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow-strong);
  border-color: var(--border-strong);
}
.task-bubble.is-topbar:hover {
  transform: none;
  box-shadow: none;
  background: rgba(255, 255, 255, .08);
  border-color: var(--border-emphasis);
}

.task-bubble-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  position: relative;
  flex-shrink: 0;
}
.task-bubble-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--success);
  opacity: .35;
  animation: bubbleDotPulse 2s infinite;
}
.task-bubble-dot.is-warn { background: var(--warning); }
.task-bubble-dot.is-warn::after { background: var(--warning); }
.task-bubble-dot.is-down { background: var(--danger); animation: none; }
.task-bubble-dot.is-down::after { display: none; }

@keyframes bubbleDotPulse {
  0%, 100% { transform: scale(1); opacity: .35; }
  50%      { transform: scale(2.4); opacity: 0; }
}

.task-bubble-count {
  font-weight: 700;
  color: var(--text-primary);
  min-width: 16px;
  text-align: center;
}

.task-bubble-label {
  color: var(--text-secondary);
  font-size: 12px;
}

/* 抽屉面板 */
.task-drawer {
  position: fixed;
  right: var(--space-6);
  bottom: 80px;
  z-index: var(--z-overlay);
  width: 380px;
  max-width: calc(100vw - 48px);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-hover);
  animation: taskDrawerIn 280ms var(--ease-spring);
  overflow: hidden;
}
.task-drawer.is-topbar {
  bottom: auto;
}

@keyframes taskDrawerIn {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.task-drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.task-drawer-list {
  padding: 12px;
  overflow: auto;
  flex: 1;
}

.task-drawer-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.task-item {
  padding: 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--dur-base) var(--ease-out);
}
.task-item + .task-item { margin-top: 10px; }
.task-item:hover { border-color: var(--border-emphasis); }

.task-item-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text-primary);
  word-break: break-word;
}

.task-item-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.task-item-progress {
  margin-top: 10px;
}

.task-item-error {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 12px;
  word-break: break-word;
}

@media (max-width: 640px) {
  .task-bubble.is-floating { right: var(--space-4); bottom: var(--space-4); padding: 8px 12px; }
  .task-bubble.is-topbar {
    min-width: 58px;
    padding: 0 10px;
    gap: 7px;
  }
  .task-bubble.is-topbar .task-bubble-label { display: none; }
  .task-drawer { right: var(--space-4); bottom: 70px; }
}
