/**
 * Agent Shared Component Styles
 * Unified design system for all four AI agents (Detail Page, Main Image, Styling, Fashion Design)
 * Depends on: weveeee-theme.css (design tokens)
 */

/* ===========================================
   1. AGENT PANEL — Container
   =========================================== */
.agent-panel {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--agent-panel-radius);
  box-shadow: var(--ds-shadow-panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.agent-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--agent-panel-padding) 0;
  flex-shrink: 0;
}

.agent-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ds-text-strong);
  letter-spacing: -0.01em;
}

.agent-panel-close {
  width: 32px; height: 32px;
  border-radius: 10px; border: none;
  background: transparent;
  color: var(--ds-text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--agent-transition-fast), color var(--agent-transition-fast);
}
.agent-panel-close:hover { background: rgba(0,0,0,0.05); color: var(--ds-text-strong); }

.agent-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--agent-panel-padding);
}

.agent-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--agent-panel-padding);
  border-top: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

/* ===========================================
   2. AGENT TABS
   =========================================== */
.agent-tabs {
  display: flex;
  gap: 2px;
  padding: 12px var(--agent-panel-padding) 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.agent-tab {
  padding: 8px 16px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: color var(--agent-transition-fast), border-color var(--agent-transition-fast);
  white-space: nowrap;
}
.agent-tab:hover { color: var(--ds-text-strong); }
.agent-tab.active {
  color: var(--agent-accent);
  border-bottom-color: var(--agent-accent);
  font-weight: 600;
}

.agent-tab-content { display: none; }
.agent-tab-content.active { display: block; }

/* ===========================================
   3. PIPELINE TIMELINE BAR
   =========================================== */
.agent-pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 16px 0 20px;
  overflow-x: auto;
}

.agent-pipeline-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.agent-pipeline-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--agent-status-idle);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: var(--agent-status-idle);
  transition: all var(--agent-transition-base);
  position: relative;
  z-index: 2;
}

.agent-pipeline-node[data-status="running"] .agent-pipeline-dot {
  border-color: var(--agent-status-running);
  color: #fff;
  background: var(--agent-status-running);
  animation: agentPulse 1.8s ease-in-out infinite;
}
.agent-pipeline-node[data-status="done"] .agent-pipeline-dot {
  border-color: var(--agent-status-done);
  color: #fff;
  background: var(--agent-status-done);
}
.agent-pipeline-node[data-status="error"] .agent-pipeline-dot {
  border-color: var(--agent-status-error);
  color: #fff;
  background: var(--agent-status-error);
}

.agent-pipeline-label {
  font-size: 11px;
  color: var(--ds-text-muted);
  white-space: nowrap;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.agent-pipeline-node[data-status="running"] .agent-pipeline-label { color: var(--agent-accent); font-weight: 600; }
.agent-pipeline-node[data-status="done"] .agent-pipeline-label { color: var(--agent-status-done); }

.agent-pipeline-connector {
  flex: 1;
  height: 2px;
  min-width: 20px;
  background: rgba(0,0,0,0.08);
  align-self: flex-start;
  margin-top: 13px;
  position: relative;
  z-index: 1;
}
.agent-pipeline-connector.done { background: var(--agent-status-done); }
.agent-pipeline-connector.running {
  background: linear-gradient(90deg, var(--agent-status-done), var(--agent-accent));
}

/* Pipeline tooltip */
.agent-pipeline-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ds-tooltip-bg);
  color: var(--ds-tooltip-color);
  padding: var(--ds-tooltip-padding);
  border-radius: var(--ds-tooltip-radius);
  font-size: var(--ds-tooltip-font-size);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 100;
}
.agent-pipeline-node:hover .agent-pipeline-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===========================================
   4. STAGE CARD — Three-layer thinking card
   =========================================== */
.agent-stage-card {
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--agent-card-radius);
  background: #fff;
  margin-bottom: var(--agent-card-gap);
  overflow: hidden;
  transition: border-color var(--agent-transition-base), box-shadow var(--agent-transition-base);
}
.agent-stage-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.agent-stage-card[data-status="running"] {
  border-color: rgba(124, 108, 240, 0.25);
  box-shadow: 0 0 0 3px rgba(124, 108, 240, 0.06);
}
.agent-stage-card[data-status="error"] { border-color: rgba(239, 68, 68, 0.2); }

