/* ═══════════════════════════════════════════════════════════════════
   RIPPLE — Dashboard CSS (Premium Redesign v2)
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Layout ─── */
.dashboard-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-dark);
}

/* ─── Sidebar ─── */
.sidebar {
  width: 240px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  margin-bottom: 2rem;
}

.sidebar-logo svg {
  color: var(--accent-bright);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.7rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  text-align: left;
  width: 100%;
}

.sidebar-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-item.active {
  color: var(--text-main);
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.2);
  box-shadow: inset 0 0 20px rgba(168, 85, 247, 0.05);
}

.sidebar-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  flex-shrink: 0;
}
.sidebar-item.active svg {
  color: var(--accent-bright);
  opacity: 1;
}

.sidebar-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 0.75rem 0;
}

.sidebar-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.6rem 0.75rem;
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.sidebar-badge svg { color: #f59e0b; flex-shrink: 0; }
.sidebar-badge strong { color: var(--accent-bright); }

/* User Profile Snippet */
.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem 0.5rem 0;
  border-top: 1px solid var(--glass-border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-plan {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ─── Main Content ─── */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.page-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: 20px;
}
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: livePulse 2s ease infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(16, 185, 129, 0.6); }
  50% { opacity: 0.5; box-shadow: 0 0 4px rgba(16, 185, 129, 0.3); }
}

.search-box {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-box input {
  background: transparent; border: none; color: white; outline: none; font-size: 0.82rem; width: 140px;
}

.page-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
}

