/* ============================================
   JAE-AI Command Centre — Agent App Styles
   Story 1.4: /agent Page Shell
   Author: Amelia (BMAD Developer)
   Date: 28/04/2026
   ============================================ */

/* ─── CSS Custom Properties (Design Tokens) ─── */
:root {
  /* Backgrounds */
  --bg-base: #0a0a0e;
  --bg-elevated: #12121a;
  --bg-surface: #1a1a2e;
  --bg-hover: #252540;
  --bg-active: #2d2d4e;
  --bg-overlay: rgba(0, 0, 0, 0.7);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);
  --border-focus: #00f0ff;
  --border-radius-sm: 2px;
  --border-radius-md: 4px;
  --border-radius-lg: 6px;

  /* Text */
  --text-primary: #e8e8f0;
  --text-secondary: #9a9ab5;
  --text-muted: #5a5a7a;
  --text-inverse: #0a0a0e;

  /* Accents */
  --accent-cyan: #00f0ff;
  --accent-magenta: #ff00ff;
  --accent-green: #00ff41;
  --accent-amber: #ffaa00;
  --accent-red: #ff3355;
  --accent-gold: #ffd700;
  --accent-purple: #a855f7;
  --accent-blue: #3b82f6;
  --accent-grey: #6b7280;

  /* Typography */
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --text-xs: 0.65rem;
  --text-sm: 0.78rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --task-panel-width: 320px;
  --header-height: 64px;
  --mobile-nav-height: 56px;

  /* Animation */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.agent-page {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.agent-page button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.agent-page textarea {
  font-family: inherit;
  resize: none;
}

.agent-page a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.agent-page a:hover {
  text-decoration: underline;
}

/* ─── App Container ─── */
.agent-app {
  display: grid;
  grid-template-areas:
    "header header header"
    "sidebar workspace tasktracker";
  grid-template-columns: var(--sidebar-width) 1fr var(--task-panel-width);
  grid-template-rows: var(--header-height) 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ─── Header ─── */
.agent-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 400px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.brand-icon {
  font-size: var(--text-xl);
}

.sidebar-toggle-mobile,
.task-toggle-mobile {
  display: none;
  padding: var(--space-2);
  color: var(--text-secondary);
  border-radius: var(--border-radius-md);
}

.sidebar-toggle-mobile:hover,
.task-toggle-mobile:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ─── Model Selector ─── */
.model-selector {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.model-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast);
}

.model-trigger:hover {
  border-color: var(--border-strong);
}

.model-trigger:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.2);
}

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

.model-tag {
  font-size: var(--text-xs);
}

.model-chevron {
  transition: transform var(--transition-fast);
}

.model-trigger[aria-expanded="true"] .model-chevron {
  transform: rotate(180deg);
}

.model-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}

.model-dropdown.open {
  display: block;
}

.model-search-wrap {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.model-search {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.model-search:focus {
  outline: none;
  border-color: var(--border-focus);
}

.model-filters {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.model-filter {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.model-filter:hover,
.model-filter.active {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
}

.model-list {
  padding: var(--space-2);
}

.model-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.model-item-name {
  flex: 1;
  font-size: var(--text-sm);
}

.model-item-tag {
  font-size: var(--text-xs);
  padding: 2px 6px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-surface);
}

/* ─── Tier Badge ─── */
.tier-badge {
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tier-badge.tier-anonymous {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.4);
}

.tier-badge.tier-operator {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.tier-badge.tier-elite {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
  animation: pulse-glow 2s ease-in-out infinite;
}

.tier-badge.tier-pro {
  background: rgba(255, 215, 0, 0.15);
  color: #fde047;
  border: 1px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(168, 85, 247, 0.4); }
  50% { box-shadow: 0 0 20px rgba(168, 85, 247, 0.6); }
}

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

.settings-btn {
  padding: var(--space-2);
  color: var(--text-secondary);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
}

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

/* ─── Sidebar ─── */
.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-subtle);
  position: relative;
  transition: width var(--transition-base);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.mode-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-2);
  gap: var(--space-1);
  overflow-y: auto;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
}

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

.mode-btn.active {
  background: var(--bg-active);
  color: var(--accent-cyan);
  border-left: 3px solid var(--accent-cyan);
}

.mode-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.mode-label {
  white-space: nowrap;
  transition: opacity var(--transition-fast);
}

.sidebar.collapsed .mode-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .mode-btn {
  justify-content: center;
  padding: var(--space-3);
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-avatar {
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: opacity var(--transition-fast);
}

.sidebar.collapsed .user-info {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

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

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

.sidebar-toggle {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-2);
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sidebar.collapsed .sidebar-toggle {
  right: 50%;
  transform: translate(50%, -50%) rotate(180deg);
}

/* ─── Mode Workspace ─── */
.mode-workspace {
  grid-area: workspace;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

.mode-container {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.mode-container.active {
  display: flex;
}

/* ─── Chat Mode ─── */
.chat-canvas {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
}

.chat-welcome {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  max-width: 600px;
  margin: 0 auto;
}

.welcome-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.chat-welcome h2 {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}

.chat-welcome p {
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

.quick-action {
  padding: var(--space-2) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.quick-action:hover {
  background: var(--bg-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.typing-indicator {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-cyan);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
}

.attach-btn,
.mic-btn,
.send-btn {
  padding: var(--space-3);
  color: var(--text-secondary);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.attach-btn:hover,
.mic-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

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

.send-btn:hover {
  background: #33f3ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.chat-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-lg);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1.5;
  max-height: 120px;
  min-height: 44px;
}

.chat-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.2);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

/* ─── Voice Mode ─── */
.voice-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding: var(--space-6);
}

.voice-visualizer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.waveform {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 80px;
}

.wave-bar {
  width: 4px;
  background: var(--accent-cyan);
  border-radius: 2px;
  animation: wave-idle 1.2s ease-in-out infinite;
}

.wave-bar:nth-child(1) { height: 20%; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 40%; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 60%; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 30%; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 50%; animation-delay: 0.4s; }
.wave-bar:nth-child(6) { height: 70%; animation-delay: 0.5s; }
.wave-bar:nth-child(7) { height: 40%; animation-delay: 0.6s; }
.wave-bar:nth-child(8) { height: 60%; animation-delay: 0.7s; }
.wave-bar:nth-child(9) { height: 30%; animation-delay: 0.8s; }
.wave-bar:nth-child(10) { height: 50%; animation-delay: 0.9s; }
.wave-bar:nth-child(11) { height: 40%; animation-delay: 1.0s; }
.wave-bar:nth-child(12) { height: 20%; animation-delay: 1.1s; }

@keyframes wave-idle {
  0%, 100% { opacity: 0.4; transform: scaleY(0.8); }
  50% { opacity: 1; transform: scaleY(1.2); }
}

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

.voice-record-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--accent-cyan);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.voice-record-btn:hover {
  background: rgba(0, 240, 255, 0.1);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.voice-record-btn.recording {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: var(--text-primary);
  animation: pulse-record 1s ease-in-out infinite;
}

@keyframes pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 51, 85, 0.4); }
  50% { box-shadow: 0 0 0 20px rgba(255, 51, 85, 0); }
}

/* ─── Image Mode ─── */
.image-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  gap: var(--space-4);
  overflow-y: auto;
}

.image-prompt-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.image-prompt-input {
  width: 100%;
  min-height: 80px;
  padding: var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
}

.image-prompt-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.image-options {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.image-options select {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.image-generate-btn {
  padding: var(--space-2) var(--space-4);
  background: var(--accent-cyan);
  color: var(--text-inverse);
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.image-generate-btn:hover {
  background: #33f3ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.image-gallery {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
  align-content: start;
}

.image-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-12);
  color: var(--text-muted);
  font-size: var(--text-sm);
  border: 2px dashed var(--border-subtle);
  border-radius: var(--border-radius-lg);
}

/* ─── Video Mode ─── */
.video-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  gap: var(--space-4);
}

.video-timeline {
  background: var(--bg-elevated);
  border-radius: var(--border-radius-md);
  padding: var(--space-3);
}

.timeline-track {
  display: flex;
  height: 40px;
  background: var(--bg-surface);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
}

.timeline-clip {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-hover);
  border-right: 1px solid var(--border-subtle);
}

.timeline-clip:last-child {
  border-right: none;
}

.video-preview {
  flex: 1;
  background: var(--bg-elevated);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-placeholder {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.video-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--border-radius-md);
}

.video-btn {
  padding: var(--space-2);
  font-size: var(--text-lg);
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.video-btn:hover {
  color: var(--text-primary);
}

.video-progress {
  flex: 1;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}

.video-progress-bar {
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 3px;
  transition: width var(--transition-base);
}

/* ─── Code Mode ─── */
.code-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  padding: var(--space-2);
  overflow: hidden;
}

.code-editor-pane,
.code-output-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.code-lang-select {
  padding: var(--space-1) var(--space-2);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.code-run-btn {
  padding: var(--space-1) var(--space-3);
  background: var(--accent-green);
  color: var(--text-inverse);
  border-radius: var(--border-radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
}

.code-run-btn:hover {
  background: #33ff66;
}

.code-editor textarea,
.code-output {
  flex: 1;
  padding: var(--space-3);
  background: var(--bg-base);
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  overflow-y: auto;
  resize: none;
}

.code-output-header {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.code-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* ─── Agent Mode ─── */
.agent-workspace {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
}

.agent-config-panel {
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
}

.agent-config-panel h3 {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  margin-bottom: var(--space-6);
  color: var(--text-primary);
}

.agent-config-item {
  margin-bottom: var(--space-5);
}

.agent-config-item label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.agent-config-item select,
.agent-config-item input[type="checkbox"] {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.agent-tools-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.agent-tool-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.agent-tool-check input {
  accent-color: var(--accent-cyan);
}

/* ─── Memory Mode ─── */
.memory-workspace {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
}

.memory-search {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.memory-search-input {
  flex: 1;
  padding: var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
}

.memory-search-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.memory-search-btn {
  padding: var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-md);
  font-size: var(--text-lg);
}

.memory-categories {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.memory-cat {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.memory-cat:hover,
.memory-cat.active {
  background: var(--bg-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

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

.memory-placeholder {
  text-align: center;
  padding: var(--space-12);
  color: var(--text-muted);
}

/* ─── Brain Link Mode ─── */
.brain-workspace {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
}

.brain-connections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.brain-node {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-lg);
  padding: var(--space-5);
  text-align: center;
  transition: all var(--transition-fast);
}

.brain-node:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.1);
}

.brain-node-icon {
  font-size: 2rem;
  margin-bottom: var(--space-2);
}

.brain-node-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.brain-node-status {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.brain-node-status.connected {
  color: var(--accent-green);
}

.brain-add-btn {
  display: block;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 2px dashed var(--border-default);
  border-radius: var(--border-radius-lg);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.brain-add-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* ─── Task Tracker ─── */
.task-tracker {
  grid-area: tasktracker;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  position: relative;
  transition: width var(--transition-base);
  overflow: hidden;
  max-height: 100vh;
}

.task-tracker.collapsed {
  width: 0;
  min-width: 0;
  padding: 0;
  border: none;
  overflow: hidden;
}

.task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.task-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.task-title h3 {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
}

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

.live-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent-green);
  animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

.task-panel-toggle {
  padding: var(--space-2);
  color: var(--text-muted);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
}

.task-panel-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.task-list {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-2);
  min-height: 0;
  max-height: calc(100vh - 160px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,107,0,0.3) transparent;
}
.task-list::-webkit-scrollbar { width: 6px; }
.task-list::-webkit-scrollbar-track { background: transparent; }
.task-list::-webkit-scrollbar-thumb { background: rgba(255,107,0,0.3); border-radius: 3px; }
.task-list::-webkit-scrollbar-thumb:hover { background: rgba(255,107,0,0.5); }

.task-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  margin-bottom: var(--space-2);
  transition: all var(--transition-fast);
}

.task-item:hover {
  border-color: var(--border-default);
}

.task-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
}

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

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

.task-meta-line {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.task-progress {
  height: 4px;
  background: var(--bg-base);
  border-radius: 2px;
  margin-top: var(--space-2);
  overflow: hidden;
}

.task-progress-bar {
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 2px;
  transition: width var(--transition-base);
  position: relative;
}

.task-progress-bar::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 infinite;
}

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

.task-status {
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.task-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.task-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.view-completed {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.view-completed:hover {
  color: var(--accent-cyan);
}

/* ─── Mobile Bottom Nav ─── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-width: 60px;
  padding: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  transition: all var(--transition-fast);
  border-top: 2px solid transparent;
}

.mobile-nav-btn.active {
  color: var(--accent-cyan);
  border-top-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
}

.mobile-nav-icon {
  font-size: var(--text-lg);
}

.mobile-nav-label {
  font-size: 10px;
  white-space: nowrap;
}

/* ─── Responsive Breakpoints ─── */

/* Tablet: 768px–1023px */
@media (max-width: 1023px) {
  .agent-app {
    grid-template-columns: var(--sidebar-collapsed) 1fr 0;
  }

  .sidebar {
    width: var(--sidebar-collapsed);
  }

  .sidebar .mode-label,
  .sidebar .user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  .sidebar .mode-btn {
    justify-content: center;
    padding: var(--space-3);
  }

  .sidebar .sidebar-toggle {
    display: none;
  }

  .task-tracker {
    position: fixed;
    right: 0;
    top: var(--header-height);
    bottom: 0;
    width: var(--task-panel-width);
    z-index: 90;
    transform: translateX(100%);
    transition: transform var(--transition-base);
  }

  .task-tracker.open {
    transform: translateX(0);
  }

  .task-toggle-mobile {
    display: block;
  }
}

/* Mobile: ≤767px */
@media (max-width: 767px) {
  .agent-app {
    grid-template-areas:
      "header"
      "workspace";
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-height) 1fr;
    padding-bottom: var(--mobile-nav-height);
  }

  .sidebar {
    display: none;
  }

  .task-tracker {
    top: var(--header-height);
    width: 100%;
    max-width: 400px;
  }

  .mobile-nav {
    display: flex;
  }

  .sidebar-toggle-mobile {
    display: block;
  }

  .header-center {
    max-width: 200px;
  }

  .model-name {
    max-width: 100px;
  }

  .identity {
    display: none;
  }

  .code-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .quick-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-action {
    text-align: center;
  }
}

/* ─── Scrollbar Styling ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ─── Focus Visible ─── */
*:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Print ─── */
@media print {
  .sidebar,
  .task-tracker,
  .mobile-nav,
  .chat-input-bar {
    display: none !important;
  }

  .agent-app {
    grid-template-columns: 1fr;
  }
}

/* ─── Chat Messages ─── */
.message-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: messageSlideIn 0.3s ease;
}

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

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.message-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-3);
}

.message-name {
    font-weight: 600;
    color: var(--text-2);
}

.message-time {
    font-size: 0.7rem;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

.message-user .message-content {
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-assistant .message-content {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message-meta {
    font-size: 0.7rem;
    color: var(--text-3);
    margin-top: 0.25rem;
}

.tool-calls {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tool-call {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.tool-name {
    font-weight: 600;
    color: var(--accent);
    display: block;
    margin-bottom: 0.25rem;
}

.tool-call pre {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-3);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1.5rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ─── Rich Cards ─── */
.card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin: 0.5rem 0;
    animation: cardSlideIn 0.3s ease;
}

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

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
}

.card-icon { font-size: 1rem; }
.card-title { color: var(--text-2); }

.card-body {
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.card-body img,
.card-body iframe {
    max-width: 100%;
    border-radius: 8px;
}

.card-body iframe {
    aspect-ratio: 16/9;
    width: 100%;
    border: none;
}

/* Price card */
.price-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-1);
}

.price-change {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.25rem 0;
}

.price-change.positive { color: #22c55e; }
.price-change.negative { color: #ef4444; }

.price-detail {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-top: 0.5rem;
}

/* News card */
.news-headline {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text-1);
}

.news-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-3);
    margin-bottom: 0.5rem;
}

.news-summary {
    font-size: 0.85rem;
    color: var(--text-2);
    line-height: 1.5;
}

/* Wallet card */
.wallet-address {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-3);
    margin-bottom: 0.25rem;
}

.wallet-balance {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-1);
}

.wallet-detail {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-top: 0.5rem;
}

/* Code card */
.card-code pre {
    margin: 0;
    padding: 0.75rem;
    background: #0d1117;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.5;
}

.card-code code {
    font-family: 'JetBrains Mono', monospace;
    color: #e6edf3;
}

.copy-btn {
    margin-left: auto;
    padding: 0.25rem 0.75rem;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-2);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Report card */
.report-content {
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.report-more {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-top: 0.5rem;
    font-style: italic;
}


/* ============================================================
   SPRINT 3a — VISUAL POLISH OVERRIDE LAYER
   Added: 28/04/2026  v5.8.6
   Goal: glassmorphism, animated bg, glow FX, hover micro-anims,
         themed user bubble (no more white), custom scrollbar.
   ============================================================ */

:root {
  --brand: #FF6B00;
  --brand-2: #ff8c2e;
  --brand-glow: 0 0 24px rgba(255, 107, 0, 0.45);
  --brand-glow-soft: 0 0 12px rgba(255, 107, 0, 0.25);
  --glass-bg: rgba(18, 18, 26, 0.55);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-blur: blur(22px) saturate(140%);
  --user-bubble-bg: linear-gradient(135deg, rgba(255,107,0,0.18) 0%, rgba(255,107,0,0.08) 100%);
  --user-bubble-border: rgba(255, 107, 0, 0.35);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 32px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,107,0,0.06);
}

/* ─── Animated background mesh + starfield ─── */
body.agent-page {
  background:
    radial-gradient(1200px 800px at 15% 10%, rgba(255, 107, 0, 0.08), transparent 60%),
    radial-gradient(1000px 700px at 85% 90%, rgba(120, 60, 255, 0.07), transparent 60%),
    radial-gradient(900px 600px at 50% 50%, rgba(0, 240, 255, 0.04), transparent 70%),
    #06060a !important;
  overflow: hidden;
  position: relative;
}
body.agent-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,0.6), transparent 60%),
    radial-gradient(1px 1px at 38% 71%, rgba(255,255,255,0.4), transparent 60%),
    radial-gradient(1.5px 1.5px at 62% 18%, rgba(255,180,120,0.5), transparent 60%),
    radial-gradient(1px 1px at 84% 55%, rgba(255,255,255,0.5), transparent 60%),
    radial-gradient(1px 1px at 92% 92%, rgba(255,255,255,0.3), transparent 60%),
    radial-gradient(1px 1px at 25% 88%, rgba(255,255,255,0.4), transparent 60%),
    radial-gradient(1.2px 1.2px at 70% 35%, rgba(255,200,150,0.4), transparent 60%);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
  animation: starfield-drift 90s linear infinite;
}
body.agent-page::after {
  content: '';
  position: fixed;
  inset: -50%;
  background:
    conic-gradient(from 0deg at 50% 50%,
      rgba(255, 107, 0, 0.04),
      rgba(120, 60, 255, 0.04),
      rgba(0, 240, 255, 0.03),
      rgba(255, 107, 0, 0.04));
  filter: blur(80px);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
  animation: mesh-rotate 60s linear infinite;
}
@keyframes starfield-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-40px, -60px, 0); }
}
@keyframes mesh-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* keep app above background fx */
.agent-app, #agent-app {
  position: relative;
  z-index: 1;
}