/* L1: Summary layer (always visible) */
.agent-sc-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--agent-card-padding);
  cursor: pointer;
  user-select: none;
}

.agent-sc-indicator {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
  background: rgba(0,0,0,0.05);
  color: var(--ds-text-muted);
}
.agent-stage-card[data-status="running"] .agent-sc-indicator {
  background: var(--agent-status-running-bg);
  color: var(--agent-status-running);
}
.agent-stage-card[data-status="done"] .agent-sc-indicator {
  background: var(--agent-status-done-bg);
  color: var(--agent-status-done);
}
.agent-stage-card[data-status="error"] .agent-sc-indicator {
  background: var(--agent-status-error-bg);
  color: var(--agent-status-error);
}

.agent-sc-info { flex: 1; min-width: 0; }
.agent-sc-title { font-size: 13px; font-weight: 600; color: var(--ds-text-strong); }
.agent-sc-desc {
  font-size: 12px;
  color: var(--ds-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.agent-sc-meta {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.agent-sc-duration {
  font-size: 11px;
  color: var(--ds-text-muted);
  font-variant-numeric: tabular-nums;
}
.agent-sc-expand {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ds-text-muted);
  transition: transform var(--agent-transition-base);
  font-size: 14px;
}
.agent-stage-card.expanded .agent-sc-expand { transform: rotate(180deg); }

/* L2: Thinking layer (expandable) */
.agent-sc-thinking {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--agent-transition-expand);
}
.agent-stage-card.expanded .agent-sc-thinking { max-height: 8000px; }

.agent-sc-thinking-inner {
  padding: 0 var(--agent-card-padding) 14px;
}

.agent-sc-thinking-text {
  background: var(--agent-thinking-bg);
  border-left: 3px solid var(--agent-accent);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ds-text);
  margin-bottom: 10px;
}

.agent-sc-decisions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px;
}
.agent-sc-decision-tag {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--agent-decision-tag-bg);
  color: var(--agent-decision-tag-color);
}

.agent-sc-sources {
  font-size: 11px;
  color: var(--ds-text-muted);
  display: flex; flex-wrap: wrap; gap: 4px;
}
.agent-sc-source-item {
  padding: 2px 8px;
  background: rgba(0,0,0,0.03);
  border-radius: 4px;
}

.agent-sc-inline-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.agent-sc-inline-section {
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  background: rgba(248,250,252,0.75);
  padding: 10px 12px;
}

.agent-sc-inline-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ds-text-strong);
  margin-bottom: 6px;
}

.agent-sc-inline-content {
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ds-text);
}

/* L3: Detail link */
.agent-sc-detail-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--agent-accent);
  cursor: pointer; margin-top: 6px;
  border: none; background: none; padding: 0;
}
.agent-sc-detail-link:hover { text-decoration: underline; }

/* ===========================================
   5. RESULT CARD
   =========================================== */
.agent-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--agent-card-gap);
}

.agent-result-card {
  border-radius: var(--agent-card-radius);
  border: 1px solid rgba(0,0,0,0.06);
  background: #fff;
  overflow: hidden;
  transition: box-shadow var(--agent-transition-base), transform var(--agent-transition-fast);
  position: relative;
}
.agent-result-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.agent-result-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #f8f9fa;
}
.agent-result-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.agent-result-card:hover .agent-result-img-wrap img { transform: scale(1.03); }

.agent-result-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  opacity: 0;
  transition: opacity var(--agent-transition-base);
}
.agent-result-card:hover .agent-result-overlay { opacity: 1; }

.agent-result-overlay-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: background var(--agent-transition-fast), transform var(--agent-transition-fast);
}
.agent-result-overlay-btn:hover { background: rgba(255,255,255,0.3); transform: translateY(-1px); }

.agent-result-info {
  padding: 10px 12px;
}
.agent-result-title {
  font-size: 12px; font-weight: 600;
  color: var(--ds-text-strong);
  display: flex; align-items: center; justify-content: space-between;
}
.agent-result-score {
  font-size: 11px; font-weight: 700;
  color: var(--agent-accent);
}
.agent-result-tags {
  display: flex; gap: 4px; margin-top: 4px;
}
.agent-result-tag {
  font-size: 10px; padding: 2px 6px;
  border-radius: 4px;
  background: var(--agent-accent-soft);
  color: var(--agent-accent);
  font-weight: 600;
}