.page { display: none; }
.page:not(.hidden) { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════════════════════════════════════════════════
   HOME PAGE
   ═══════════════════════════════════════════════════════════════════ */

.home-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2.5rem;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(99, 102, 241, 0.04) 50%, rgba(16, 185, 129, 0.04) 100%);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}
.home-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.5rem;
}
.home-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.25s ease;
}
.stat-card:hover {
  border-color: rgba(255,255,255,0.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.stat-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Home Grid (2-column) */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.home-panel {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.home-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--glass-border);
}

.home-panel-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

/* Data Engine Bars */
.data-bar-group { margin-bottom: 1rem; }
.data-bar-group:last-of-type { margin-bottom: 0.5rem; }
.data-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.data-bar-track {
  height: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  overflow: hidden;
}
.data-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.sft-fill {
  background: linear-gradient(90deg, #8b5cf6, #a855f7);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
}
.dpo-fill {
  background: linear-gradient(90deg, #10b981, #34d399);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.data-engine-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding-top: 0.75rem;
  border-top: 1px solid var(--glass-border);
}
.data-engine-meta strong { color: var(--text-muted); }

/* Key Rotator */
.key-rotator-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  transition: all 0.2s;
}
.key-row:hover {
  background: rgba(255,255,255,0.04);
}

.key-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.key-dot.active { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.key-dot.cooldown { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.5); }
.key-dot.exhausted { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.5); }

.key-name { color: var(--text-main); font-weight: 500; flex: 1; }
.key-calls { color: var(--text-dim); font-size: 0.75rem; font-family: var(--font-mono); }
.key-status-text { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.key-status-text.active { color: #10b981; }
.key-status-text.cooldown { color: #f59e0b; }

.key-rotator-empty {
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 1rem;
  text-align: center;
}

/* PDF Download Button */
.flow-log-pdf {
  margin-top: 0.5rem;
  padding: 0 !important;
  background: none !important;
  border: none !important;
}

.pdf-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.pdf-download-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
  background: linear-gradient(135deg, #818cf8, #a78bfa);
}

.pdf-download-btn:active:not(:disabled) {
  transform: translateY(0);
}

.pdf-download-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.pdf-download-btn.pdf-success {
  background: linear-gradient(135deg, #10b981, #34d399);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.pdf-download-btn svg.spin {
  animation: spin 1s linear infinite;
}

.cloud-link {
  color: var(--accent-bright);
  text-decoration: none;
  font-weight: 500;
}
.cloud-link:hover {
  text-decoration: underline;
}
.log-cloud {
  color: #818cf8;
}

/* Agent Overview Grid (Home) */
.agent-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.agent-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: all 0.2s;
}
.agent-chip:hover {
  border-color: rgba(255,255,255,0.1);
  color: var(--text-main);
  background: rgba(255,255,255,0.04);
}
.agent-chip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   NEW RUN PAGE
   ═══════════════════════════════════════════════════════════════════ */

.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ─── Panels & Cards ─── */
.panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.panel-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-main);
  margin: 0;
}

/* ─── Input Area ─── */
.input-card {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}

.tab {
  flex: 1;
  padding: 0.6rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.tab:hover { color: var(--text-main); }
.tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.input-field {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 180px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

/* ─── Context Section ─── */
.context-box {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.context-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.context-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.context-label {
  color: var(--text-muted);
  width: 80px;
}

.context-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}
.context-select option { background: var(--bg-elevated); }

/* ─── Generate Button ─── */
.btn-generate {
  width: 100%;
  padding: 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--gradient-accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 20px var(--accent-glow);
  margin-top: 0.5rem;
}

.btn-generate:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 6px 25px rgba(168, 85, 247, 0.5);
}

.btn-generate:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  background: var(--bg-surface);
  box-shadow: none;
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
}

.btn-generate.is-running {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  animation: btn-glow-pulse 2s ease-in-out infinite;
}

@keyframes btn-glow-pulse {
  0%, 100% { box-shadow: 0 0 15px rgba(99, 102, 241, 0.15); }
  50% { box-shadow: 0 0 30px rgba(99, 102, 241, 0.35); }
}

/* ─── Button Spinner ─── */
.btn-spinner {
  animation: btn-spin 0.8s linear infinite;
}
.btn-spinner.hidden { display: none; }
#run-btn-icon.hidden { display: none; }

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

/* ─── Progress Bar ─── */
.ng-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ng-progress-track.active {
  opacity: 1;
}

.ng-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7);
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.ng-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: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.ng-progress-track.complete .ng-progress-fill {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.ng-progress-track.complete .ng-progress-fill::after {
  animation: none;
}

/* ─── Elapsed Timer ─── */
.ng-elapsed {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 2px 8px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  animation: timer-pulse 1s ease-in-out infinite;
}

.ng-elapsed.hidden { display: none; }

.ng-elapsed.complete {
  color: #34d399;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  animation: none;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ─── Agents Library (Right Panel) ─── */
.agents-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 70vh;
  overflow-y: auto;
}

.agent-card {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: all 0.2s;
}

.agent-card:hover {
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.02);
}

.agent-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.agent-card-info {
  display: flex;
  gap: 10px;
  align-items: center;
}

.agent-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.agent-icon-box svg { width: 18px; height: 18px; color: #fff; }

.agent-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.agent-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Status Badges */
.status-badge {
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid;
}

.badge-idle {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: var(--text-muted);
}

.badge-running {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.badge-done {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.badge-paused {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.badge-cloud {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
  font-size: 0.65rem;
  transition: all 0.3s ease;
}
.badge-cloud:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

/* Progress Bar */
.agent-progress-container {
  height: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
  display: none;
}
.agent-card.running .agent-progress-container { display: block; }
.agent-progress-bar {
  height: 100%;
  background: #60a5fa;
  width: 30%;
  animation: progressPulse 1.5s infinite ease-in-out alternate;
}
@keyframes progressPulse { 0% { width: 10%; } 100% { width: 90%; } }

.agent-last-used {
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* ─── Output Area ─── */
.output-area {
  margin-top: 2rem;
}
.output-tabs {
  display: flex; gap: 8px; margin-bottom: 1rem; overflow-x: auto; padding-bottom: 4px;
}
.out-tab {
  background: var(--bg-surface); border: 1px solid var(--glass-border);
  padding: 8px 16px; border-radius: 20px; font-size: 0.85rem; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: all 0.2s;
}
.out-tab.active {
  background: var(--bg-elevated); color: var(--text-main); border-color: var(--accent-primary);
}
.out-card {
  background: var(--bg-surface); border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg); padding: 1.5rem;
}
.out-card-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;
}
.out-card-content {
  font-size: 0.9rem; line-height: 1.6; color: #d1d5db; white-space: pre-wrap;
}

/* ═══════════════════════════════════════════════════════════════════
   HISTORY PAGE
   ═══════════════════════════════════════════════════════════════════ */

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  max-width: 1000px;
}
.history-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.25rem;
}
.history-page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.history-list { display: flex; flex-direction: column; gap: 0.75rem; max-width: 1000px;}
.history-item {
  background: var(--bg-surface); border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  cursor: pointer; transition: all 0.2s;
}
.history-item:hover { border-color: var(--accent-primary); background: var(--bg-elevated); transform: translateX(4px); }
.history-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.1);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.history-info { flex: 1; }
.history-title { font-size: 0.9rem; font-weight: 600; color: var(--text-main); margin-bottom: 2px; }
.history-meta { font-size: 0.75rem; color: var(--text-dim); }
.history-badges { flex-shrink: 0; }

.history-empty {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-surface);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-lg);
}