/* ─── Glassmorphism: header, sidebar, task panel, model selector ─── */
.agent-header,
.agent-sidebar,
.task-panel,
.task-tracker,
.model-selector,
.model-dropdown,
.composer,
.chat-composer {
  background: var(--glass-bg) !important;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-color: var(--glass-border) !important;
}

.agent-header {
  border-bottom: 1px solid var(--glass-border) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 24px rgba(0,0,0,0.35);
}
.agent-sidebar {
  border-right: 1px solid var(--glass-border) !important;
}
.task-panel, .task-tracker {
  border-left: 1px solid var(--glass-border) !important;
}

/* ─── Brand mark glow ─── */
.brand-mark, .brand-text {
  text-shadow: 0 0 18px rgba(255, 107, 0, 0.4);
}
.brand-icon {
  filter: drop-shadow(0 0 8px rgba(255, 107, 0, 0.6));
}

/* ─── Sidebar nav items: hover slide + glow ─── */
.sidebar-nav .nav-item,
.sidebar-item,
.nav-link {
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease, color 180ms ease;
  border-radius: 10px;
  position: relative;
}
.sidebar-nav .nav-item:hover,
.sidebar-item:hover,
.nav-link:hover {
  transform: translateX(3px);
  background: rgba(255, 107, 0, 0.08) !important;
  color: var(--brand) !important;
  box-shadow: var(--brand-glow-soft);
}
.sidebar-nav .nav-item.active,
.sidebar-item.active,
.nav-link.active {
  background: linear-gradient(90deg, rgba(255, 107, 0, 0.18), rgba(255, 107, 0, 0.04)) !important;
  color: var(--brand) !important;
  box-shadow: inset 3px 0 0 var(--brand), var(--brand-glow-soft);
}

/* ─── Buttons — glow + hover lift ─── */
.btn,
.send-btn,
.composer-send,
button.primary,
.btn-primary {
  transition: transform 180ms ease, box-shadow 220ms ease, background 200ms ease;
}
.send-btn,
.composer-send,
.btn-primary,
button.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  color: #0a0a0e !important;
  font-weight: 700;
  border: none !important;
  box-shadow: var(--brand-glow-soft);
}
.send-btn:hover,
.composer-send:hover,
.btn-primary:hover,
button.primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--brand-glow);
}
.send-btn:active, .composer-send:active { transform: translateY(0); }

/* ─── Composer / chat input ─── */
.composer, .chat-composer {
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,107,0,0.04);
  transition: box-shadow 200ms ease, border-color 200ms ease;
}
.composer:focus-within, .chat-composer:focus-within {
  border-color: rgba(255, 107, 0, 0.5) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55), 0 0 0 1px var(--brand), var(--brand-glow-soft);
}
.composer input,
.composer textarea,
.chat-composer input,
.chat-composer textarea {
  color: var(--text-primary) !important;
  background: transparent !important;
}
.composer input::placeholder,
.composer textarea::placeholder,
.chat-composer input::placeholder,
.chat-composer textarea::placeholder {
  color: rgba(154, 154, 181, 0.55) !important;
}

/* ─── User chat bubble — FIX the white background ─── */
.message-user .message-content,
.msg-user .msg-content,
.chat-msg.user .bubble {
  background: var(--user-bubble-bg) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--user-bubble-border) !important;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 12px rgba(255, 107, 0, 0.12), 0 0 0 1px rgba(255,107,0,0.04) inset;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.message-assistant .message-content,
.msg-assistant .msg-content,
.chat-msg.assistant .bubble {
  background: rgba(26, 26, 46, 0.6) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-primary) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.4);
}
.message-avatar {
  background: linear-gradient(135deg, rgba(255,107,0,0.25), rgba(255,107,0,0.05)) !important;
  border: 1px solid var(--user-bubble-border) !important;
  box-shadow: var(--brand-glow-soft);
}

/* ─── Task tracker cards — glass + glow per status ─── */
.task-card, .task-item {
  background: rgba(20, 20, 32, 0.55) !important;
  border: 1px solid var(--glass-border) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: transform 180ms ease, box-shadow 220ms ease;
  border-radius: 12px !important;
}
.task-card:hover, .task-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,107,0,0.18);
}
.task-card.running, .task-item.running { box-shadow: inset 3px 0 0 var(--brand), var(--shadow-card); }
.task-card.complete, .task-item.complete { box-shadow: inset 3px 0 0 #00ff88, var(--shadow-card); }
.task-card.failed, .task-item.failed { box-shadow: inset 3px 0 0 #ff3355, var(--shadow-card); }
.task-card.waiting, .task-item.waiting { box-shadow: inset 3px 0 0 #6b7280, var(--shadow-card); }
.task-progress, .progress-bar-fill {
  background: linear-gradient(90deg, var(--brand), var(--brand-2)) !important;
  box-shadow: 0 0 12px rgba(255, 107, 0, 0.5);
}
.task-empty {
  color: rgba(154, 154, 181, 0.5);
  font-style: italic;
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.85rem;
}

/* ─── Model selector dropdown ─── */
.model-selector, .model-pill, .model-button {
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-radius: 10px;
  transition: border-color 180ms ease, box-shadow 220ms ease;
}
.model-selector:hover, .model-pill:hover, .model-button:hover {
  border-color: rgba(255, 107, 0, 0.4) !important;
  box-shadow: var(--brand-glow-soft);
}

/* ─── Custom scrollbars (orange thin) ─── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 107, 0, 0.4) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255,107,0,0.45), rgba(255,107,0,0.25));
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255,107,0,0.7), rgba(255,107,0,0.45));
}

/* ─── Typing indicator (3 orange dots pulsing) ─── */
.typing-indicator, .typing-dots {
  display: inline-flex;
  gap: 5px;
  padding: 8px 14px;
  background: rgba(26, 26, 46, 0.55);
  backdrop-filter: blur(12px);
  border-radius: 14px;
  border: 1px solid var(--glass-border);
}
.typing-indicator span, .typing-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 8px rgba(255,107,0,0.6);
  animation: typing-pulse 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2), .typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3), .typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-pulse {
  0%, 60%, 100% { transform: scale(0.7); opacity: 0.4; }
  30% { transform: scale(1.1); opacity: 1; }
}

/* ─── Tier badge glow ─── */
.tier-badge, .tier-pill {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.65rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,107,0,0.3);
  background: rgba(255, 107, 0, 0.1);
  color: var(--brand);
  box-shadow: var(--brand-glow-soft);
}
.tier-badge.elite, .tier-pill.elite { background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,107,0,0.15)); color: #ffd700; border-color: rgba(255,215,0,0.4); box-shadow: 0 0 16px rgba(255,215,0,0.3); }
.tier-badge.admin, .tier-pill.admin { background: rgba(168, 85, 247, 0.15); color: #a855f7; border-color: rgba(168,85,247,0.4); box-shadow: 0 0 16px rgba(168,85,247,0.3); }
.tier-badge.anonymous, .tier-pill.anonymous { background: rgba(107,114,128,0.12); color: #9a9ab5; border-color: rgba(107,114,128,0.3); box-shadow: none; }

/* ─── Reduce motion respect ─── */
@media (prefers-reduced-motion: reduce) {
  body.agent-page::before,
  body.agent-page::after { animation: none !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Error message styling ─── */
.message-error, .error-banner {
  background: rgba(255, 51, 85, 0.1) !important;
  border: 1px solid rgba(255, 51, 85, 0.35) !important;
  color: #ff7a8e !important;
  border-radius: 10px;
}


/* ─── Sprint 3a.1 — collapsible tool cards w/ result ─── */
details.tool-call {
  background: rgba(20, 20, 32, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0;
  margin: 8px 0;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 200ms ease, box-shadow 220ms ease;
}
details.tool-call[open] {
  border-color: rgba(255, 107, 0, 0.3);
  box-shadow: var(--brand-glow-soft);
}
details.tool-call summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  user-select: none;
  transition: background 180ms ease;
}
details.tool-call summary::-webkit-details-marker { display: none; }
details.tool-call summary::before {
  content: '▸';
  color: var(--brand);
  font-size: 0.7rem;
  transition: transform 200ms ease;
  width: 8px;
}
details.tool-call[open] summary::before { transform: rotate(90deg); }
details.tool-call summary:hover { background: rgba(255, 107, 0, 0.06); }
details.tool-call .tool-name {
  color: var(--brand);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  flex: 1;
}
details.tool-call .tool-status {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.15);
  color: #9a9ab5;
  border: 1px solid rgba(255,255,255,0.08);
}
details.tool-call .tool-status.ok {
  background: rgba(0, 255, 136, 0.12);
  color: #00ff88;
  border-color: rgba(0, 255, 136, 0.3);
  box-shadow: 0 0 8px rgba(0,255,136,0.2);
}
details.tool-call .tool-status.err {
  background: rgba(255, 51, 85, 0.12);
  color: #ff7a8e;
  border-color: rgba(255, 51, 85, 0.3);
}
details.tool-call .tool-args,
details.tool-call .tool-result {
  padding: 8px 14px 10px;
  border-top: 1px dashed rgba(255,255,255,0.06);
}
details.tool-call .tool-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(154, 154, 181, 0.7);
  margin-bottom: 4px;
  font-weight: 600;
}
details.tool-call pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #e8e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}
details.tool-call .tool-noargs {
  color: rgba(154, 154, 181, 0.6);
  font-style: italic;
  font-size: 0.78rem;
}
details.tool-call .tool-result {
  background: rgba(255, 107, 0, 0.04);
}

/* ─── Sprint 3a.2 — model warning notice ─── */
.message-notice .message-content {
  background: rgba(255, 170, 0, 0.08) !important;
  border: 1px solid rgba(255, 170, 0, 0.35) !important;
  color: #ffd28a !important;
  font-size: 0.82rem;
  font-style: italic;
  padding: 8px 14px !important;
}
.message-notice .message-avatar { background: rgba(255, 170, 0, 0.15) !important; border-color: rgba(255, 170, 0, 0.35) !important; }

/* ─── Sprint 3a.3 — solid model dropdown + upgrade CTA ─── */
.model-dropdown {
  background: #0f0f17 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid rgba(255, 107, 0, 0.25) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 107, 0, 0.08) !important;
}
.model-dropdown .model-search {
  background: #1a1a26 !important;
  border-color: rgba(255,255,255,0.08) !important;
}
.model-dropdown .model-search:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.2);
}
.model-dropdown .model-filter {
  background: rgba(255,255,255,0.03) !important;
  border-color: rgba(255,255,255,0.08) !important;
}
.model-dropdown .model-filter:hover,
.model-dropdown .model-filter.active {
  color: var(--brand) !important;
  border-color: rgba(255,107,0,0.4) !important;
  background: rgba(255,107,0,0.08) !important;
}
.model-dropdown .model-item {
  border-radius: 8px;
  margin: 2px 0;
  transition: background 160ms ease, transform 160ms ease;
}
.model-dropdown .model-item:hover {
  background: rgba(255, 107, 0, 0.1) !important;
  transform: translateX(2px);
}