/* Batch action bar */
.agent-results-batch-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--agent-accent-soft);
  border-radius: 10px;
  margin-bottom: var(--agent-card-gap);
}
.agent-results-batch-bar .batch-left { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ds-text); }
.agent-results-batch-bar .batch-right { display: flex; gap: 6px; }

/* Skeleton */
.agent-result-skeleton {
  border-radius: var(--agent-card-radius);
  overflow: hidden;
}
.agent-result-skeleton .skeleton-img {
  width: 100%; aspect-ratio: 3/4;
  background: linear-gradient(110deg, #f0f0f0 30%, #e0e0e0 50%, #f0f0f0 70%);
  background-size: 200% 100%;
  animation: agentSkeleton 1.5s ease-in-out infinite;
}
.agent-result-skeleton .skeleton-text {
  padding: 10px 12px;
}
.agent-result-skeleton .skeleton-line {
  height: 10px; border-radius: 5px;
  background: linear-gradient(110deg, #f0f0f0 30%, #e0e0e0 50%, #f0f0f0 70%);
  background-size: 200% 100%;
  animation: agentSkeleton 1.5s ease-in-out infinite;
  margin-bottom: 6px;
}
.agent-result-skeleton .skeleton-line:last-child { width: 60%; margin-bottom: 0; }

/* Select mode checkbox */
.agent-result-select {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  color: #fff; font-size: 12px;
  transition: background var(--agent-transition-fast), border-color var(--agent-transition-fast);
}
.agent-results-grid.select-mode .agent-result-select { display: flex; }
.agent-result-select.selected { background: var(--agent-accent); border-color: var(--agent-accent); }

/* Gallery saved badge */
.agent-result-saved-badge {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
  background: rgba(34, 197, 94, 0.85);
  color: #fff;
  backdrop-filter: blur(4px);
}

/* ===========================================
   6. CONFIRM MODAL
   =========================================== */
.agent-modal-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.agent-modal-overlay.active { opacity: 1; pointer-events: auto; }

.agent-modal {
  width: min(420px, calc(100vw - 32px));
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  border-radius: var(--agent-panel-radius);
  box-shadow: 0 30px 90px rgba(0,0,0,0.18);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}
.agent-modal-overlay.active .agent-modal { transform: scale(1); }

.agent-modal-header {
  padding: 20px 24px 0;
}
.agent-modal-title {
  font-size: 16px; font-weight: 700;
  color: var(--ds-text-strong);
}
.agent-modal-message {
  font-size: 14px; color: var(--ds-text);
  line-height: 1.6;
  padding: 12px 24px 0;
}
.agent-modal-desc {
  font-size: 12px; color: var(--ds-text-muted);
  padding: 4px 24px 0;
}

/* Credit display */
.agent-modal-credit {
  padding: 16px 24px;
  margin: 12px 24px;
  background: var(--agent-accent-soft);
  border-radius: 12px;
}
.agent-modal-credit-cost {
  font-size: 28px; font-weight: 800;
  color: var(--agent-accent);
  line-height: 1.2;
}
.agent-modal-credit-cost.insufficient { color: var(--agent-modal-danger); }
.agent-modal-credit-balance {
  font-size: 12px; color: var(--ds-text-muted);
  margin-top: 4px;
}
.agent-modal-credit-balance .remaining { font-weight: 600; color: var(--ds-text); }
.agent-modal-credit-balance.insufficient .remaining { color: var(--agent-modal-danger); }

.agent-modal-credit-details {
  margin-top: 8px;
  font-size: 12px; color: var(--ds-text-muted);
}
.agent-modal-credit-details summary {
  cursor: pointer;
  font-weight: 500;
}
.agent-modal-credit-detail-row {
  display: flex; justify-content: space-between;
  padding: 3px 0;
}

/* Modal buttons */
.agent-modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px 20px;
}

.agent-modal-btn {
  height: 40px;
  padding: 0 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--agent-transition-fast);
}
.agent-modal-btn-ghost {
  background: transparent;
  color: var(--ds-text-muted);
}
.agent-modal-btn-ghost:hover { color: var(--ds-text-strong); background: rgba(0,0,0,0.04); }

.agent-modal-btn-primary {
  background: var(--agent-accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 108, 240, 0.25);
}
.agent-modal-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124, 108, 240, 0.35); }
.agent-modal-btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.agent-modal-btn-danger {
  background: var(--agent-modal-danger);
  color: #fff;
}
.agent-modal-btn-danger:hover { transform: translateY(-1px); filter: brightness(1.05); }