/* ═══════════════════════════════════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════════════════════════════════ */

.settings-header {
  margin-bottom: 2rem;
}
.settings-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.25rem;
}
.settings-page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; max-width: 1000px;
}
.settings-card {
  background: var(--bg-surface); border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg); padding: 1.25rem;
}
.settings-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--glass-border);
}
.settings-card-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0; border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.85rem;
}
.settings-row:last-child { border-bottom: none; }
.settings-label { color: var(--text-muted); }

.plan-badge {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(168, 85, 247, 0.15));
  color: var(--accent-bright);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.voice-active {
  color: #10b981;
  font-size: 0.82rem;
  font-weight: 500;
}

.settings-key-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════
   FLOW MAP — Real-time Agent Execution Visualization
   ═══════════════════════════════════════════════════════════════════ */

.flow-map {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 1.5rem 1rem;
  min-height: 380px;
  overflow-x: auto;
}

.flow-col { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.flow-col-io { flex: 0 0 110px; }
.flow-col-agents {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 0 0.5rem;
}

.flow-io-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  transition: all 0.4s ease;
  min-width: 90px;
  text-align: center;
}

.flow-io-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}

.flow-input .flow-io-icon { color: #818cf8; background: rgba(99,102,241,0.08); }
.flow-output .flow-io-icon { color: #34d399; background: rgba(16,185,129,0.08); }

.flow-io-label { font-size: 0.78rem; font-weight: 700; color: var(--text); }
.flow-io-sub { font-size: 0.65rem; color: var(--text-dim); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flow-input.ng-active {
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.06);
  box-shadow: 0 0 20px rgba(99,102,241,0.15);
}
.flow-output.ng-active {
  border-color: rgba(16,185,129,0.5);
  background: rgba(16,185,129,0.06);
  box-shadow: 0 0 20px rgba(16,185,129,0.15);
}

/* Arrows */
.flow-arrow {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 0 0 40px;
  opacity: 0.25;
  transition: opacity 0.4s ease;
}

.flow-arrow-line {
  width: 28px;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.3) 0, rgba(255,255,255,0.3) 4px, transparent 4px, transparent 8px);
}

.flow-arrow-head {
  font-size: 1rem;
  color: rgba(255,255,255,0.3);
  line-height: 1;
}