.model-upgrade-cta {
  margin: 8px 6px 6px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255,107,0,0.12), rgba(168,85,247,0.08));
  border: 1px solid rgba(255, 107, 0, 0.3);
  border-radius: 10px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.model-upgrade-cta::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(400px 80px at 50% 0%, rgba(255,107,0,0.15), transparent 70%);
  pointer-events: none;
}
.model-upgrade-cta .upgrade-headline {
  font-weight: 700; font-size: 0.82rem; color: #ffd28a;
  margin-bottom: 4px; letter-spacing: 0.02em;
}
.model-upgrade-cta .upgrade-sub {
  font-size: 0.7rem; color: rgba(232, 232, 240, 0.65);
  line-height: 1.45; margin-bottom: 10px;
}
.model-upgrade-cta .upgrade-btn {
  display: inline-block;
  padding: 6px 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #0a0a0e !important;
  font-weight: 700; font-size: 0.78rem;
  border-radius: 999px; text-decoration: none;
  box-shadow: var(--brand-glow-soft);
  transition: transform 180ms ease, box-shadow 220ms ease;
}
.model-upgrade-cta .upgrade-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--brand-glow);
}
.model-empty {
  padding: 20px; text-align: center;
  color: rgba(154,154,181,0.5); font-style: italic; font-size: 0.85rem;
}

/* ────────────────────────────────────────────────────────────
   SPRINT 3a.4 — RICH TOOL CARDS  (price, news, search, wallet,
   image, weather, market) with sparklines & glassmorphism.
   ──────────────────────────────────────────────────────────── */
.rich-cards-host { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 8px; }
.rich-card-wrap {
    opacity: 0; transform: translateY(8px) scale(0.985);
    transition: opacity 280ms ease, transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}
.rich-card-wrap.rc-in { opacity: 1; transform: translateY(0) scale(1); }

.rich-card {
    background: linear-gradient(180deg, rgba(20,20,32,0.7), rgba(15,15,23,0.65));
    border: 1px solid var(--glass-border, rgba(255,255,255,0.07));
    border-radius: 14px;
    padding: 14px 16px;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 32px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,107,0,0.05);
    transition: transform 220ms ease, box-shadow 240ms ease;
    color: var(--text-primary, #e8e8f0);
    position: relative;
    overflow: hidden;
}
.rich-card::before {
    content: '';
    position: absolute; inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,107,0,0.18), transparent 40%, transparent 60%, rgba(168,85,247,0.12));
    pointer-events: none; z-index: -1;
    opacity: 0.55;
}
.rich-card:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,107,0,0.18); }

.rc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.78rem; }
.rc-glyph { font-size: 1.2rem; line-height: 1; filter: drop-shadow(0 0 8px rgba(255,107,0,0.4)); }
.rc-symbol { font-weight: 700; letter-spacing: 0.04em; color: var(--text-primary); font-size: 0.85rem; }
.rc-source, .rc-query { margin-left: auto; font-size: 0.68rem; color: rgba(154,154,181,0.65); text-transform: uppercase; letter-spacing: 0.06em; }
.rc-query { text-transform: none; font-style: italic; }