.agent-modal-btn-recharge {
  background: var(--agent-accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 108, 240, 0.25);
}
.agent-modal-btn-recharge:hover { transform: translateY(-1px); }

/* ===========================================
   7. LIGHTBOX
   =========================================== */
.agent-lightbox-overlay {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  display: flex; flex-direction: column;
}
.agent-lightbox-overlay.active { opacity: 1; pointer-events: auto; }

.agent-lightbox-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  flex-shrink: 0;
}
.agent-lightbox-counter {
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.7);
}
.agent-lightbox-close {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--agent-transition-fast);
}
.agent-lightbox-close:hover { background: rgba(255,255,255,0.15); }

.agent-lightbox-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.agent-lightbox-img-container {
  max-width: 90%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.agent-lightbox-img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  user-select: none;
  cursor: grab;
  transition: transform 0.08s ease-out;
  border-radius: 4px;
}
.agent-lightbox-img.grabbing { cursor: grabbing; }

.agent-lightbox-zoom-indicator {
  position: absolute; bottom: 16px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.agent-lightbox-zoom-indicator.visible { opacity: 1; }

/* Nav arrows */
.agent-lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--agent-transition-fast), transform var(--agent-transition-fast);
  z-index: 10;
}
.agent-lightbox-nav:hover { background: rgba(255,255,255,0.18); transform: translateY(-50%) scale(1.05); }
.agent-lightbox-nav.prev { left: 16px; }
.agent-lightbox-nav.next { right: 16px; }