.flow-arrow.active { opacity: 1; }
.flow-arrow.active .flow-arrow-line {
  background: repeating-linear-gradient(90deg, #f59e0b 0, #f59e0b 4px, transparent 4px, transparent 8px);
  background-size: 8px 2px;
  animation: flow-dash 0.6s linear infinite;
}
.flow-arrow.active .flow-arrow-head { color: #f59e0b; }

.flow-arrow.complete { opacity: 1; }
.flow-arrow.complete .flow-arrow-line { background: #10b981; animation: none; }
.flow-arrow.complete .flow-arrow-head { color: #10b981; }

@keyframes flow-dash {
  from { background-position: 0 0; }
  to { background-position: 8px 0; }
}

/* Agent Nodes */
.ng-agent-node {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 6px 12px;
  min-width: 140px;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}

.ng-agent-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255,255,255,0.15);
  transition: all 0.35s ease;
}

.ng-agent-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ng-agent-name { font-size: 0.75rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.ng-agent-status { font-size: 0.62rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; transition: color 0.3s ease; }

.ng-agent-node.ng-idle { opacity: 0.45; }

.ng-agent-node.ng-running {
  opacity: 1;
  border-color: rgba(245,158,11,0.5);
  background: rgba(245,158,11,0.06);
  box-shadow: 0 0 12px rgba(245,158,11,0.15);
}
.ng-agent-node.ng-running .ng-agent-dot { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; animation: ng-pulse 1.2s infinite; }
.ng-agent-node.ng-running .ng-agent-status { color: #f59e0b; }

.ng-agent-node.ng-done {
  opacity: 1;
  border-color: rgba(16,185,129,0.4);
  background: rgba(16,185,129,0.05);
}
.ng-agent-node.ng-done .ng-agent-dot { background: #10b981; box-shadow: 0 0 6px #10b981; }
.ng-agent-node.ng-done .ng-agent-status { color: #10b981; }

.ng-agent-node.ng-revising {
  opacity: 1;
  border-color: rgba(139,92,246,0.5);
  background: rgba(139,92,246,0.06);
  box-shadow: 0 0 12px rgba(139,92,246,0.15);
}
.ng-agent-node.ng-revising .ng-agent-dot { background: #8b5cf6; box-shadow: 0 0 6px #8b5cf6; animation: ng-pulse 0.8s infinite; }
.ng-agent-node.ng-revising .ng-agent-status { color: #8b5cf6; }

.ng-agent-node.ng-error {
  opacity: 1;
  border-color: rgba(239,68,68,0.4);
  background: rgba(239,68,68,0.06);
}
.ng-agent-node.ng-error .ng-agent-dot { background: #ef4444; }
.ng-agent-node.ng-error .ng-agent-status { color: #ef4444; }

@keyframes ng-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(1.5); }
}

/* Live Log */
.flow-log {
  max-height: 100px;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  background: rgba(0,0,0,0.2);
  border-radius: 0 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.65rem;
}
.flow-log-item { color: var(--text-dim); line-height: 1.6; }
.flow-log-item.flow-log-dim { opacity: 0.5; }
.flow-log-item .log-agent { color: #818cf8; font-weight: 600; }
.flow-log-item .log-done { color: #10b981; }
.flow-log-item .log-running { color: #f59e0b; }
.flow-log-item .log-revising { color: #8b5cf6; }


.node-graph-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 1rem;
  min-height: 520px;
  overflow: hidden;
}

.node-graph-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.ng-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  gap: 0.5rem;
}

.ng-col-input,
.ng-col-output {
  flex: 0 0 140px;
}

.ng-col-agents {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 600px;
  padding: 0 1.5rem;
}

/* ─── Nodes ─── */

.ng-node {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 120px;
}

.ng-node-input,
.ng-node-output {
  min-width: 130px;
}

.ng-node-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.ng-node-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
}

.ng-node-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 2px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Agent Nodes (compact) ─── */

.ng-agent-node {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 6px 12px;
  min-width: 150px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ng-agent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.35s ease;
}

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

.ng-agent-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.ng-agent-status {
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
  transition: color 0.3s ease;
}

/* ─── Status States ─── */

.ng-agent-node.ng-idle {
  opacity: 0.5;
}

.ng-agent-node.ng-running {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.06);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
  opacity: 1;
}
.ng-agent-node.ng-running .ng-agent-status { color: #f59e0b; }
.ng-agent-node.ng-running .ng-agent-dot { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; animation: ng-pulse 1.2s infinite; }

.ng-agent-node.ng-done {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.06);
  opacity: 1;
}
.ng-agent-node.ng-done .ng-agent-status { color: #10b981; }
.ng-agent-node.ng-done .ng-agent-dot { background: #10b981; box-shadow: 0 0 6px #10b981; }

.ng-agent-node.ng-revising {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.06);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
  opacity: 1;
}
.ng-agent-node.ng-revising .ng-agent-status { color: #8b5cf6; }
.ng-agent-node.ng-revising .ng-agent-dot { background: #8b5cf6; box-shadow: 0 0 6px #8b5cf6; animation: ng-pulse 0.8s infinite; }

.ng-agent-node.ng-error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.06);
  opacity: 1;
}
.ng-agent-node.ng-error .ng-agent-status { color: #ef4444; }
.ng-agent-node.ng-error .ng-agent-dot { background: #ef4444; }

/* ─── Input/Output Active States ─── */

.ng-node-input.ng-active {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.ng-node-output.ng-active {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

/* ─── SVG Line Styles ─── */

.ng-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 1.5;
  transition: stroke 0.4s ease;
}

.ng-line.ng-line-active {
  stroke: rgba(245, 158, 11, 0.4);
}

.ng-line.ng-line-done {
  stroke: rgba(16, 185, 129, 0.3);
}

.ng-line-particle {
  fill: none;
  stroke-width: 2;
  stroke-dasharray: 6 14;
  animation: ng-flow 1.5s linear infinite;
}

@keyframes ng-flow {
  from { stroke-dashoffset: 20; }
  to   { stroke-dashoffset: 0; }
}

@keyframes ng-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.3); }
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .node-graph-container {
    flex-direction: column;
    min-height: auto;
    gap: 1.5rem;
  }
  .ng-col-agents {
    max-width: 100%;
    padding: 0;
  }
}