/* Price card */
.price-card .rc-price { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-top: 4px; color: #fff; text-shadow: 0 0 18px rgba(255,107,0,0.18); }
.price-card.up   .rc-price { color: #b3ffd6; text-shadow: 0 0 22px rgba(0,255,136,0.22); }
.price-card.down .rc-price { color: #ffc2cc; text-shadow: 0 0 22px rgba(255,85,119,0.22); }
.rc-change { font-size: 0.92rem; font-weight: 700; margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; }
.rc-change.pos { color: #00ff88; background: rgba(0,255,136,0.1); border: 1px solid rgba(0,255,136,0.3); box-shadow: 0 0 12px rgba(0,255,136,0.2); }
.rc-change.neg { color: #ff5577; background: rgba(255,85,119,0.1); border: 1px solid rgba(255,85,119,0.3); box-shadow: 0 0 12px rgba(255,85,119,0.2); }
.rc-period { opacity: 0.7; font-weight: 500; font-size: 0.72rem; }
.rc-spark { margin: 12px -2px 4px; opacity: 0.95; }
.rc-spark svg { width: 100%; height: auto; display: block; }
.rc-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 0.78rem; color: rgba(232,232,240,0.7); }
.rc-meta b { color: var(--text-primary); }

/* News card */
.news-card .rc-news-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.news-item { display: flex; gap: 12px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,0.02); border: 1px solid transparent; text-decoration: none; color: inherit; transition: background 180ms ease, border-color 180ms ease, transform 180ms ease; }
.news-item:hover { background: rgba(255,107,0,0.05); border-color: rgba(255,107,0,0.2); transform: translateX(2px); }
.news-thumb, .news-thumb-fallback { width: 72px; height: 72px; border-radius: 8px; flex-shrink: 0; object-fit: cover; background: rgba(255,255,255,0.04); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.news-body { flex: 1; min-width: 0; }
.news-title { font-weight: 600; font-size: 0.88rem; line-height: 1.35; color: var(--text-primary); margin-bottom: 4px; }
.news-meta { display: flex; gap: 6px; font-size: 0.68rem; color: rgba(154,154,181,0.6); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.news-snippet { font-size: 0.78rem; color: rgba(232,232,240,0.7); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Search card */
.search-card .rc-search-list { display: flex; flex-direction: column; gap: 10px; }
.search-item { display: block; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,0.02); border: 1px solid transparent; text-decoration: none; color: inherit; transition: all 180ms ease; }
.search-item:hover { background: rgba(0,240,255,0.05); border-color: rgba(0,240,255,0.2); transform: translateX(2px); }
.search-host { display: flex; align-items: center; gap: 6px; font-size: 0.7rem; color: rgba(0,240,255,0.7); margin-bottom: 4px; }
.favicon { width: 14px; height: 14px; border-radius: 3px; }
.search-title { font-weight: 600; font-size: 0.88rem; color: var(--text-primary); margin-bottom: 4px; }
.search-snippet { font-size: 0.78rem; color: rgba(232,232,240,0.65); line-height: 1.5; }

/* Wallet card */
.wallet-card .wallet-addr { font-family: var(--font-mono, monospace); font-size: 0.8rem; color: rgba(255,107,0,0.85); margin-bottom: 4px; }
.wallet-balance { font-size: 1.5rem; font-weight: 800; }
.wallet-usd { font-size: 0.85rem; color: rgba(154,154,181,0.7); font-weight: 500; margin-left: 6px; }
.wallet-tokens { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.05); }
.wallet-token { display: flex; gap: 12px; align-items: center; font-size: 0.82rem; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,0.02); }
.tk-sym { font-weight: 700; color: var(--brand, #FF6B00); flex-shrink: 0; min-width: 54px; }
.tk-amt { flex: 1; font-family: var(--font-mono, monospace); }
.tk-usd { color: rgba(154,154,181,0.7); font-size: 0.75rem; }

/* Image card */
.image-card .img-preview { width: 100%; max-height: 480px; object-fit: contain; border-radius: 10px; background: #000; box-shadow: 0 8px 28px rgba(0,0,0,0.5); }
.img-prompt { margin-top: 10px; font-size: 0.82rem; color: rgba(232,232,240,0.7); font-style: italic; line-height: 1.5; }

/* Weather card */
.weather-card .rc-temp { font-size: 2.4rem; font-weight: 800; line-height: 1; margin-top: 6px; }
.weather-card .rc-cond { font-size: 0.95rem; color: rgba(232,232,240,0.85); margin-top: 4px; text-transform: capitalize; }

/* Market card */
.market-card .market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 4px; }
.market-tile { padding: 10px; border-radius: 10px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); transition: transform 180ms ease, border-color 180ms ease; }
.market-tile:hover { transform: translateY(-2px); }
.market-tile.up   { border-color: rgba(0,255,136,0.25); }
.market-tile.down { border-color: rgba(255,85,119,0.25); }
.mk-sym { font-weight: 700; font-size: 0.78rem; color: var(--brand, #FF6B00); margin-bottom: 4px; }
.mk-price { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.mk-chg { font-size: 0.72rem; font-weight: 600; }
.mk-chg.pos { color: #00ff88; } .mk-chg.neg { color: #ff5577; }

/* Error card */
.error-card { background: rgba(255,51,85,0.08); border-color: rgba(255,51,85,0.3); }
.rc-err { font-size: 0.84rem; color: #ff7a8e; font-family: var(--font-mono, monospace); margin-top: 4px; }

/* ────────────────────────────────────────────────────────────
   SPRINT 3b — AUTH UI (Connect Wallet, Email modal, User chip,
   tier-coloured chip, dropdown menu)
   ──────────────────────────────────────────────────────────── */
#agent-auth-host { display: flex; align-items: center; gap: 8px; margin-right: 6px; }
.auth-connect {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 999px;
    font-weight: 700; font-size: 0.78rem; cursor: pointer;
    transition: transform 180ms ease, box-shadow 220ms ease, background 200ms ease;
    border: 1px solid transparent;
}
.auth-connect.primary {
    background: linear-gradient(135deg, var(--brand, #FF6B00), var(--brand-2, #ff8c2e));
    color: #0a0a0e;
    box-shadow: var(--brand-glow-soft, 0 0 12px rgba(255,107,0,0.25));
}
.auth-connect.primary:hover { transform: translateY(-1px); box-shadow: var(--brand-glow, 0 0 24px rgba(255,107,0,0.45)); }
.auth-connect.ghost {
    background: rgba(255,255,255,0.04); color: var(--text-primary, #e8e8f0);
    border-color: rgba(255,255,255,0.1);
}
.auth-connect.ghost:hover { background: rgba(255,107,0,0.08); border-color: rgba(255,107,0,0.3); color: var(--brand, #FF6B00); }
.auth-connect .btn-glyph { font-size: 0.95rem; }

/* User chip when connected */
.auth-user-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 12px 5px 6px; border-radius: 999px;
    background: rgba(20,20,32,0.6); backdrop-filter: blur(12px);
    border: 1px solid rgba(255,107,0,0.25);
    color: var(--text-primary, #e8e8f0);
    cursor: pointer; font-size: 0.78rem;
    transition: border-color 200ms ease, box-shadow 220ms ease;
}
.auth-user-chip:hover { border-color: rgba(255,107,0,0.5); box-shadow: var(--brand-glow-soft); }
.auth-user-chip .chip-tier {
    font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
    padding: 3px 8px; border-radius: 999px;
    background: rgba(255,107,0,0.15); color: var(--brand, #FF6B00);
    border: 1px solid rgba(255,107,0,0.3);
}
.auth-user-chip .chip-tier.tier-elite { background: rgba(255,215,0,0.15); color: #ffd700; border-color: rgba(255,215,0,0.4); }
.auth-user-chip .chip-tier.tier-admin { background: rgba(168,85,247,0.15); color: #a855f7; border-color: rgba(168,85,247,0.4); }
.auth-user-chip .chip-tier.tier-anonymous { background: rgba(107,114,128,0.12); color: #9a9ab5; border-color: rgba(107,114,128,0.3); }
.auth-user-chip .chip-addr { font-family: var(--font-mono, monospace); }
.auth-user-chip .chip-caret { font-size: 0.7rem; color: rgba(154,154,181,0.7); }

/* User menu dropdown */
.auth-menu {
    position: fixed; z-index: 9999;
    background: #0f0f17; border: 1px solid rgba(255,107,0,0.25);
    border-radius: 12px; padding: 8px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,107,0,0.08);
    min-width: 240px;
}
.auth-menu-row.hd { display: flex; align-items: center; gap: 8px; padding: 8px 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 6px; }
.auth-menu-addr { font-family: var(--font-mono, monospace); font-size: 0.72rem; color: rgba(232,232,240,0.6); word-break: break-all; }
.auth-menu-item {
    display: block; width: 100%; text-align: left;
    padding: 9px 12px; border-radius: 8px;
    background: transparent; border: none; color: var(--text-primary);
    font-size: 0.82rem; cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}
.auth-menu-item:hover { background: rgba(255,107,0,0.08); color: var(--brand, #FF6B00); }
.auth-menu-item.danger:hover { background: rgba(255,51,85,0.08); color: #ff7a8e; }

/* Email login modal */
.auth-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 200ms ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.auth-modal {
    width: min(92vw, 420px); padding: 28px;
    background: linear-gradient(180deg, rgba(20,20,32,0.95), rgba(10,10,14,0.98));
    border: 1px solid rgba(255,107,0,0.3); border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 60px rgba(255,107,0,0.1);
    position: relative;
}
.auth-modal h3 { font-size: 1.3rem; margin: 0 0 6px; color: var(--text-primary); }
.auth-modal .auth-sub { font-size: 0.82rem; color: rgba(154,154,181,0.7); margin: 0 0 18px; }
.auth-modal label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(154,154,181,0.7); margin: 12px 0 4px; }
.auth-modal input {
    width: 100%; padding: 9px 12px; border-radius: 8px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary); font-size: 0.88rem;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}
.auth-modal input:focus { outline: none; border-color: var(--brand, #FF6B00); box-shadow: 0 0 0 2px rgba(255,107,0,0.2); }
.auth-actions { display: flex; gap: 10px; margin-top: 20px; }
.auth-btn { flex: 1; padding: 10px; border-radius: 10px; font-weight: 700; cursor: pointer; transition: transform 180ms ease, box-shadow 220ms ease; border: none; font-size: 0.85rem; }
.auth-btn.primary { background: linear-gradient(135deg, var(--brand, #FF6B00), var(--brand-2, #ff8c2e)); color: #0a0a0e; }
.auth-btn.primary:hover { transform: translateY(-1px); box-shadow: var(--brand-glow, 0 0 24px rgba(255,107,0,0.45)); }
.auth-btn.ghost { background: rgba(255,255,255,0.04); color: var(--text-primary); border: 1px solid rgba(255,255,255,0.1); }
.auth-btn.ghost:hover { background: rgba(255,107,0,0.08); }
.auth-close {
    position: absolute; top: 12px; right: 14px; background: transparent; border: none;
    color: rgba(154,154,181,0.7); font-size: 1.6rem; cursor: pointer; line-height: 1; padding: 0; width: 28px; height: 28px;
    border-radius: 50%; transition: background 160ms ease, color 160ms ease;
}
.auth-close:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.auth-error { margin-top: 12px; padding: 8px 12px; background: rgba(255,51,85,0.12); border: 1px solid rgba(255,51,85,0.3); border-radius: 8px; color: #ff7a8e; font-size: 0.78rem; }

/* ────────────────────────────────────────────────────────────
   SPRINT 3c — VOICE MODE BUTTONS
   ──────────────────────────────────────────────────────────── */
.mic-btn { transition: transform 180ms ease, box-shadow 220ms ease, background 200ms ease; }
.mic-btn.listening, .mic-btn[data-listening="true"], #voice-mic-btn.active {
    background: linear-gradient(135deg, #ff3355, #ff5577) !important;
    color: #fff !important;
    box-shadow: 0 0 0 4px rgba(255,51,85,0.2), 0 0 20px rgba(255,51,85,0.5) !important;
    animation: mic-pulse 1.4s infinite ease-in-out;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(255,51,85,0.2), 0 0 20px rgba(255,51,85,0.5); }
    50%      { box-shadow: 0 0 0 8px rgba(255,51,85,0.05), 0 0 32px rgba(255,51,85,0.7); }
}

/* Wallet picker modal */
.auth-modal.wallet-picker { width: min(96vw, 480px); }
.wallet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.wallet-tile {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 16px 10px; border-radius: 12px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-primary); cursor: pointer;
    transition: transform 180ms ease, border-color 200ms ease, background 200ms ease, box-shadow 220ms ease;
}
.wallet-tile:hover { transform: translateY(-2px); border-color: rgba(255,107,0,0.4); background: rgba(255,107,0,0.06); box-shadow: var(--brand-glow-soft); }
.wallet-tile .wallet-icon { font-size: 1.8rem; }
.wallet-tile .wallet-name { font-weight: 700; font-size: 0.85rem; text-transform: capitalize; }
.wallet-tile .wallet-tag { font-size: 0.6rem; color: rgba(154,154,181,0.6); text-transform: uppercase; letter-spacing: 0.06em; }
/* ── Brand icon image (Agent JAE mascot) ── */
.brand-icon img {
    height: 36px;
    width: 36px;
    vertical-align: middle;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(255, 107, 0, 0.5));
    transition: filter 200ms ease, transform 200ms ease;
}
.brand-icon img:hover {
    filter: drop-shadow(0 0 18px rgba(255, 107, 0, 0.8));
    transform: scale(1.1);
}

/* ── Emergency header/auth visual fixes: real Agent JAE mascot + solid panels ── */
.agent-header {
    display: grid !important;
    grid-template-columns: minmax(220px, 1fr) minmax(300px, 520px) minmax(260px, 1fr) !important;
    align-items: center !important;
    gap: 16px !important;
}
.header-left { justify-content: flex-start !important; min-width: 0 !important; }
.header-center { justify-content: center !important; max-width: none !important; min-width: 0 !important; }
.header-right { justify-content: flex-end !important; min-width: 0 !important; gap: 10px !important; }
#agent-auth-host { display: inline-flex !important; align-items: center !important; gap: 8px !important; flex: 0 0 auto !important; }
.brand-mark { gap: 10px !important; white-space: nowrap !important; }
.brand-icon { display: inline-flex !important; align-items: center !important; justify-content: center !important; font-size: 0 !important; }
.brand-icon img {
    height: 38px !important;
    width: 38px !important;
    object-fit: contain !important;
    border-radius: 12px !important;
    filter: drop-shadow(0 0 14px rgba(255, 107, 0, 0.62)) !important;
}
.task-tracker,
.task-panel,
.agent-task-panel,
.tasks-panel {
    background: linear-gradient(180deg, rgba(12, 12, 20, 0.96), rgba(7, 7, 12, 0.98)) !important;
    color: var(--text-primary, #f5f7fb) !important;
    border-left: 1px solid rgba(255, 107, 0, 0.18) !important;
    box-shadow: -18px 0 44px rgba(0,0,0,0.35) !important;
}
.task-tracker *,
.task-panel *,
.agent-task-panel *,
.tasks-panel * {
    color-scheme: dark !important;
}
.agent-auth-btn,
.connect-wallet-btn,
.wallet-connect-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
@media (max-width: 980px) {
    .agent-header { grid-template-columns: auto 1fr auto !important; }
    .brand-text { display: none; }
    .header-center { justify-content: flex-start !important; }
}


/* ── FINAL FIX: Agent header/auth/mascot/task panel ── */
.agent-header {
    display: grid !important;
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 520px) minmax(300px, 1fr) !important;
    align-items: center !important;
    gap: 16px !important;
}
.header-left,
.header-right { min-width: 0 !important; }
.header-left { justify-content: flex-start !important; }
.header-center { justify-content: center !important; max-width: none !important; min-width: 0 !important; }
.header-right { justify-content: flex-end !important; gap: 10px !important; }
.agent-auth-host,
#agent-auth-host {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    min-width: fit-content !important;
}
.brand-icon { font-size: 0 !important; line-height: 0 !important; }
.brand-icon img {
    height: 40px !important;
    width: 40px !important;
    object-fit: contain !important;
    border-radius: 12px !important;
    filter: drop-shadow(0 0 14px rgba(255, 107, 0, 0.72)) !important;
}
.task-tracker,
.task-panel,
.agent-task-panel,
.tasks-panel {
    background: linear-gradient(180deg, rgba(12, 12, 20, 0.97), rgba(7, 7, 12, 0.99)) !important;
    color: #f5f7fb !important;
    border-left: 1px solid rgba(255, 107, 0, 0.20) !important;
    box-shadow: -18px 0 44px rgba(0,0,0,0.38) !important;
}
@media (max-width: 980px) {
    .agent-header { grid-template-columns: auto 1fr auto !important; }
    .brand-text { display: none !important; }
}



/* ── Welcome mascot image ── */
.welcome-icon.mascot {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: radial-gradient(circle at 50% 35%, rgba(255,107,0,.18), rgba(123,92,255,.08), transparent 72%) !important;
    border: 1px solid rgba(255,107,0,.18) !important;
    box-shadow: 0 0 34px rgba(255,107,0,.18) !important;
    border-radius: 24px !important;
    padding: 12px !important;
    animation: mascotPulse 4s ease-in-out infinite;
}
.welcome-icon.mascot img {
    width: 192px !important;
    height: 192px !important;
    object-fit: contain !important;
    filter: drop-shadow(0 0 24px rgba(255,107,0,.55)) !important;
    transition: filter 300ms ease, transform 300ms ease;
}
.welcome-icon.mascot img:hover {
    filter: drop-shadow(0 0 40px rgba(255,107,0,.8)) brightness(1.1) !important;
    transform: scale(1.05);
}
@keyframes mascotPulse {
    0%, 100% { box-shadow: 0 0 34px rgba(255,107,0,.18), 0 0 0 1px rgba(255,107,0,.18); }
    50% { box-shadow: 0 0 48px rgba(255,107,0,.3), 0 0 0 2px rgba(255,107,0,.3); }
}
}


/* ── v5.8.8: inline tool trace + embedded rich cards inside assistant bubble ── */
.assistant-final-text {
    white-space: pre-wrap;
}
.message-inline-cards {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 520px;
}
.message-inline-cards .rich-card-wrap {
    opacity: 1 !important;
    transform: none !important;
}
.message-inline-cards .rich-card {
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 6px 22px rgba(0,0,0,.38), 0 0 0 1px rgba(255,107,0,.05);
}
.message-inline-cards .rich-card:hover {
    transform: none;
}
.message-inline-cards .price-card .rc-price {
    font-size: 1.75rem;
}
.message-inline-cards .rc-spark {
    max-height: 54px;
    overflow: hidden;
}
.tool-trace {
    margin-top: 9px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-family: var(--font-mono, monospace);
    font-size: 0.62rem;
    line-height: 1.2;
    color: rgba(154, 154, 181, 0.72);
    opacity: 0.75;
}
.tool-trace-label {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .56rem;
    color: rgba(154,154,181,.55);
    margin-right: 2px;
}
.tool-mini {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 3px 7px 2px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,.07);
    background: rgba(255,255,255,.03);
    color: rgba(232,232,240,.62);
    line-height: 1.3;
}
.tool-mini-dot {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: rgba(154,154,181,.7);
}
.tool-mini.ok .tool-mini-dot { background: #00ff88; box-shadow: 0 0 7px rgba(0,255,136,.55); }
.tool-mini.err .tool-mini-dot { background: #ff5577; box-shadow: 0 0 7px rgba(255,85,119,.55); }
.tool-mini.pending .tool-mini-dot { background: #ffaa33; box-shadow: 0 0 7px rgba(255,170,51,.45); }
.tool-mini-count {
    opacity: .7;
    font-size: .56rem;
}
.message-avatar-img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255,107,0,.55));
}

/* ─── Tool trace: small rectangles with tiny descriptions ─── */
.tool-mini {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 3px 7px 2px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,.07);
    background: rgba(255,255,255,.03);
    color: rgba(232,232,240,.62);
    line-height: 1.3;
}
.tool-mini-dot {
    display: none;
}
.tool-mini-label {
    font-weight: 500;
    font-size: 11px;
    line-height: 1.4;
}
.tool-mini-desc {
    display: block;
    font-size: 9px;
    color: rgba(255,255,255,.3);
    line-height: 1.15;
    margin-top: 0px;
    font-weight: 400;
}
.tool-mini.ok {
    border-color: rgba(0,255,136,.15);
    background: rgba(0,255,136,.04);
}
.tool-mini.ok .tool-mini-label {
    color: rgba(0,255,136,.85);
}
.tool-mini.err {
    border-color: rgba(255,85,119,.15);
    background: rgba(255,85,119,.04);
}
.tool-mini.err .tool-mini-label {
    color: rgba(255,85,119,.85);
}
.tool-mini.pending {
    border-color: rgba(255,170,51,.15);
    background: rgba(255,170,51,.04);
}
.tool-mini.pending .tool-mini-label {
    color: rgba(255,170,51,.85);
}
.tool-mini-count {
    opacity: .6;
    font-size: .55rem;
    margin-left: 4px;
}
.tool-trace {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.tool-trace-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: .35;
    margin-right: 4px;
    align-self: center;
}


/* ─── Mascot Hover Crossfade Animation ─── */
.mascot-hover {
    position: relative;
    width: 192px;
    height: 192px;
    margin: 0 auto;
}

.mascot-hover img {
    position: absolute;
    top: 0; left: 0;
    width: 192px;
    height: 192px;
    border-radius: 24px;
    object-fit: contain;
    transition: opacity 0.4s ease, filter 0.4s ease, transform 0.4s ease;
    filter: drop-shadow(0 0 18px rgba(255, 107, 0, 0.5));
}

.mascot-hover img:hover {
    transform: scale(1.04);
}

/* Stack all variant images; only the first is visible by default */
.mascot-hover img:nth-child(1) { opacity: 1; z-index: 6; }
.mascot-hover img:nth-child(2) { opacity: 0; z-index: 5; }
.mascot-hover img:nth-child(3) { opacity: 0; z-index: 4; }
.mascot-hover img:nth-child(4) { opacity: 0; z-index: 3; }
.mascot-hover img:nth-child(5) { opacity: 0; z-index: 2; }
.mascot-hover img:nth-child(6) { opacity: 0; z-index: 1; }

/* On hover: cycle through variants with staggered delays */
.mascot-hover:hover img:nth-child(1) { opacity: 0; transition-delay: 0s; }
.mascot-hover:hover img:nth-child(2) { opacity: 1; transition-delay: 0s; }
.mascot-hover:hover img:nth-child(3) { opacity: 1; transition-delay: 0.5s; }
.mascot-hover:hover img:nth-child(4) { opacity: 1; transition-delay: 1s; }
.mascot-hover:hover img:nth-child(5) { opacity: 1; transition-delay: 1.5s; }
.mascot-hover:hover img:nth-child(6) { opacity: 1; transition-delay: 2s; }

/* Auto-cycle animation when NOT hovering */
@keyframes mascotCycle {
    0%  , 16%   { --mascot-index: 0; }
    16.6%, 33%  { --mascot-index: 1; }
    33.3%, 50%  { --mascot-index: 2; }
    50.3%, 66.6% { --mascot-index: 3; }
    66.9%, 83.3% { --mascot-index: 4; }
    83.6%, 100%  { --mascot-index: 5; }
}

/* JavaScript-driven cycling (fallback for browsers without Houdini) */
.mascot-hover.cycle-1 img:nth-child(1) { opacity: 0; }
.mascot-hover.cycle-1 img:nth-child(2) { opacity: 1; }
.mascot-hover.cycle-2 img:nth-child(1) { opacity: 0; }
.mascot-hover.cycle-2 img:nth-child(2) { opacity: 0; }
.mascot-hover.cycle-2 img:nth-child(3) { opacity: 1; }
.mascot-hover.cycle-3 img:nth-child(1) { opacity: 0; }
.mascot-hover.cycle-3 img:nth-child(2) { opacity: 0; }
.mascot-hover.cycle-3 img:nth-child(3) { opacity: 0; }
.mascot-hover.cycle-3 img:nth-child(4) { opacity: 1; }
.mascot-hover.cycle-4 img:nth-child(1) { opacity: 0; }
.mascot-hover.cycle-4 img:nth-child(2) { opacity: 0; }
.mascot-hover.cycle-4 img:nth-child(3) { opacity: 0; }
.mascot-hover.cycle-4 img:nth-child(4) { opacity: 0; }
.mascot-hover.cycle-4 img:nth-child(5) { opacity: 1; }
.mascot-hover.cycle-5 img:nth-child(1) { opacity: 0; }
.mascot-hover.cycle-5 img:nth-child(2) { opacity: 0; }
.mascot-hover.cycle-5 img:nth-child(3) { opacity: 0; }
.mascot-hover.cycle-5 img:nth-child(4) { opacity: 0; }
.mascot-hover.cycle-5 img:nth-child(5) { opacity: 0; }
.mascot-hover.cycle-5 img:nth-child(6) { opacity: 1; }

/* Auth button/connect styling fix */
.auth-connect--primary {
    background: linear-gradient(135deg, var(--brand-orange, #ff6b00), var(--brand-purple, #8b5cf6));
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 12px rgba(255, 107, 0, 0.3);
}
.auth-connect--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(255, 107, 0, 0.5);
}

.auth-connect--ghost {
    background: transparent;
    color: var(--text-secondary, #aaa);
    border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.auth-connect--ghost:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary, #eee);
}

/* User chip */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--glass-bg, rgba(15,15,23,0.85));
    border: 1px solid var(--chip-colour, #666);
    font-size: 13px;
    color: var(--text-primary, #eee);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    position: relative;
}
.user-chip--glow {
    box-shadow: 0 0 16px var(--chip-colour), 0 0 40px color-mix(in srgb, var(--chip-colour) 30%, transparent);
    animation: chipPulse 2.5s ease-in-out infinite;
}
@keyframes chipPulse {
    0%, 100% { box-shadow: 0 0 8px var(--chip-colour); }
    50% { box-shadow: 0 0 24px var(--chip-colour), 0 0 48px color-mix(in srgb, var(--chip-colour) 25%, transparent); }
}
.user-chip__tier { font-weight: 700; }
.user-chip__addr { opacity: 0.7; font-family: var(--font-mono, monospace); font-size: 12px; }
.user-chip__arrow { opacity: 0.5; font-size: 10px; }

/* User chip dropdown */
.user-chip__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: var(--glass-bg, rgba(15,15,23,0.95));
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
    border-radius: 12px;
    padding: 8px;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.user-chip__dropdown--open { display: block; }
.user-chip__info {
    padding: 8px 12px;
    font-size: 12px;
    font-family: var(--font-mono, monospace);
    color: var(--text-secondary, #aaa);
    border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.08));
    margin-bottom: 4px;
}
.user-chip__btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-primary, #eee);
    font-size: 13px;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.user-chip__btn:hover { background: rgba(255,255,255,0.06); }
.user-chip__btn--danger { color: #ff4d4d; }
.user-chip__btn--danger:hover { background: rgba(255,77,77,0.1); }

/* Email modal */
.auth-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.auth-modal {
    background: var(--glass-bg, rgba(20,20,30,0.95));
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
    border-radius: 16px;
    padding: 28px;
    max-width: 360px;
    width: 90%;
}
.auth-modal h3 { margin: 0 0 16px; color: var(--text-primary, #eee); font-size: 18px; }
.auth-input {
    display: block; width: 100%; padding: 10px 12px;
    background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
    border-radius: 8px; color: var(--text-primary, #eee);
    font-size: 14px; margin-bottom: 10px;
}
.auth-input:focus { outline: none; border-color: var(--brand-orange, #ff6b00); }
.auth-error { color: #ff4d4d; font-size: 12px; margin-bottom: 10px; min-height: 16px; }

/* Agent auth host positioning */
.agent-auth-host {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Wallet connect button */
.wallet-connect-btn {
    background: linear-gradient(135deg, #ff6b00, #ff006e);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-mono);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.wallet-connect-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.4);
}

.wallet-connect-btn:active {
    transform: translateY(0);
}

/* User chip */
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-chip:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-chip .tier-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background: linear-gradient(135deg, #ff6b00, #ff006e);
    color: white;
}

.user-chip .wallet-address {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

/* Auth chip */
.auth-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.auth-chip:hover {
    background: rgba(255,255,255,0.1);
}
.auth-chip .tier-admin { color: #bf5fff; font-weight: 700; }
.auth-chip .tier-elite { color: #ffd700; font-weight: 700; }
.auth-chip .tier-operator { color: #ff9500; font-weight: 700; }
.auth-chip code {
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* ── WALLET BUTTON FIX (override truncation) ── */
#agent-auth-host {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 140px;
}

#agent-auth-host .wallet-connect-btn,
.wallet-connect-btn {
    background: linear-gradient(135deg, #ff6b00, #ff006e) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    font-family: var(--font-mono) !important;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3) !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    width: auto !important;
    min-width: 130px !important;
    height: auto !important;
    line-height: 1.2 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#agent-auth-host .wallet-connect-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.4) !important;
}

#agent-auth-host .wallet-connect-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.brand-mascot {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255, 107, 0, 0.5));
}

/* ── Agent Wallet Connect Dropdown (matches homepage nav-wallet) ── */
.agent-wallet-wrap {
    position: relative;
    display: inline-block;
}
.agent-wallet-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #0f0f17;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px;
    min-width: 240px;
    z-index: 1000;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 24px rgba(255,107,0,0.15);
    backdrop-filter: blur(20px);
}
.agent-wallet-dropdown.hidden {
    display: none;
}
.awd-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    padding: 6px 8px;
    font-family: var(--font-mono);
    font-weight: 600;
}
.awd-label-dim {
    opacity: 0.6;
}
.awd-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 6px 0;
}
.awd-empty {
    padding: 12px 8px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-mono);
}
.awd-empty-hint {
    font-size: 10px;
    opacity: 0.7;
}
.awd-wallet {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 8px 10px;
    color: white;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 12px;
    transition: all 0.15s;
}
.awd-wallet:hover {
    background: rgba(255,107,0,0.08);
    border-color: rgba(255,107,0,0.3);
}
.awd-wallet-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.awd-wallet-icon img {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    object-fit: contain;
}
.awd-wallet-name {
    flex: 1;
    text-align: left;
    font-weight: 500;
}
.awd-wallet-tag {
    font-size: 9px;
    color: #4ade80;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 6px;
    background: rgba(74,222,128,0.1);
    border-radius: 3px;
}
.awd-wallet-install .awd-wallet-tag {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.05);
}
.awd-error {
    color: #f87171 !important;
    background: rgba(248,113,113,0.1) !important;
}

/* ── Markdown styling inside assistant messages ── */
.assistant-final-text p { margin: 0 0 8px; line-height: 1.55; }
.assistant-final-text p:last-child { margin-bottom: 0; }
.assistant-final-text strong, .assistant-final-text b { color: #ffd394; font-weight: 700; }
.assistant-final-text em, .assistant-final-text i { color: #c4a8ff; font-style: italic; }
.assistant-final-text code {
    background: rgba(255,107,0,0.12);
    color: #ffaf66;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.92em;
    border: 1px solid rgba(255,107,0,0.2);
}
.assistant-final-text pre {
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 10px 0;
    font-size: 12px;
    line-height: 1.5;
}
.assistant-final-text pre code { background: none; border: none; padding: 0; color: #e6e6e6; }
.assistant-final-text ul, .assistant-final-text ol { margin: 6px 0 10px; padding-left: 22px; }
.assistant-final-text li { margin: 3px 0; line-height: 1.5; }
.assistant-final-text a {
    color: #ff9c4a;
    text-decoration: underline;
    text-decoration-color: rgba(255,156,74,0.4);
    text-underline-offset: 2px;
}
.assistant-final-text a:hover { color: #ffb87a; text-decoration-color: #ffb87a; }
.assistant-final-text h1, .assistant-final-text h2, .assistant-final-text h3,
.assistant-final-text h4, .assistant-final-text h5, .assistant-final-text h6 {
    color: #fff;
    font-family: var(--font-mono);
    margin: 14px 0 8px;
    line-height: 1.3;
}
.assistant-final-text h1 { font-size: 18px; }
.assistant-final-text h2 { font-size: 16px; }
.assistant-final-text h3 { font-size: 14px; }
.assistant-final-text h4, .assistant-final-text h5, .assistant-final-text h6 { font-size: 13px; }
.assistant-final-text blockquote {
    margin: 8px 0;
    padding: 6px 12px;
    border-left: 3px solid rgba(255,107,0,0.5);
    background: rgba(255,107,0,0.04);
    color: var(--text-secondary);
    font-style: italic;
}
.assistant-final-text hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 14px 0;
}
.assistant-final-text table {
    border-collapse: collapse;
    margin: 10px 0;
    width: 100%;
    font-size: 12px;
}
.assistant-final-text th, .assistant-final-text td {
    border: 1px solid rgba(255,255,255,0.1);
    padding: 6px 10px;
    text-align: left;
}
.assistant-final-text th {
    background: rgba(255,107,0,0.08);
    color: #ffd394;
    font-weight: 700;
}

/* ─── Sprint 3d: Payment Modal ─── */
.pay-modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  animation: fade-in 200ms ease;
}
.pay-modal {
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(28,18,40,0.98), rgba(15,10,25,0.98));
  border: 1px solid rgba(255,107,0,0.3);
  border-radius: 18px;
  box-shadow: 0 0 60px rgba(255,107,0,0.25), 0 25px 60px rgba(0,0,0,0.6);
  padding: var(--space-6);
  animation: slide-up 280ms cubic-bezier(0.4,0,0.2,1);
}
@keyframes slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.pay-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-4); }
.pay-title h2 { font-family: var(--font-mono); font-size: 1.4rem; margin: var(--space-2) 0 0 0; color: var(--text-primary); }
.pay-tier-badge { display: inline-block; padding: 3px 10px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; }
.pay-tier-badge.tier-operator { background: rgba(255,107,0,0.15); color: #ff8c2a; border: 1px solid rgba(255,107,0,0.4); }
.pay-tier-badge.tier-elite    { background: rgba(255,215,0,0.12); color: #ffd700; border: 1px solid rgba(255,215,0,0.45); }
.pay-tier-badge.tier-pro      { background: linear-gradient(135deg, rgba(155,80,255,0.2), rgba(255,80,180,0.2)); color: #d99fff; border: 1px solid rgba(180,90,255,0.5); }

.pay-close { background: transparent; border: 1px solid rgba(255,255,255,0.1); color: var(--text-secondary); width: 32px; height: 32px; border-radius: 8px; font-size: 22px; cursor: pointer; transition: all 150ms; }
.pay-close:hover { background: rgba(255,80,80,0.15); color: #ff8a8a; border-color: rgba(255,80,80,0.4); }

.pay-perks { list-style: none; padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4) 0; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; }
.pay-perks li { font-size: 13px; color: var(--text-secondary); padding: 3px 0; }
.pay-perks li:before { content: ''; }

.pay-step { margin-bottom: var(--space-4); }
.pay-step-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-tertiary); margin-bottom: var(--space-2); font-family: var(--font-mono); }

.pay-chain-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.pay-chain-tab { padding: var(--space-3); background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); color: var(--text-secondary); border-radius: 10px; cursor: pointer; transition: all 180ms; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.pay-chain-tab:hover { background: rgba(255,107,0,0.06); border-color: rgba(255,107,0,0.3); color: var(--text-primary); }
.pay-chain-tab.active { background: linear-gradient(135deg, rgba(255,107,0,0.2), rgba(180,90,255,0.15)); border-color: rgba(255,107,0,0.6); color: var(--text-primary); box-shadow: 0 0 18px rgba(255,107,0,0.25); }
.pay-chain-icon { font-size: 18px; }

.pay-token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: var(--space-2); }
.pay-token-btn { padding: var(--space-3) var(--space-2); background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; cursor: pointer; transition: all 180ms; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-secondary); }
.pay-token-btn:hover { background: rgba(255,107,0,0.06); border-color: rgba(255,107,0,0.3); transform: translateY(-1px); }
.pay-token-btn.active { background: linear-gradient(135deg, rgba(255,107,0,0.18), rgba(180,90,255,0.12)); border-color: rgba(255,107,0,0.6); color: var(--text-primary); box-shadow: 0 0 14px rgba(255,107,0,0.3); }
.pay-token-icon { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,107,0,0.15); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #ff8c2a; }
.pay-token-btn.active .pay-token-icon { background: rgba(255,215,0,0.18); color: #ffd700; }
.pay-token-name { font-size: 12px; font-weight: 600; font-family: var(--font-mono); }

.pay-quote-box { padding: var(--space-4); background: rgba(0,0,0,0.3); border: 1px solid rgba(255,107,0,0.15); border-radius: 12px; }
.pay-amount-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.pay-amount-num { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: #ff8c2a; text-shadow: 0 0 14px rgba(255,107,0,0.5); }
.pay-amount-sym { font-size: 14px; color: var(--text-secondary); font-weight: 600; }
.pay-amount-usd { font-size: 13px; color: var(--text-tertiary); margin-bottom: var(--space-3); }
.pay-quote-meta { font-size: 11px; color: var(--text-tertiary); margin-bottom: var(--space-2); font-family: var(--font-mono); }
.pay-treasury { font-size: 11px; color: var(--text-tertiary); padding-top: var(--space-2); border-top: 1px dashed rgba(255,255,255,0.06); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pay-treasury-label { color: var(--text-secondary); }
.pay-treasury code { background: rgba(255,107,0,0.08); padding: 2px 6px; border-radius: 4px; font-size: 10px; color: #ff8c2a; word-break: break-all; }

.pay-actions { display: flex; gap: var(--space-2); justify-content: flex-end; margin-top: var(--space-3); }
.pay-btn-secondary { padding: 10px 20px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); color: var(--text-secondary); border-radius: 8px; font-size: 13px; cursor: pointer; transition: all 150ms; }
.pay-btn-secondary:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.pay-btn-primary { padding: 10px 24px; background: linear-gradient(135deg, #ff6b00, #b45aff); border: none; color: #fff; font-weight: 700; border-radius: 8px; font-size: 14px; cursor: pointer; box-shadow: 0 0 22px rgba(255,107,0,0.4); transition: all 180ms; }
.pay-btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 32px rgba(255,107,0,0.6); }
.pay-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.pay-status { margin-top: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: 8px; font-size: 12px; font-family: var(--font-mono); white-space: pre-line; min-height: 0; }
.pay-status:empty { padding: 0; }
.pay-status-info    { background: rgba(80,160,255,0.1); border: 1px solid rgba(80,160,255,0.3); color: #80b8ff; }
.pay-status-success { background: rgba(80,255,140,0.12); border: 1px solid rgba(80,255,140,0.4); color: #80ffaa; }
.pay-status-error   { background: rgba(255,80,80,0.12); border: 1px solid rgba(255,80,80,0.4); color: #ff9090; }

/* ─── Typing bubble (inline in chat) ─── */
.message.typing-bubble .typing-content {
  display: flex; gap: 4px; align-items: center;
  padding: 12px 16px;
  background: rgba(255,107,0,0.08);
  border: 1px solid rgba(255,107,0,0.2);
  border-radius: 14px;
  width: fit-content;
}
.message.typing-bubble .typing-status {
  font-size: 10px; color: var(--text-tertiary); font-style: italic;
  margin-left: 4px;
}
.message.typing-bubble .typing-dot {
  width: 6px; height: 6px;
  background: #ff8c2a;
  border-radius: 50%;
  animation: typing-bounce 1.3s ease-in-out infinite;
}
.message.typing-bubble .typing-dot:nth-child(2) { animation-delay: 0.18s; }
.message.typing-bubble .typing-dot:nth-child(3) { animation-delay: 0.36s; }


/* User chip menu (post-connect dropdown) */
.auth-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; cursor: pointer; color: var(--text-primary); font-size: 12px; font-family: var(--font-mono); transition: all 150ms; }
.auth-chip:hover { background: rgba(255,107,0,0.1); border-color: rgba(255,107,0,0.4); }
.auth-chip code { font-size: 11px; color: var(--text-secondary); }
.auth-chip .chip-caret { font-size: 10px; color: var(--text-tertiary); }
.auth-chip .tier-anonymous { color: #888; font-weight: 700; font-size: 10px; }
.auth-chip .tier-operator { color: #ff8c2a; font-weight: 700; font-size: 10px; }
.auth-chip .tier-elite { color: #ffd700; font-weight: 700; font-size: 10px; text-shadow: 0 0 6px rgba(255,215,0,0.5); }
.auth-chip .tier-pro { color: #d99fff; font-weight: 700; font-size: 10px; text-shadow: 0 0 6px rgba(180,90,255,0.5); }
.auth-chip .tier-admin { background: linear-gradient(135deg, #b45aff, #ff5ab4); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-weight: 700; font-size: 10px; }
.user-menu.agent-wallet-dropdown { right: 0; min-width: 200px; }
.awd-menu-item { display: block; width: 100%; padding: 10px 14px; background: transparent; border: none; color: var(--text-primary); text-align: left; cursor: pointer; font-size: 13px; transition: background 120ms; }
.awd-menu-item:hover { background: rgba(255,107,0,0.1); }
.awd-menu-item.awd-menu-pay { color: #ffd700; }
.awd-menu-item.awd-menu-logout { color: #ff9090; border-top: 1px solid rgba(255,255,255,0.06); }


/* ============================================================
   USER CHIP MENU — Network switcher, wallet info, balance
   ============================================================ */

.awd-section-head {
  font-family: var(--font-mono, monospace);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 107, 0, 0.7);
  padding: 10px 12px 4px;
  font-weight: 700;
}

.awd-wallet-info {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 107, 0, 0.15);
  border-radius: 8px;
  margin: 0 8px 10px;
  padding: 8px 10px;
}

.awd-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
}
.awd-info-row + .awd-info-row { border-top: 1px solid rgba(255,255,255,0.05); }
.awd-info-k {
  color: rgba(154, 154, 181, 0.85);
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.awd-info-v {
  color: var(--text-primary, #fff);
  font-family: var(--font-mono, monospace);
  font-weight: 600;
}
.awd-info-v code {
  background: transparent;
  color: #ffd166;
  font-size: 11px;
}
.awd-info-v.tier-elite { color: #ffd700; }
.awd-info-v.tier-admin { color: #c084fc; }
.awd-info-v.tier-operator { color: #ff8a3d; }
.awd-info-v.tier-anonymous { color: #9a9ab5; }

.awd-net-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 8px 10px;
}
.awd-net-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(220, 220, 235, 0.8);
  padding: 8px 10px;
  border-radius: 8px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.awd-net-btn:hover {
  border-color: rgba(255, 107, 0, 0.4);
  background: rgba(255, 107, 0, 0.08);
}
.awd-net-btn.active {
  background: linear-gradient(135deg, rgba(255,107,0,0.25), rgba(168,85,247,0.2));
  border-color: rgba(255, 107, 0, 0.6);
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 107, 0, 0.25);
}

/* ============================================================
   TASK TRACKER REDESIGN — Categories + colourful gradient bars
   ============================================================ */

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
}

.task-category {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
}

.task-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: linear-gradient(90deg, rgba(255, 107, 0, 0.08), transparent 60%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  user-select: none;
}
.task-cat-header:hover { background: linear-gradient(90deg, rgba(255, 107, 0, 0.14), transparent 60%); }
.task-cat-title {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #ff8a3d;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.task-cat-icon { font-size: 14px; filter: drop-shadow(0 0 6px rgba(255,107,0,0.4)); }
.task-cat-count {
  font-size: 9px;
  background: rgba(255, 107, 0, 0.18);
  border: 1px solid rgba(255, 107, 0, 0.3);
  color: #ffb87a;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--font-mono, monospace);
}
.task-cat-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.task-category.collapsed .task-cat-body { display: none; }

.task-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.15s ease;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: rgba(255, 255, 255, 0.02); }

.task-item .task-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: rgba(255, 107, 0, 0.08);
  border: 1px solid rgba(255, 107, 0, 0.2);
}

.task-item .task-info { min-width: 0; }

.task-item .task-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-item .task-meta-line {
  font-size: 10px;
  color: rgba(154, 154, 181, 0.7);
  font-family: var(--font-mono, monospace);
  margin-top: 2px;
}

.task-progress {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
}
.task-progress-bar {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, var(--bar-from, #ff6b00), var(--bar-to, #ffd166));
  box-shadow: 0 0 8px var(--bar-glow, rgba(255, 107, 0, 0.4));
}

/* category-specific gradient bars */
.task-cat-system .task-progress-bar      { --bar-from:#0ea5e9; --bar-to:#06b6d4; --bar-glow:rgba(14,165,233,0.45); }
.task-cat-reasoning .task-progress-bar   { --bar-from:#a855f7; --bar-to:#ec4899; --bar-glow:rgba(168,85,247,0.45); }
.task-cat-tools .task-progress-bar       { --bar-from:#10b981; --bar-to:#34d399; --bar-glow:rgba(16,185,129,0.45); }
.task-cat-generation .task-progress-bar  { --bar-from:#ff6b00; --bar-to:#ffd166; --bar-glow:rgba(255,107,0,0.5); }
.task-cat-monitor .task-progress-bar     { --bar-from:#f59e0b; --bar-to:#facc15; --bar-glow:rgba(245,158,11,0.45); }

/* live shimmer for in-progress bars */
.task-progress-bar.live::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: task-shimmer 1.4s infinite linear;
}
@keyframes task-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* status pill on the right */
.task-status-pill {
  font-size: 9px;
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  margin-left: 6px;
}
.task-status-pill.running   { background: rgba(14,165,233,0.15); color:#7dd3fc; border:1px solid rgba(14,165,233,0.3); }
.task-status-pill.complete  { background: rgba(16,185,129,0.15); color:#6ee7b7; border:1px solid rgba(16,185,129,0.3); }
.task-status-pill.failed    { background: rgba(239,68,68,0.15); color:#fca5a5; border:1px solid rgba(239,68,68,0.3); }
.task-status-pill.waiting   { background: rgba(168,85,247,0.15); color:#d8b4fe; border:1px solid rgba(168,85,247,0.3); }
.task-status-pill.live      { background: rgba(255,107,0,0.15); color:#ffb87a; border:1px solid rgba(255,107,0,0.3); animation: pulse-live 1.4s infinite; }
@keyframes pulse-live {
  0%,100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.task-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}


/* ============================================================
   FIX: constrain chat message avatar image so it never bursts
   ============================================================ */
.message-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    overflow: hidden;
    border-radius: 50%;
    flex-shrink: 0;
}
.message-avatar img,
.message-avatar .message-avatar-img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
    display: block;
}
.message {
    align-items: flex-start;
}


/* ============================================================
   PAYMENT MODAL — Tier picker tiles
   ============================================================ */
.pay-tier-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 6px;
}
.pay-tier-tile {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 8px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-family: var(--font-mono, monospace);
    color: var(--text-primary, #fff);
}
.pay-tier-tile:hover {
    background: rgba(255, 107, 0, 0.06);
    border-color: rgba(255, 107, 0, 0.3);
    transform: translateY(-2px);
}
.pay-tier-tile.active {
    background: linear-gradient(135deg, rgba(255,107,0,0.18), rgba(168,85,247,0.14));
    border-color: rgba(255, 107, 0, 0.6);
    box-shadow: 0 0 18px rgba(255, 107, 0, 0.3);
}
.pay-tier-tile .ptt-name {
    font-size: 10px;
    letter-spacing: 1.5px;
    color: #ff8a3d;
    font-weight: 700;
    margin-bottom: 6px;
}
.pay-tier-tile .ptt-price {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    margin-bottom: 6px;
}
.pay-tier-tile .ptt-perk {
    font-size: 10px;
    color: rgba(220, 220, 235, 0.65);
}
.pay-tier-tile.tier-operator.active { border-color: rgba(255, 138, 61, 0.7); }
.pay-tier-tile.tier-elite.active    { border-color: rgba(255, 215, 0, 0.7); box-shadow: 0 0 18px rgba(255, 215, 0, 0.25); }
.pay-tier-tile.tier-pro.active      { border-color: rgba(168, 85, 247, 0.7); box-shadow: 0 0 18px rgba(168, 85, 247, 0.3); }

/* ============================================================
   TASK INFO TOOLTIP — "i" button per task with popup
   ============================================================ */
.task-info-btn {
    margin-left: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 107, 0, 0.15);
    border: 1px solid rgba(255, 107, 0, 0.4);
    color: #ff8a3d;
    font-family: var(--font-mono, monospace);
    font-size: 9px;
    font-weight: 700;
    font-style: italic;
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    vertical-align: middle;
    transition: all 0.18s ease;
}
.task-info-btn:hover {
    background: rgba(255, 107, 0, 0.35);
    border-color: rgba(255, 107, 0, 0.7);
    color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(255, 107, 0, 0.45);
}

#task-info-popup {
    position: fixed;
    z-index: 10000;
    max-width: 280px;
    padding: 10px 12px;
    background: rgba(20, 20, 32, 0.96);
    border: 1px solid rgba(255, 107, 0, 0.45);
    border-radius: 10px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 18px rgba(255, 107, 0, 0.25);
    color: var(--text-primary, #fff);
    font-size: 11px;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
#task-info-popup.visible { opacity: 1; }
#task-info-popup .tip-title {
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    letter-spacing: 1px;
    color: #ff8a3d;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 6px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 107, 0, 0.2);
}
#task-info-popup .tip-body {
    color: rgba(220, 220, 235, 0.9);
}

/* ============================================================
   COMPACT TASK TRACKER - tighter rows, smaller text
   ============================================================ */
.task-list { gap: 6px !important; padding: 8px !important; }
.task-category { border-radius: 8px !important; }
.task-cat-header { padding: 6px 10px !important; }
.task-cat-title { font-size: 9px !important; letter-spacing: 1.2px !important; }
.task-cat-icon { font-size: 12px !important; }
.task-cat-count { font-size: 8px !important; padding: 1px 6px !important; }

.task-item {
    grid-template-columns: 22px 1fr !important;
    gap: 7px !important;
    padding: 5px 9px !important;
}
.task-item .task-icon {
    width: 22px !important;
    height: 22px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
}
.task-item .task-name { font-size: 10.5px !important; line-height: 1.2 !important; }
.task-item .task-meta-line { font-size: 8.5px !important; margin-top: 1px !important; }
.task-progress { height: 3px !important; margin-top: 4px !important; }
.task-status-pill { font-size: 7.5px !important; padding: 1px 5px !important; letter-spacing: 0.4px !important; }
.task-info-btn { width: 11px !important; height: 11px !important; font-size: 7.5px !important; margin-left: 4px !important; }

/* ─── Edge Peek Tabs (reopen collapsed panels) ─── */
.edge-peek {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 80px;
  background: linear-gradient(135deg, rgba(0,255,200,0.15), rgba(176,68,255,0.15));
  border: 1px solid rgba(0,255,200,0.4);
  color: var(--accent-cyan, #00ffc8);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
  box-shadow: 0 0 20px rgba(0,255,200,0.3);
  border-radius: 0 6px 6px 0;
}
.edge-peek.right { right: 0; border-radius: 6px 0 0 6px; border-left: 1px solid rgba(176,68,255,0.4); border-right: none; }
.edge-peek.left { left: 0; }
.edge-peek:hover {
  width: 28px;
  background: linear-gradient(135deg, rgba(0,255,200,0.3), rgba(176,68,255,0.3));
  box-shadow: 0 0 30px rgba(0,255,200,0.5);
}
.edge-peek svg { width: 14px; height: 14px; }
.sidebar.collapsed ~ .edge-peek.left,
body:has(.sidebar.collapsed) .edge-peek.left { display: flex; }
body:has(.task-tracker.collapsed) .edge-peek.right { display: flex; }
.edge-peek::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0,255,200,0.2), transparent);
  animation: peek-shimmer 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes peek-shimmer {
  0%, 100% { opacity: 0; transform: translateY(-100%); }
  50% { opacity: 1; transform: translateY(100%); }
}

/* ─── Chat History Section ─── */
.chat-history-section {
  border-top: 1px solid var(--border-subtle);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 40vh;
  overflow: hidden;
}
.chat-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  cursor: pointer;
  user-select: none;
}
.chat-history-header h4 {
  font-family: var(--font-mono, monospace);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0;
}
.chat-history-header .chevron {
  width: 10px; height: 10px;
  transition: transform 0.2s ease;
  color: var(--text-muted);
}
.chat-history-section.collapsed .chevron { transform: rotate(-90deg); }
.chat-history-section.collapsed .chat-history-list,
.chat-history-section.collapsed .chat-history-actions { display: none; }
.chat-history-actions {
  display: flex;
  gap: 4px;
  padding: 0 4px;
}
.chat-new-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(0,255,200,0.12), rgba(0,255,200,0.04));
  border: 1px solid rgba(0,255,200,0.3);
  color: var(--accent-cyan, #00ffc8);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s ease;
}
.chat-new-btn:hover {
  background: linear-gradient(135deg, rgba(0,255,200,0.25), rgba(0,255,200,0.08));
  box-shadow: 0 0 12px rgba(0,255,200,0.3);
}
.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  max-height: calc(40vh - 60px);
  padding: 2px 0;
}
.chat-history-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}
.chat-history-item:hover { background: rgba(255,255,255,0.04); }
.chat-history-item.active {
  background: rgba(0,255,200,0.08);
  border-left: 2px solid var(--accent-cyan, #00ffc8);
}
.chat-history-item.pinned .pin-icon { color: #ffb84d; }
.chat-history-item .chat-title {
  flex: 1;
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-sans);
}
.chat-history-item:hover .chat-title { color: var(--text-primary); }
.chat-history-item .chat-actions {
  display: none;
  gap: 2px;
}
.chat-history-item:hover .chat-actions { display: flex; }
.chat-history-item .chat-act {
  width: 16px; height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chat-history-item .chat-act:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.chat-history-item .chat-act.delete:hover { background: rgba(255,80,80,0.2); color: #ff5050; }
.chat-history-item .pin-icon {
  font-size: 9px;
  color: var(--text-muted);
  margin-right: 2px;
}
.chat-history-empty {
  padding: 12px 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 9.5px;
  font-style: italic;
}
.sidebar.collapsed .chat-history-section { display: none; }

/* ─── Streaming UI ─── */
.streaming-cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: linear-gradient(180deg, var(--accent-cyan, #00ffc8), var(--accent-orange, #ffb84d));
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink-cursor 0.8s steps(2) infinite;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0,255,200,0.6);
}
@keyframes blink-cursor {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.message.streaming .message-avatar {
  animation: avatar-pulse 1.4s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(255,184,77,0.7));
}
@keyframes avatar-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(255,184,77,0.4)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 18px rgba(255,184,77,0.9)); }
}
.message.streaming .message-content {
  position: relative;
}
.stream-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono, monospace);
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 6px;
  opacity: 0.7;
}
.stream-meta .stream-pill {
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0,255,200,0.08);
  border: 1px solid rgba(0,255,200,0.2);
  color: var(--accent-cyan);
}
.stream-meta .stream-pill.tps { background: rgba(255,184,77,0.08); border-color: rgba(255,184,77,0.2); color: var(--accent-orange); }
.stream-stop-btn {
  background: linear-gradient(135deg, #ff3030, #aa0000);
  color: #fff;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 11px;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 14px rgba(255,48,48,0.5);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.stream-stop-btn:hover { transform: scale(1.04); box-shadow: 0 0 20px rgba(255,48,48,0.8); }
.stream-stop-btn::before { content: '◼'; font-size: 10px; }

/* Smooth scroll for chat */
.message-list { scroll-behavior: smooth; }

/* === Wider model dropdown so all filter pills fit on one line (apr 30 2026) === */
.model-dropdown {
  left: auto !important;
  right: 0 !important;
  min-width: 560px !important;
  width: max-content !important;
  max-width: 90vw !important;
}
.model-dropdown .model-filters {
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scrollbar-width: thin;
}
.model-dropdown .model-filters::-webkit-scrollbar { height: 4px; }
.model-dropdown .model-filter {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  padding: 4px 10px !important;
}
@media (max-width: 640px) {
  .model-dropdown { min-width: 100% !important; left: 0 !important; right: 0 !important; }
  .model-dropdown .model-filters { flex-wrap: wrap !important; overflow-x: visible !important; }
}

/* === Sidebar header bar (collapse arrow at top), chats right below (apr 30 2026) === */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 38px;
}
.sidebar-header .sidebar-toggle {
  position: static !important;
  transform: none !important;
  padding: 6px;
  background: rgba(255,255,255,0.04);
}
.sidebar-header .sidebar-toggle:hover {
  background: rgba(255,107,0,0.15);
  color: var(--brand);
}
/* When collapsed, hide the in-sidebar toggle entirely — edge-peek tab is the reopen affordance */
.sidebar.collapsed .sidebar-header { display: none; }
.sidebar.collapsed .sidebar-toggle { display: none !important; }

/* Push chat history right under the header (no longer at sidebar bottom) */
.sidebar .chat-history-section {
  border-top: none !important;
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 6px;
  max-height: 38vh;
}
.sidebar.collapsed .chat-history-section { display: none !important; }

/* Mode-nav now sits below chats and takes remaining space */
.sidebar .mode-nav {
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-2);
}

/* === Fix task tracker collapse: remove empty grid column === */
.agent-app:has(.task-tracker.collapsed) {
  grid-template-columns: var(--sidebar-width) 1fr 0 !important;
}
.agent-app:has(.sidebar.collapsed):has(.task-tracker.collapsed) {
  grid-template-columns: var(--sidebar-collapsed) 1fr 0 !important;
}
.agent-app:has(.sidebar.collapsed) {
  grid-template-columns: var(--sidebar-collapsed) 1fr var(--task-panel-width) !important;
}
.task-tracker.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-left: none !important;
}

/* ========================================================================
   Apr 30 2026 — Big batch UX upgrades
   ====================================================================== */

/* === Assistant bubble: full width across chat canvas === */
.message.message-assistant {
  align-self: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
}
.message-assistant .message-body {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: 100% !important;
}
.message-assistant .message-content {
  width: 100% !important;
  max-width: 100% !important;
  border-radius: 14px !important;
}
/* User bubble stays right-aligned and bounded for readability */
.message.message-user {
  align-self: flex-end !important;
  max-width: 75% !important;
}

/* === Tier filter pills — force single line for any filter row === */
.tier-filters,
.filter-row,
.pill-row,
.payment-tier-tabs {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 6px !important;
  scrollbar-width: thin;
}
.tier-filters > *,
.filter-row > *,
.pill-row > *,
.payment-tier-tabs > * {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}
.payment-tier-tabs { padding-bottom: 4px; }
.payment-tier-tab,
.tier-filter {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
@media (max-width: 640px) {
  .tier-filters, .filter-row, .pill-row, .payment-tier-tabs { flex-wrap: wrap !important; overflow-x: visible !important; }
}

/* === Animated tech background behind chat-canvas (5% opacity, behind content) === */
.chat-canvas {
  position: relative !important;
  isolation: isolate;
}
.chat-canvas::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image:
    /* horizontal scanlines */
    repeating-linear-gradient(0deg, rgba(0,255,200,0.6) 0 1px, transparent 1px 3px),
    /* grid */
    linear-gradient(rgba(255,107,0,0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,107,0,0.5) 1px, transparent 1px),
    /* radial glow centre */
    radial-gradient(circle at 50% 50%, rgba(176,68,255,0.7), transparent 60%);
  background-size: 100% 4px, 40px 40px, 40px 40px, 100% 100%;
  animation: tech-bg-drift 22s linear infinite;
}
.chat-canvas::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background: linear-gradient(180deg, transparent 0%, rgba(0,255,200,0.6) 50%, transparent 100%);
  background-size: 100% 200px;
  animation: tech-bg-scan 8s linear infinite;
  mix-blend-mode: screen;
}
@keyframes tech-bg-drift {
  0%   { background-position: 0 0, 0 0, 0 0, 0 0; }
  100% { background-position: 0 0, 0 40px, 40px 0, 0 0; }
}
@keyframes tech-bg-scan {
  0%   { background-position: 0 -200px; }
  100% { background-position: 0 100vh; }
}
/* Ensure all chat content sits ABOVE the bg layers */
.chat-canvas > * { position: relative; z-index: 1; }
.message-list, .chat-welcome, .chat-input-wrap, .input-bar, .chat-input-bar { position: relative; z-index: 1; }

/* Chat bubbles get an opaque backdrop so the bg can't bleed through */
.message-assistant .message-content {
  background: rgba(15, 15, 23, 0.85) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.06);
}

/* === Image-gen progress placeholder card (shown while chart_gen running) === */
.chart-gen-placeholder {
  position: relative;
  margin-top: 14px;
  margin-bottom: 10px;
  padding: 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0c0c14, #1a1424);
  border: 1px solid rgba(255,107,0,0.45);
  overflow: hidden;
  min-height: 90px;
  box-shadow: 0 0 24px rgba(255,107,0,0.15), inset 0 0 30px rgba(176,68,255,0.06);
}
.chart-gen-placeholder .cgp-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #ff6b00;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chart-gen-placeholder .cgp-label::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ff6b00;
  box-shadow: 0 0 10px #ff6b00;
  animation: cgp-pulse 1s ease-in-out infinite;
}
@keyframes cgp-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.7); } }
.chart-gen-placeholder .cgp-bar {
  height: 6px;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin: 6px 0;
}
.chart-gen-placeholder .cgp-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ff6b00, #ffd700, #b044ff);
  width: 0%;
  transition: width 300ms ease;
  animation: cgp-shimmer 1.6s ease-in-out infinite;
}
@keyframes cgp-shimmer { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.4); } }
.chart-gen-placeholder .cgp-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #ffd700;
  text-align: right;
}
.chart-gen-placeholder .cgp-stage { font-size: 12px; color: #e0e0e0; font-family: 'JetBrains Mono', monospace; }


/* === Stronger visible chat tech background (still behind bubbles) === */
.chat-canvas {
  position: relative !important;
  isolation: isolate;
  background-color: rgba(5, 5, 10, 0.96);
}
.chat-canvas::before {
  content: '' !important;
  position: fixed !important;
  inset: 0 !important;
  pointer-events: none !important;
  z-index: 0 !important;
  opacity: 0.075 !important;
  background:
    linear-gradient(90deg, rgba(0, 229, 255, 0.45) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 122, 26, 0.42) 1px, transparent 1px),
    radial-gradient(circle at 18% 22%, rgba(168, 85, 247, 0.55), transparent 28%),
    radial-gradient(circle at 82% 78%, rgba(0, 229, 255, 0.45), transparent 24%);
  background-size: 42px 42px, 42px 42px, 900px 900px, 760px 760px;
  animation: jae-bg-grid-slide 9s linear infinite, jae-bg-hue 13s ease-in-out infinite alternate !important;
}
.chat-canvas::after {
  content: '' !important;
  position: fixed !important;
  inset: 0 !important;
  pointer-events: none !important;
  z-index: 0 !important;
  opacity: 0.09 !important;
  background:
    linear-gradient(115deg, transparent 0%, transparent 44%, rgba(0, 229, 255, 0.7) 49%, rgba(255, 122, 26, 0.45) 51%, transparent 57%, transparent 100%),
    repeating-linear-gradient(0deg, transparent 0 8px, rgba(255,255,255,0.12) 9px, transparent 10px);
  transform: translateX(-110%);
  animation: jae-bg-scanbeam 6s cubic-bezier(.45,0,.2,1) infinite !important;
}
@keyframes jae-bg-grid-slide {
  from { background-position: 0 0, 0 0, 0 0, 0 0; }
  to   { background-position: 84px 42px, -42px 84px, 36px -48px, -52px 38px; }
}
@keyframes jae-bg-hue {
  from { filter: hue-rotate(0deg) brightness(1); }
  to   { filter: hue-rotate(22deg) brightness(1.18); }
}
@keyframes jae-bg-scanbeam {
  0% { transform: translateX(-120%); }
  45%, 100% { transform: translateX(120%); }
}
.chat-canvas .message,
.chat-canvas .chat-welcome,
.chat-canvas .chat-input-wrap,
.chat-canvas .input-bar,
.chat-canvas .chat-input-bar,
.chat-canvas .quick-actions {
  position: relative !important;
  z-index: 2 !important;
}
.message-assistant .message-content,
.message-user .message-content {
  background-clip: padding-box;
}

/* === Inline nano-banana-pro chart generation progress card polish === */
.chart-gen-placeholder .cgp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.chart-gen-placeholder .cgp-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff7a1a, #ffd166);
  box-shadow: 0 0 12px rgba(255,122,26,.75);
  animation: cgp-pulse 1s ease-in-out infinite;
  flex-shrink: 0;
}
.chart-gen-placeholder .cgp-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #ffd166;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-gen-placeholder .cgp-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255,255,255,.55);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.chart-gen-placeholder.active {
  animation: cgp-card-breathe 1.8s ease-in-out infinite;
}
@keyframes cgp-card-breathe {
  0%, 100% { box-shadow: 0 0 0 rgba(255,122,26,0), inset 0 0 0 rgba(255,122,26,0); }
  50% { box-shadow: 0 0 26px rgba(255,122,26,.16), inset 0 0 18px rgba(255,122,26,.06); }
}

/* ────────────────────────────────────────────────────────────
   v5.10.2 — Readable chart previews + click-to-enlarge modal
   ──────────────────────────────────────────────────────────── */
.message-inline-cards .chart-card {
    width: min(100%, 416px); /* ~20% smaller than the prior ~520px inline card */
    max-width: 80%;
    margin-left: 0;
}
.chart-preview-btn {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    margin: 10px 0 8px;
    background: #05050a;
    border-radius: 12px;
    overflow: hidden;
    cursor: zoom-in;
    position: relative;
    box-shadow: 0 10px 28px rgba(0,0,0,.48), 0 0 0 1px rgba(255,107,0,.10) inset;
}
.chart-preview {
    display: block;
    width: 100%;
    max-height: 330px;
    object-fit: contain;
    background: #000;
    border-radius: 12px;
}
.chart-zoom-hint {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .66rem;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    letter-spacing: .04em;
    color: rgba(255,255,255,.9);
    background: rgba(0,0,0,.62);
    border: 1px solid rgba(255,255,255,.12);
    backdrop-filter: blur(8px);
    opacity: .84;
}
.chart-preview-btn:hover .chart-zoom-hint { opacity: 1; color: #fff; border-color: rgba(255,107,0,.32); }
.chart-data-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0 8px;
}
.chart-data-strip span {
    min-width: 0;
    padding: 7px 8px;
    border-radius: 9px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.075);
    color: rgba(210,210,225,.78);
    font-size: .66rem;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    text-transform: uppercase;
    letter-spacing: .035em;
}
.chart-data-strip b {
    display: block;
    margin-top: 3px;
    color: #fff;
    font-size: .74rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chart-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 3vw, 42px);
    background: rgba(0,0,0,.78);
    backdrop-filter: blur(14px) saturate(130%);
}
.chart-modal-overlay.open { display: flex; }
.chart-modal {
    width: min(1180px, 96vw);
    max-height: 94vh;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(18,18,28,.96), rgba(7,7,12,.98));
    border: 1px solid rgba(255,107,0,.28);
    box-shadow: 0 32px 90px rgba(0,0,0,.78), 0 0 80px rgba(255,107,0,.12);
    padding: 16px;
    position: relative;
}
.chart-modal-title {
    color: #fff;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: .82rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin: 0 44px 12px 2px;
}
.chart-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    background: rgba(255,255,255,.06);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.chart-modal-close:hover { background: rgba(255,107,0,.18); border-color: rgba(255,107,0,.45); }
.chart-modal-img {
    display: block;
    width: 100%;
    max-height: calc(94vh - 92px);
    object-fit: contain;
    border-radius: 12px;
    background: #000;
}
@media (max-width: 760px) {
    .message-inline-cards .chart-card { max-width: 100%; width: 100%; }
    .chart-data-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-preview { max-height: 260px; }
}


/* ────────────────────────────────────────────────────────────
   v5.10.6 — Chart progress without percentages + full visible chart previews
   ──────────────────────────────────────────────────────────── */
.chart-gen-placeholder .cgp-pct { display: none !important; }
.chart-gen-placeholder .cgp-head { justify-content: flex-start !important; }
.chart-gen-placeholder .cgp-bar {
  height: 6px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.075) !important;
  overflow: hidden !important;
  position: relative !important;
  box-shadow: inset 0 0 12px rgba(0,0,0,.42) !important;
}
.chart-gen-placeholder .cgp-bar > span {
  width: 0% !important;
  height: 100% !important;
  display: block !important;
  border-radius: inherit !important;
  background: linear-gradient(90deg, #ff6b00 0%, #ffd166 38%, #b044ff 72%, #00e5ff 100%) !important;
  box-shadow: 0 0 18px rgba(255,122,26,.55), 0 0 28px rgba(176,68,255,.35) !important;
  animation:
    cgp-ten-second-fill 10s cubic-bezier(.16,.84,.26,1) forwards,
    cgp-flow-sheen 1.25s linear infinite !important;
  background-size: 220% 100% !important;
}
@keyframes cgp-ten-second-fill {
  0% { width: 3%; }
  18% { width: 24%; }
  42% { width: 51%; }
  68% { width: 74%; }
  88% { width: 91%; }
  100% { width: 96%; }
}
@keyframes cgp-flow-sheen {
  0% { background-position: 0% 50%; filter: brightness(1); }
  50% { filter: brightness(1.35); }
  100% { background-position: 220% 50%; filter: brightness(1); }
}
.chart-gen-placeholder.active::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.08) 42%, transparent 56%);
  transform: translateX(-120%);
  animation: cgp-card-sweep 2.4s ease-in-out infinite;
}
@keyframes cgp-card-sweep {
  0% { transform: translateX(-120%); }
  55%,100% { transform: translateX(120%); }
}

/* Wide, full-image chart cards. The preview must not crop the generated chart. */
.message-inline-cards .chart-card.chart-card-wide,
.message-inline-cards .chart-card[data-tool-card="chart"] {
  width: min(100%, 760px) !important;
  max-width: 92% !important;
  margin-left: 0 !important;
}
.chart-preview-btn {
  width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  max-height: none !important;
  background: radial-gradient(circle at 50% 45%, rgba(176,68,255,.08), #020208 72%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}
.chart-preview {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center center !important;
  border-radius: 12px !important;
  background: #020208 !important;
}
.chart-preview-btn:hover .chart-preview {
  transform: scale(1.006);
  filter: brightness(1.05) saturate(1.05);
}
.chart-modal-img {
  object-fit: contain !important;
  width: auto !important;
  height: auto !important;
  max-width: min(96vw, 1500px) !important;
  max-height: 86vh !important;
}
@media (max-width: 900px) {
  .message-inline-cards .chart-card.chart-card-wide,
  .message-inline-cards .chart-card[data-tool-card="chart"] {
    width: 100% !important;
    max-width: 100% !important;
  }
  .chart-preview-btn { aspect-ratio: 16 / 9 !important; }
}

/* Task tracker scroll fix - force flex column layout */
.task-tracker {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}
.task-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 180px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Task tracker fully collapsed by default — individual task items */
.task-item.collapsed .task-item-body { display: none !important; }
.task-item.collapsed .task-item-header { cursor: pointer; }
.task-item.collapsed .task-item-header:hover { background: rgba(255,107,0,0.08); }

/* Task item header — always visible even when collapsed */
.task-item-header {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 6px 9px !important;
    min-height: 28px !important;
}

/* Task item body — hidden when collapsed */
.task-item-body {
    padding: 8px 9px 0 !important;
    margin-top: 4px !important;
    border-top: 1px solid rgba(255,107,0,0.12) !important;
}

/* Task category spacing — no overlap */
.task-category {
    margin-bottom: 10px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid rgba(255,107,0,0.15) !important;
}
.task-category:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

/* Task cat body spacing */
.task-cat-body {
    padding: 4px 0 !important;
}

/* Make entire task tracker scrollable */
.task-tracker {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}
.task-list {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 10px !important;
}

/* Custom scrollbar for task list */
.task-list::-webkit-scrollbar { width: 6px !important; }
.task-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.3) !important; }
.task-list::-webkit-scrollbar-thumb { background: rgba(255,107,0,0.4) !important; border-radius: 3px !important; }
.task-list::-webkit-scrollbar-thumb:hover { background: rgba(255,107,0,0.6) !important; }

/* Task tracker scrollable panel */
.task-tracker {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}
.task-list {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 10px !important;
}

/* Task category spacing — no overlap */
.task-category {
    margin-bottom: 12px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid rgba(255,107,0,0.15) !important;
    display: block !important;
}
.task-category:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}
.task-cat-body {
    padding: 6px 0 !important;
    display: block !important;
}
.task-category.collapsed .task-cat-body {
    display: none !important;
}

/* Collapsible task items — header always visible, body hidden when collapsed */
.task-item {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    margin-bottom: 6px !important;
}
.task-item-header {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 6px 9px !important;
    min-height: 28px !important;
    background: rgba(255,107,0,0.04) !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background 0.15s !important;
}
.task-item-header:hover {
    background: rgba(255,107,0,0.1) !important;
}
.task-item-body {
    display: none !important;
    padding: 8px 9px 6px !important;
    margin-top: 4px !important;
    border-top: 1px solid rgba(255,107,0,0.12) !important;
}
.task-item:not(.collapsed) .task-item-body {
    display: block !important;
}
.task-item.collapsed .task-item-body {
    display: none !important;
}

/* Custom scrollbar */
.task-list::-webkit-scrollbar { width: 6px !important; }
.task-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.3) !important; }
.task-list::-webkit-scrollbar-thumb { background: rgba(255,107,0,0.4) !important; border-radius: 3px !important; }
.task-list::-webkit-scrollbar-thumb:hover { background: rgba(255,107,0,0.6) !important; }

/* Task tracker scroll fix - v5.11.4 */
.task-tracker {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}
.task-list {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  max-height: calc(100vh - 80px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
.task-list::-webkit-scrollbar {
  width: 6px;
}
.task-list::-webkit-scrollbar-track {
  background: transparent;
}
.task-list::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 0, 0.6);
  border-radius: 3px;
}
.task-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 107, 0, 0.9);
}
.task-category {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 107, 0, 0.15);
}
.task-category:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