/* Thumbnail strip */
.agent-lightbox-thumbs {
  display: flex; gap: 6px; justify-content: center;
  padding: 10px 20px;
  flex-shrink: 0;
  overflow-x: auto;
}
.agent-lightbox-thumb {
  width: 48px; height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--agent-transition-fast), border-color var(--agent-transition-fast);
  flex-shrink: 0;
}
.agent-lightbox-thumb:hover { opacity: 0.8; }
.agent-lightbox-thumb.active { opacity: 1; border-color: var(--agent-accent); }
.agent-lightbox-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Toolbar */
.agent-lightbox-toolbar {
  display: flex; gap: 8px; justify-content: center;
  padding: 8px 20px 16px;
  flex-shrink: 0;
}
.agent-lightbox-tool-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: background var(--agent-transition-fast), transform var(--agent-transition-fast);
  position: relative;
}
.agent-lightbox-tool-btn:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}
.agent-lightbox-tool-btn .tooltip {
  position: absolute; bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: var(--ds-tooltip-bg);
  color: var(--ds-tooltip-color); font-size: var(--ds-tooltip-font-size);
  padding: var(--ds-tooltip-padding); border-radius: var(--ds-tooltip-radius);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.agent-lightbox-tool-btn:hover .tooltip { opacity: 1; }

/* Metadata panel */
.agent-lightbox-meta-panel {
  position: absolute; top: 0; right: 0;
  width: 280px; height: 100%;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  border-left: 1px solid rgba(255,255,255,0.08);
  padding: 20px;
  transform: translateX(100%);
  transition: transform var(--agent-transition-expand);
  overflow-y: auto;
  z-index: 20;
}
.agent-lightbox-meta-panel.open { transform: translateX(0); }

.agent-lightbox-meta-title {
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.6);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.agent-lightbox-meta-row {
  margin-bottom: 14px;
}
.agent-lightbox-meta-label {
  font-size: 11px; color: rgba(255,255,255,0.4);
  margin-bottom: 4px;
}
.agent-lightbox-meta-value {
  font-size: 13px; color: rgba(255,255,255,0.9);
  line-height: 1.5;
  word-break: break-all;
}
.agent-lightbox-meta-prompt {
  font-size: 12px; color: rgba(255,255,255,0.75);
  line-height: 1.6;
  max-height: 120px; overflow-y: auto;
  background: rgba(255,255,255,0.05);
  padding: 10px; border-radius: 8px;
}
.agent-lightbox-meta-copy {
  font-size: 11px; color: var(--agent-accent);
  cursor: pointer; border: none; background: none;
  margin-top: 4px;
}
.agent-lightbox-meta-copy:hover { text-decoration: underline; }

/* ===========================================
   8. FULL TRACE MODAL
   =========================================== */
.agent-trace-overlay {
  position: fixed; inset: 0; z-index: 99998;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(20px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  display: flex; flex-direction: column;
}
.agent-trace-overlay.active { opacity: 1; pointer-events: auto; }

.agent-trace-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.agent-trace-title {
  font-size: 16px; font-weight: 700; color: var(--ds-text-strong);
}

.agent-trace-body {
  flex: 1; display: flex; overflow: hidden;
}
.agent-trace-timeline {
  width: 260px; flex-shrink: 0;
  border-right: 1px solid rgba(0,0,0,0.06);
  padding: 20px;
  overflow-y: auto;
}
.agent-trace-detail {
  flex: 1; padding: 24px;
  overflow-y: auto;
}

.agent-trace-step {
  display: flex; gap: 12px; padding: 10px 0;
  cursor: pointer;
  border-radius: 10px;
  transition: background var(--agent-transition-fast);
}
.agent-trace-step:hover { background: rgba(0,0,0,0.03); }
.agent-trace-step.active { background: var(--agent-accent-soft); }

.agent-trace-step-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  background: rgba(0,0,0,0.06);
  color: var(--ds-text-muted);
}
.agent-trace-step[data-status="done"] .agent-trace-step-dot {
  background: var(--agent-status-done-bg); color: var(--agent-status-done);
}

.agent-trace-step-info { flex: 1; }
.agent-trace-step-name { font-size: 13px; font-weight: 600; color: var(--ds-text-strong); }
.agent-trace-step-time { font-size: 11px; color: var(--ds-text-muted); }

/* ===========================================
   9. AGENT MANAGEMENT COMPONENTS
   =========================================== */
.agent-mgmt-pipeline {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  padding: 16px; background: rgba(0,0,0,0.02);
  border-radius: 12px;
}
.agent-mgmt-pipeline-step {
  display: flex; align-items: center; gap: 8px;
}
.agent-mgmt-pipeline-box {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  font-size: 12px; font-weight: 600;
  color: var(--ds-text-strong);
  cursor: pointer;
  transition: border-color var(--agent-transition-fast), box-shadow var(--agent-transition-fast);
}
.agent-mgmt-pipeline-box:hover { border-color: var(--agent-accent); box-shadow: 0 2px 8px rgba(124,108,240,0.1); }
.agent-mgmt-pipeline-arrow { color: var(--ds-text-muted); font-size: 14px; }

.agent-mgmt-list { display: flex; flex-direction: column; gap: 8px; }
.agent-mgmt-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color var(--agent-transition-fast), box-shadow var(--agent-transition-fast);
}
.agent-mgmt-item:hover { border-color: var(--agent-accent); box-shadow: 0 2px 8px rgba(124,108,240,0.08); }

.agent-mgmt-item-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--agent-accent-soft);
  color: var(--agent-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.agent-mgmt-item-info { flex: 1; }
.agent-mgmt-item-name { font-size: 13px; font-weight: 600; color: var(--ds-text-strong); }
.agent-mgmt-item-role { font-size: 11px; color: var(--ds-text-muted); }
.agent-mgmt-item-arrow { color: var(--ds-text-muted); font-size: 14px; }

/* Methodology grid */
.agent-methodology-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.agent-methodology-card {
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color var(--agent-transition-fast), box-shadow var(--agent-transition-fast);
}
.agent-methodology-card:hover { border-color: var(--agent-accent); box-shadow: 0 2px 12px rgba(124,108,240,0.08); }
.agent-methodology-name { font-size: 13px; font-weight: 700; color: var(--ds-text-strong); margin-bottom: 6px; }
.agent-methodology-desc { font-size: 12px; color: var(--ds-text-muted); line-height: 1.5; }
.agent-methodology-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

/* ===========================================
   10. SHARED BUTTONS
   =========================================== */
.agent-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all var(--agent-transition-fast);
  white-space: nowrap;
}
.agent-btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.agent-btn-primary { background: var(--agent-accent); color: #fff; box-shadow: 0 2px 8px rgba(124,108,240,0.2); }
.agent-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(124,108,240,0.3); }
.agent-btn-secondary { background: rgba(0,0,0,0.05); color: var(--ds-text); }
.agent-btn-secondary:hover { background: rgba(0,0,0,0.08); }
.agent-btn-ghost { background: transparent; color: var(--ds-text-muted); }
.agent-btn-ghost:hover { color: var(--ds-text-strong); background: rgba(0,0,0,0.04); }

/* ===========================================
   11. EMPTY STATE
   =========================================== */
.agent-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px;
  text-align: center;
}
.agent-empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.3; }
.agent-empty-text { font-size: 13px; color: var(--ds-text-muted); line-height: 1.6; }
.agent-empty-action { margin-top: 16px; }

/* ===========================================
   12. CREDIT HINT (near generate button)
   =========================================== */
.agent-credit-hint {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--agent-accent);
}
.agent-credit-balance {
  font-size: 11px; color: var(--ds-text-muted); font-weight: 400;
}

/* ===========================================
   13. ANIMATIONS
   =========================================== */
@keyframes agentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 108, 240, 0.3); }
  50%      { box-shadow: 0 0 0 8px rgba(124, 108, 240, 0); }
}

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

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

@keyframes agentSlideDown {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 500px; }
}

.agent-fade-in { animation: agentFadeIn 0.3s ease-out both; }
.agent-fade-in-delay-1 { animation-delay: 0.05s; }
.agent-fade-in-delay-2 { animation-delay: 0.1s; }
.agent-fade-in-delay-3 { animation-delay: 0.15s; }

/* Input focus underline */
.agent-input-focus-line {
  position: relative;
}
.agent-input-focus-line::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--agent-accent);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}
.agent-input-focus-line:focus-within::after { transform: scaleX(1); }

/* Timing chart bars */
.agent-timing-chart {
  display: flex; height: 6px; gap: 1px;
  border-radius: 3px; overflow: hidden;
  margin-top: 8px;
}
.agent-timing-bar {
  height: 100%;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  transition: filter 0.15s;
}
.agent-timing-bar:hover { filter: brightness(1.1); }

/* ===========================================
   14. RESPONSIVE (≤1024px base)
   =========================================== */
@media (max-width: 1024px) {
  .agent-panel {
    border-radius: 0;
    max-width: 100%;
    width: 100%;
    height: 100%;
  }
}

/* ── Toast notification ── */
.agent-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  z-index: 100000;
  padding: 12px 24px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.agent-toast.success {
  background: rgba(16, 185, 129, 0.95);
  color: #fff;
}
.agent-toast.error {
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
}
.agent-toast.warning {
  background: rgba(245, 158, 11, 0.95);
  color: #fff;
}
.agent-toast.info {
  background: rgba(124, 108, 240, 0.95);
  color: #fff;
}

/* ── Cancel buttons unified ── */
.agent-cancel-btn,
[id$="CancelBtn"] {
  transition: all 0.2s ease;
}
.agent-cancel-btn:hover,
[id$="CancelBtn"]:hover {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: #dc2626 !important;
  color: #dc2626 !important;
}
.agent-cancel-btn:active,
[id$="CancelBtn"]:active {
  background: rgba(239, 68, 68, 0.15) !important;
  transform: scale(0.97);
}

/* ── Add-to-canvas buttons ── */
.agent-canvas-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(124, 108, 240, 0.2);
  background: rgba(124, 108, 240, 0.06);
  color: #7c6cf0;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.agent-canvas-btn:hover {
  background: rgba(124, 108, 240, 0.14);
  border-color: #7c6cf0;
}
.agent-canvas-btn:active {
  transform: scale(0.96);
}

/* ── Empty state ── */
.agent-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.agent-empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(124, 108, 240, 0.08), rgba(168, 139, 250, 0.06));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 24px;
  color: #a78bfa;
}
.agent-empty-state-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ds-text-strong);
  margin-bottom: 6px;
}
.agent-empty-state-desc {
  font-size: 12px;
  color: var(--ds-text-muted);
  max-width: 280px;
  line-height: 1.6;
}

/* ── Skeleton loading ── */
.agent-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: agent-skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 12px;
}
@keyframes agent-skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.agent-skeleton-card {
  aspect-ratio: 3/4;
  border-radius: 16px;
}
.agent-skeleton-text {
  height: 14px;
  border-radius: 7px;
  margin-bottom: 8px;
}
.agent-skeleton-text.short { width: 60%; }
.agent-skeleton-text.medium { width: 80%; }

/* ── Timing chart (wrapper override for standalone use) ── */
.agent-timing-chart-wrap {
  margin-top: 16px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 14px;
  border: 1px solid #f1f5f9;
}
.agent-timing-bar {
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ── Result card hover overlay ── */
.agent-card-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.agent-card-wrap:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.08);
}
.agent-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.65) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  pointer-events: none;
}
.agent-card-wrap:hover .agent-card-overlay {
  opacity: 1;
  pointer-events: auto;
}
.agent-card-overlay-title {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.agent-card-overlay-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.agent-card-overlay-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.agent-card-overlay-btn:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
}
.agent-card-overlay-btn:active {
  transform: scale(0.95);
}
.agent-card-overlay-btn.primary {
  background: rgba(124, 108, 240, 0.85);
  border-color: rgba(124, 108, 240, 0.5);
}
.agent-card-overlay-btn.primary:hover {
  background: rgba(124, 108, 240, 1);
}

/* ── Generating pulse indicator ── */
.agent-generating-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(124, 108, 240, 0.08), rgba(168, 139, 250, 0.06));
  font-size: 12px;
  font-weight: 600;
  color: #7c6cf0;
}
.agent-generating-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7c6cf0;
  animation: agent-dot-pulse 1.4s ease-in-out infinite;
}
.agent-generating-dot:nth-child(2) { animation-delay: 0.2s; }
.agent-generating-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes agent-dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* ── Progress bar ── */
.agent-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #f1f5f9;
  overflow: hidden;
  position: relative;
}
.agent-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #7c6cf0, #a78bfa);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.agent-progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: agent-progress-shimmer 1.5s ease-in-out infinite;
}
@keyframes agent-progress-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.agent-progress-text {
  font-size: 11px;
  font-weight: 600;
  color: #7c6cf0;
  margin-top: 4px;
}

/* ── Recommended badge ── */
.agent-badge-recommended {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: linear-gradient(135deg, #7c6cf0, #a78bfa);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(124, 108, 240, 0.3);
}

/* ══════════════════════════════════
   Mobile responsive (≤768px)
   ══════════════════════════════════ */
@media (max-width: 768px) {
  .agent-panel { padding: 12px; border-radius: 16px; }
  .agent-tabs { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .agent-tabs::-webkit-scrollbar { display: none; }
  .agent-tab { white-space: nowrap; padding: 8px 12px; font-size: 12px; }
  .agent-stage-card { padding: 12px; }
  .agent-results-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .agent-modal { width: calc(100vw - 24px); max-width: none; border-radius: 16px; }
  .agent-modal-actions { flex-direction: column; }
  .agent-modal-actions button { width: 100%; }
  .agent-lightbox-toolbar { bottom: 12px; gap: 6px; padding: 6px 12px; }
  .agent-lightbox-toolbar button { width: 36px; height: 36px; font-size: 14px; }
  .agent-lightbox-thumbs { height: 54px; gap: 4px; padding: 4px 8px; }
  .agent-lightbox-thumb { width: 44px; height: 44px; border-radius: 8px; }
  .agent-lightbox-meta-panel { width: 100%; height: 45%; top: auto; bottom: 0;
    transform: translateY(100%); border-left: none; border-top: 1px solid rgba(255,255,255,0.08);
  }
  .agent-lightbox-meta-panel.open { transform: translateY(0); }
  .agent-trace-body { flex-direction: column; }
  .agent-trace-timeline { width: 100%; max-height: 180px; border-right: none; border-bottom: 1px solid rgba(0,0,0,0.06); }
  .agent-trace-detail { padding: 12px; }
  .agent-toast { max-width: calc(100vw - 32px); font-size: 12px; padding: 10px 16px; }
  .agent-empty-state { padding: 32px 16px; }
  .agent-empty-state-icon { width: 48px; height: 48px; font-size: 20px; border-radius: 14px; }
  .agent-canvas-btn { padding: 3px 8px; font-size: 10px; }
  .agent-pipeline { gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .agent-pipeline-node { min-width: 60px; font-size: 10px; padding: 6px 8px; }
  .agent-timing-chart { padding: 10px; }
}

/* Small phones (≤480px) */
@media (max-width: 480px) {
  .agent-results-grid { grid-template-columns: 1fr; }
  .agent-stage-card-header { flex-direction: column; gap: 4px; }
  .agent-lightbox-header { padding: 8px 12px; }
  .agent-lightbox-counter { font-size: 12px; }
}
