/* OpenFang Components — Premium design system */

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  position: relative;
  letter-spacing: -0.01em;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: var(--shadow-xs), var(--shadow-inset);
}
.btn-primary:hover { background: var(--accent-dim); box-shadow: var(--shadow-sm), var(--shadow-accent); transform: translateY(-1px); }
.btn-success { background: var(--success); color: #000; box-shadow: var(--shadow-xs); }
.btn-success:hover { background: var(--success-dim); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn-danger { background: var(--error); color: #fff; box-shadow: var(--shadow-xs); }
.btn-danger:hover { background: var(--error-dim); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--border-light); transform: translateY(-1px); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color var(--transition-fast), transform 0.2s var(--ease-spring), box-shadow var(--transition-fast);
  position: relative;
  box-shadow: var(--shadow-xs), var(--shadow-inset);
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-inset);
}
.card:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-md), var(--shadow-inset);
}
.card-header { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.card-meta { font-size: 12px; color: var(--text-dim); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Glow effect on card hover */
.card-glow {
  overflow: hidden;
}
.card-glow::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--accent-glow), transparent 40%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: inherit;
}
.card-glow:hover::before { opacity: 1; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-running { background: rgba(74,222,128,0.12); color: var(--success); }
.badge-suspended { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-terminated { background: rgba(239,68,68,0.12); color: var(--error); }
.badge-created { background: rgba(59,130,246,0.12); color: var(--info); }
.badge-crashed { background: rgba(239,68,68,0.2); color: var(--error); }
.badge-connected { background: rgba(74,222,128,0.12); color: var(--success); }
.badge-disconnected { background: rgba(239,68,68,0.12); color: var(--error); }
.badge-success { background: rgba(74,222,128,0.12); color: var(--success); }
.badge-warn { background: rgba(250,204,21,0.15); color: var(--warning); }
.badge-error { background: rgba(239,68,68,0.12); color: var(--error); }
.badge-muted { background: rgba(148,163,184,0.12); color: var(--text-dim); }
.badge-info { background: rgba(59,130,246,0.12); color: var(--info); }
.badge-dim { background: rgba(148,163,184,0.08); color: var(--text-dim); font-size: 0.65rem; }
.text-danger { color: var(--error); }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  transition: border-color 0.2s var(--ease-smooth), box-shadow 0.2s var(--ease-smooth);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select { cursor: pointer; }

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,7,6,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.15s var(--ease-smooth);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.2s var(--ease-spring);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 { font-size: 15px; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--text); }

/* Settings option cards */
.setting-option-card:hover { border-color: var(--text-muted) !important; }
.setting-option-selected { border-color: var(--primary) !important; background: rgba(99, 102, 241, 0.08); }

/* Messages / Chat */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.message {
  margin-bottom: 20px;
  animation: slideUp 0.25s var(--ease-smooth);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  position: relative;
}

.message:hover .message-actions { opacity: 1; pointer-events: auto; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

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

.message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.message-avatar img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.message-body {
  min-width: 0;
  max-width: 100%;
  flex: 1;
  position: relative;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
}

.message.user .message-bubble {
  background: var(--user-bg);
  border: 1px solid rgba(255,92,0,0.12);
  border-bottom-right-radius: var(--radius-sm);
}
.message.agent .message-bubble {
  background: var(--agent-bg);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: var(--radius-sm);
  padding: 10px 14px;
}
.message.system .message-bubble {
  background: var(--surface3);
  border: 1px solid var(--border);
  font-size: 12px;
  border-radius: var(--radius-md);
}
.message.system {
  max-width: 600px;
}
.message.thinking .message-bubble { animation: pulse 1.5s infinite; }

/* Streaming indicator — pulsing left border */
.message.streaming .message-bubble {
  border-left: 3px solid var(--accent);
  animation: stream-pulse 2s ease-in-out infinite;
}
@keyframes stream-pulse {
  0%, 100% { border-left-color: var(--accent); box-shadow: -2px 0 8px var(--accent-glow); }
  50% { border-left-color: var(--accent-dim); box-shadow: none; }
}

/* Message timestamp + meta */
.message-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  padding-left: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  user-select: none;
}
.message:hover .message-time { opacity: 0.7; }
.message-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  padding-left: 2px;
  opacity: 0.6;
  font-family: var(--font-mono);
}

/* Message hover actions (copy button) */
.message-actions {
  position: absolute;
  top: -4px;
  right: 0;
  display: flex;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 2;
}
.message.user .message-actions { right: auto; left: 0; }
.message-action-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  box-shadow: var(--shadow-xs);
}
.message-action-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border-light);
}
.message-action-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

/* Typing indicator dots */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Voice recording */
.btn-recording {
  background: rgba(239, 68, 68, 0.15) !important;
  color: var(--danger) !important;
  animation: recording-pulse 1s ease-in-out infinite;
}
.recording-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: recording-pulse 1s ease-in-out infinite;
}
.recording-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  flex-shrink: 0;
}
@keyframes recording-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Audio player in tool card */
.audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* Canvas panel */
.canvas-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 8px 0;
  overflow: hidden;
}
.canvas-panel iframe {
  width: 100%;
  min-height: 300px;
  border: none;
  background: #fff;
  resize: vertical;
  overflow: auto;
}

/* Queue indicator badge */
.queue-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  animation: fadeIn 0.2s;
}

/* Session switcher */
.session-count-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.session-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  overflow: hidden;
}
.session-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.session-item:hover { background: var(--surface2); }
.session-item.active { background: var(--accent-subtle); cursor: default; }
.session-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.session-dot.active { background: var(--success); }

/* Chat search bar */
.chat-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-search-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  font-family: var(--font-sans);
}
.chat-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}
mark.search-highlight {
  background: var(--warning, #f59e0b);
  color: #000;
  border-radius: 2px;
  padding: 0 1px;
}

/* Markdown in messages */
.message-bubble.markdown-body {
  font-family: var(--font-sans);
}

.message-bubble.markdown-body code {
  font-family: var(--font-mono);
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--accent-light);
}

.message-bubble.markdown-body pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  overflow-x: auto;
  margin: 8px 0;
  position: relative;
}

.message-bubble.markdown-body pre code {
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--text);
}

.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 3px 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.copy-btn:hover { color: var(--text); background: var(--surface); border-color: var(--border-light); }

/* Tool call cards — premium design with category icons */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  margin: 8px 0;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  animation: slideUp 0.2s var(--ease-smooth);
}

.tool-card:hover { box-shadow: var(--shadow-sm); }

.tool-card-error {
  border-left-color: var(--error);
  background: var(--error-subtle);
}

/* Tool category colors */
.tool-card[data-tool^="file_"],
.tool-card[data-tool^="directory_"] { border-left-color: #60A5FA; }
.tool-card[data-tool^="web_"],
.tool-card[data-tool^="link_"] { border-left-color: #34D399; }
.tool-card[data-tool^="shell"],
.tool-card[data-tool^="exec_"] { border-left-color: #FBBF24; }
.tool-card[data-tool^="agent_"] { border-left-color: #A78BFA; }
.tool-card[data-tool^="memory_"],
.tool-card[data-tool^="knowledge_"] { border-left-color: #F472B6; }
.tool-card[data-tool^="cron_"],
.tool-card[data-tool^="schedule_"] { border-left-color: #FB923C; }
.tool-card[data-tool^="browser_"],
.tool-card[data-tool^="playwright_"] { border-left-color: #2DD4BF; }
.tool-card[data-tool^="container_"],
.tool-card[data-tool^="docker_"] { border-left-color: #38BDF8; }
.tool-card[data-tool^="image_"],
.tool-card[data-tool^="tts_"] { border-left-color: #E879F9; }
.tool-card[data-tool^="hand_"] { border-left-color: var(--accent); }

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
  transition: background var(--transition-fast);
}

.tool-card-header:hover { background: var(--surface2); }

/* Tool icon — SVG category icon before tool name */
.tool-card-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.tool-card-name {
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.tool-card-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.tool-icon-ok {
  color: var(--success);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.tool-icon-err {
  color: var(--error);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.tool-expand-chevron {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.tool-card-body {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg);
  animation: slideDown 0.15s var(--ease-smooth);
}

.tool-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.tool-pre {
  margin: 0;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  color: var(--text);
  line-height: 1.5;
}

/* Smart collapse — short results inline, long results preview */
.tool-pre-short { max-height: 44px; overflow: hidden; }
.tool-pre-medium { max-height: 120px; }

.tool-pre-error {
  color: var(--error);
  border-color: var(--error);
  background: var(--error-subtle);
}

/* Chat input — always pinned at bottom, premium compose area */
.input-area {
  flex-shrink: 0;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border);
  background: linear-gradient(to top, var(--bg-primary) 0%, var(--bg-primary) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.input-area textarea {
  flex: 1;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  resize: none;
  min-height: 44px;
  max-height: 150px;
  line-height: 1.5;
  transition: border-color 0.2s var(--ease-smooth), box-shadow 0.2s var(--ease-smooth), background 0.2s;
}

.input-area textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-elevated);
}

.input-area textarea.streaming-active {
  border-color: var(--border-light);
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s var(--ease-spring);
  box-shadow: var(--shadow-sm), var(--shadow-accent);
}
.btn-send:hover { background: var(--accent-dim); transform: scale(1.05); box-shadow: var(--shadow-md), var(--shadow-accent); }
.btn-send:active { transform: scale(0.92); }
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; }

/* Stop button variant during streaming */
.btn-stop {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--error);
  background: var(--error-subtle);
  color: var(--error);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s var(--ease-spring);
}
.btn-stop:hover { background: var(--error); color: #fff; transform: scale(1.05); }
.btn-stop:active { transform: scale(0.92); }

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  min-height: 18px;
  padding: 0 4px;
}

/* Slash command menu */
.slash-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.slash-menu-item {
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.slash-menu-item:last-child { border-bottom: none; }
.slash-menu-item:hover, .slash-menu-item.slash-active { background: var(--surface2); }

/* Sidebar footer */
.sidebar-footer {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

/* Copy button copied state */
.copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

/* Empty state — premium with subtle illustration */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--text-dim);
  padding: 80px 20px;
  text-align: center;
  animation: fadeIn 0.4s var(--ease-smooth);
}

.empty-state .logo {
  font-size: 36px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 6px;
  margin-bottom: 12px;
}

.empty-state .logo-img {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
  opacity: 0.4;
  transition: opacity 0.3s;
}

.empty-state:hover .logo-img { opacity: 0.6; }

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 28px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p { font-size: 14px; max-width: 400px; line-height: 1.6; color: var(--text-dim); margin-bottom: 16px; }

.empty-state .btn { margin-top: 4px; }

/* Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle.active { background: var(--accent); }

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle.active::after { transform: translateX(16px); }

/* Search input */
.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}

.search-input:focus-within { border-color: var(--accent); }

.search-input input {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  flex: 1;
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}
.search-clear-btn:hover { color: var(--text); }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Stats row */
.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  min-width: 140px;
  flex: 1;
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s var(--ease-spring), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-light);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
  font-weight: 500;
}

/* Theme switcher — 3-mode pill (Light / System / Dark) */
.theme-switcher {
  display: inline-flex;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.theme-opt {
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  transition: all 0.2s;
  line-height: 1;
}
.theme-opt:hover { color: var(--text-primary); background: var(--bg-hover); }
.theme-opt.active { color: var(--accent); background: var(--accent-glow); }

/* Utility */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 11px; }
.text-xs { font-size: 10px; }
.font-bold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* Agent card actions */
.agent-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Agent picker in chat empty state */
.agent-pick-card {
  cursor: pointer;
  margin-bottom: 8px;
  padding: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.agent-pick-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
}

/* Detail modal grid */
.detail-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.detail-value {
  font-size: 12px;
  color: var(--text);
  text-align: right;
}

/* Channel icon */
.channel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Setup guide steps */
.setup-steps {
  margin: 0;
  padding-left: 20px;
  list-style: decimal;
}
.setup-steps li {
  padding: 4px 0;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Config code block */
.config-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  color: var(--accent-light);
  overflow-x: auto;
  margin: 0;
}

/* Security Dashboard */
.security-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.security-hero-shield {
  font-size: 48px;
  color: var(--success);
  flex-shrink: 0;
  text-shadow: 0 0 20px rgba(74,222,128,0.3);
}

.security-hero-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.security-hero-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 600px;
}

.security-section {
  margin-bottom: 24px;
}

.security-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.security-shield {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 20px;
  flex-shrink: 0;
}

.shield-core {
  background: rgba(74,222,128,0.1);
  color: var(--success);
}

.shield-config {
  background: rgba(255,92,0,0.1);
  color: var(--accent);
}

.shield-monitor {
  background: rgba(59,130,246,0.1);
  color: var(--info);
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.security-grid-sm {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.security-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  transition: border-color 0.2s;
}

.security-card:hover {
  border-color: var(--border-light);
}

.security-card-name {
  font-size: 13px;
  font-weight: 600;
}

.security-card-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 8px;
}

.security-card-threat {
  display: flex;
  gap: 6px;
  align-items: baseline;
  color: var(--text-dim);
  background: rgba(239,68,68,0.05);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.security-card-value {
  font-size: 10px;
  color: var(--accent-light);
  background: var(--bg);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.security-card-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

/* Security badges */
.sec-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.sec-badge-core {
  background: rgba(74,222,128,0.12);
  color: var(--success);
}

.sec-badge-config {
  background: rgba(255,92,0,0.12);
  color: var(--accent);
}

.sec-badge-monitor {
  background: rgba(59,130,246,0.12);
  color: var(--info);
}

.sec-badge-warn {
  background: rgba(239,68,68,0.15);
  color: var(--error);
}

/* Overview dashboard — premium stat cards */
.stats-row-lg { gap: 16px; }
.stat-card-lg {
  padding: 24px 28px;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease-spring), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.stat-card-lg::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.stat-card-lg:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card-lg:hover::after { opacity: 1; }
.stat-card-lg .stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat-card-lg .stat-label { font-size: 11px; margin-top: 2px; font-weight: 500; }

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.health-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 20px;
  transition: all var(--transition-fast);
}
.health-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.health-indicator.health-ok { color: var(--success); background: var(--success-subtle); }
.health-indicator.health-ok::before { background: var(--success); animation: pulse-ring 2s infinite; }
.health-indicator.health-down { color: var(--error); background: var(--error-subtle); }
.health-indicator.health-down::before { background: var(--error); }

/* Focus mode toggle */
.focus-toggle {
  font-size: 11px;
  letter-spacing: 0.3px;
}

/* Logs page */
.log-entry { padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 11px; }
.log-entry:last-child { border-bottom: none; }
.log-level { display: inline-block; width: 44px; font-weight: 600; font-size: 10px; }
.log-level-info { color: var(--info); }
.log-level-warn { color: var(--warning, #f59e0b); }
.log-level-error { color: var(--error); }
.log-timestamp { color: var(--text-muted); font-size: 10px; margin-right: 8px; }

/* Live log streaming indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.live-indicator.live {
  color: var(--success);
  background: rgba(74,222,128,0.1);
}
.live-indicator.live .live-dot {
  background: var(--success);
  animation: live-pulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(74,222,128,0.4);
}

.live-indicator.polling {
  color: var(--warning, #f59e0b);
  background: rgba(245,158,11,0.1);
}
.live-indicator.polling .live-dot {
  background: var(--warning, #f59e0b);
}

.live-indicator.paused {
  color: var(--text-muted);
  background: rgba(148,163,184,0.1);
}
.live-indicator.paused .live-dot {
  background: var(--text-muted);
}

.live-indicator.disconnected {
  color: var(--error);
  background: rgba(239,68,68,0.1);
}
.live-indicator.disconnected .live-dot {
  background: var(--error);
}

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

/* Trigger cards */
.trigger-type { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Session cards */
.session-card { cursor: pointer; transition: border-color var(--transition-fast); }
.session-card:hover { border-color: var(--accent); }

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 420px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  cursor: pointer;
}

.toast-msg { flex: 1; line-height: 1.5; }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 0 2px; flex-shrink: 0; }
.toast-close:hover { color: var(--text); }

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--error); }
.toast-warn { border-left-color: var(--warning, #f59e0b); }
.toast-info { border-left-color: var(--info); }

.toast-dismiss { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

/* ── Confirm Modal ── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,7,6,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

.confirm-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-glow);
}

.confirm-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Loading & Error States ── */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px;
  color: var(--text-dim);
  font-size: 13px;
  animation: fadeInLoading 0.01s ease-out 350ms both;
}

@keyframes fadeInLoading {
  from { opacity: 0; }
  to { opacity: 1; }
}

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px;
  text-align: center;
}

.error-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(239,68,68,0.1);
  color: var(--error);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}

.error-state p {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 360px;
  line-height: 1.6;
}

/* ── Onboarding Banner ── */
.onboarding-banner {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.onboarding-banner h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.onboarding-banner ol {
  padding-left: 20px;
  margin: 8px 0 16px;
}

.onboarding-banner li {
  padding: 4px 0;
  color: var(--text-dim);
  line-height: 1.6;
  font-size: 12px;
}

.onboarding-banner code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--accent-light);
}

/* ── Improved Empty States ── */
.empty-state-action { margin-top: 16px; }
.empty-state h4 { font-size: 14px; color: var(--text); margin-bottom: 4px; }
.empty-state .hint { font-size: 11px; color: var(--text-muted); max-width: 360px; line-height: 1.6; }

/* ── Connection Reconnecting ── */
.conn-reconnecting {
  animation: pulse 1.5s infinite;
  color: var(--warning, #f59e0b);
  font-size: 11px;
}

/* ── Info Cards (explainer pattern) ── */
.info-card {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.info-card h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.info-card p {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}

.info-card ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.info-card li {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  padding: 1px 0;
}

/* ── Unconfigured card (dashed border) ── */
.card-unconfigured {
  border-style: dashed;
  opacity: 0.8;
}

.card-unconfigured:hover {
  opacity: 1;
  border-color: var(--accent);
}

/* ── Runtime badges (skill types) ── */
.runtime-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.runtime-badge-py { background: rgba(59,130,246,0.12); color: var(--info); }
.runtime-badge-js { background: rgba(250,204,21,0.15); color: var(--warning); }
.runtime-badge-wasm { background: rgba(168,85,247,0.12); color: #a855f7; }
.runtime-badge-prompt { background: rgba(74,222,128,0.12); color: var(--success); }

/* ── Category badges ── */
.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: rgba(148,163,184,0.1);
  color: var(--text-dim);
}

/* ── Tier badges ── */
.tier-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.tier-frontier { background: rgba(168,85,247,0.12); color: #a855f7; }
.tier-smart { background: rgba(59,130,246,0.12); color: var(--info); }
.tier-balanced { background: rgba(74,222,128,0.12); color: var(--success); }
.tier-fast { background: rgba(250,204,21,0.15); color: var(--warning); }

/* ── Auth status badges ── */
.auth-configured { background: rgba(74,222,128,0.12); color: var(--success); }
.auth-not-set { background: rgba(250,204,21,0.15); color: var(--warning); }
.auth-no-key { background: rgba(148,163,184,0.12); color: var(--text-dim); }

/* ── Provider cards ── */
.provider-card {
  transition: border-color 0.2s, box-shadow 0.2s;
}
.provider-card.configured { border-left: 3px solid var(--success); }
.provider-card.not-configured { border-left: 3px solid var(--warning); }
.provider-card.no-key { border-left: 3px solid var(--text-muted); }

/* ── Filter pills ── */
.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  transition: all 0.15s;
  font-family: var(--font-mono);
}

.filter-pill:hover { border-color: var(--accent); color: var(--text); }
.filter-pill.active { background: var(--accent); color: var(--bg-primary); border-color: var(--accent); }

/* ── Difficulty badges ── */
.difficulty-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-dim);
}

.difficulty-easy { color: var(--success); }
.difficulty-medium { color: var(--warning); }
.difficulty-hard { color: var(--error); }

/* ── Provider key input ── */
.key-input-group {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.key-input-group input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}

.key-input-group input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Cost Dashboard Charts ── */

.cost-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .cost-charts-row {
    grid-template-columns: 1fr;
  }
}

.cost-chart-panel {
  min-height: 200px;
}

/* Donut chart */
.donut-chart-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.donut-chart {
  flex-shrink: 0;
}

.donut-segment {
  transition: opacity 0.2s;
  cursor: default;
}

.donut-segment:hover {
  opacity: 0.75;
}

/* Donut legend */
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.donut-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.donut-legend-label {
  flex: 1;
  color: var(--text);
  font-weight: 600;
}

.donut-legend-pct {
  color: var(--text-dim);
  font-size: 10px;
  min-width: 28px;
  text-align: right;
}

.donut-legend-cost {
  font-size: 10px;
  min-width: 48px;
  text-align: right;
}

/* Bar chart */
.bar-chart {
  padding: 12px 0;
  overflow-x: auto;
}

.bar-chart svg {
  display: block;
  margin: 0 auto;
}

.cost-bar {
  transition: opacity 0.2s;
  cursor: default;
}

.cost-bar:hover {
  opacity: 1 !important;
  filter: brightness(1.15);
}

/* ── Browser Viewer ── */
.browser-viewer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 900px;
  width: 90vw;
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.browser-viewer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt, var(--surface));
  border-radius: 12px 12px 0 0;
}

.browser-url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  min-width: 0;
}

.browser-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.browser-dot.red { background: #ff5f57; }
.browser-dot.yellow { background: #febc2e; }
.browser-dot.green { background: #28c840; }

.browser-url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
  min-width: 0;
}

.browser-viewer-body {
  padding: 16px;
}

.browser-screenshot {
  margin-bottom: 12px;
  background: var(--bg);
  border-radius: 6px;
  padding: 4px;
  border: 1px solid var(--border);
}

.browser-screenshot img {
  max-width: 100%;
  border-radius: 4px;
  display: block;
}

.browser-info {
  padding: 8px 0;
}

/* ── Setup Wizard ── */

.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
  padding: 20px 0 16px;
  position: relative;
}

.wizard-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  z-index: 2;
  flex: 1;
  max-width: 120px;
  transition: opacity 0.2s;
}

.wizard-progress-step:hover { opacity: 0.8; }

.wizard-progress-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  transition: all 0.3s ease;
}

.wizard-progress-step.wiz-active .wizard-progress-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.wizard-progress-step.wiz-done .wizard-progress-circle {
  border-color: var(--success);
  background: var(--success);
  color: #000;
}

.wizard-progress-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.wizard-progress-step.wiz-active .wizard-progress-label {
  color: var(--accent);
}

.wizard-progress-step.wiz-done .wizard-progress-label {
  color: var(--success);
}

.wizard-progress-line {
  position: absolute;
  top: 36px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--border);
  z-index: 1;
}

.wizard-progress-line-fill {
  height: 100%;
  background: var(--success);
  transition: width 0.4s ease;
  border-radius: 1px;
}

.wizard-step {
  animation: fadeIn 0.3s ease;
}

.wizard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* Wizard provider selection card */
.wizard-provider-card {
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.wizard-provider-selected {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent-glow);
  background: rgba(255,92,0,0.04);
}

/* Wizard template selection card */
.wizard-template-card {
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.wizard-template-selected {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent-glow);
  background: rgba(255,92,0,0.04);
}

/* Responsive wizard */
@media (max-width: 600px) {
  .wizard-progress-label { display: none; }
  .wizard-progress-step { max-width: 48px; }
  .wizard-progress-circle { width: 28px; height: 28px; font-size: 11px; }
  .wizard-progress-line { top: 34px; }
  .wizard-card { padding: 16px; }
}

/* ── Page Transition Animation ── */
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-body { animation: slideIn 0.2s ease; }

/* ── Skeleton Loading Placeholder ── */
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: calc(200px + 100%) 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface) 37%, var(--surface2) 63%);
  background-size: 200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ── File Attachment Drop Zone ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: all 0.2s;
}
.drop-zone.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.drop-zone-text { font-size: 12px; color: var(--text-dim); }
.file-preview { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 0; }
.file-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb .remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-name {
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60px;
  text-align: center;
}

/* ── Approval Badge & Page Styles ── */
.approval-card { border-left: 3px solid var(--warning); }
.approval-card.approved { border-left-color: var(--success); }
.approval-card.rejected { border-left-color: var(--error); }
.approval-card.expired { border-left-color: var(--text-muted); opacity: 0.7; }
.approval-timer {
  font-size: 11px;
  color: var(--warning);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.approval-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ── Agent Identity Styles ── */
.agent-emoji { font-size: 20px; line-height: 1; flex-shrink: 0; }
.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.agent-identity { display: flex; align-items: center; gap: 8px; }
.agent-color-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Message Grouping Styles ── */
.message.grouped { margin-top: -14px; }
.message.grouped .message-avatar { visibility: hidden; }
.message.grouped .message-meta { display: none; }
.message.grouped .message-time { display: none; }

/* ── Inline Image Preview in Messages ── */
.message-image {
  max-width: 300px;
  max-height: 200px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s;
  margin: 8px 0;
}
.message-image:hover { transform: scale(1.02); }
.message-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  transition: border-color 0.15s;
  margin: 4px 0;
}
.message-file-link:hover { border-color: var(--accent); color: var(--text); }

/* ── Setup Checklist Progress Bar ── */
.progress-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.3s ease; }

/* ── Tool Badge ── */
.tool-badge { font-size: 10px; padding: 2px 6px; border-radius: 3px; background: var(--surface2); color: var(--text-dim); display: inline-block; margin: 1px; }

/* ── Try-It Mini Chat ── */
.tryit-messages { max-height: 200px; overflow-y: auto; margin: 12px 0; }
.tryit-msg { padding: 6px 10px; border-radius: 6px; margin: 4px 0; font-size: 12px; line-height: 1.5; word-break: break-word; }
.tryit-msg-user { background: var(--accent); color: var(--bg-primary); margin-left: 40px; }
.tryit-msg-agent { background: var(--surface2); margin-right: 40px; }

/* ── Suggested Message Chips ── */
.suggest-chip { display: inline-block; padding: 4px 10px; border: 1px solid var(--border); border-radius: 12px; font-size: 11px; cursor: pointer; transition: all 0.15s; background: transparent; color: var(--text-dim); font-family: var(--font-mono); }
.suggest-chip:hover { border-color: var(--accent); color: var(--accent); }

/* ── Setup Checklist Card ── */
.setup-checklist { margin-bottom: 20px; }
.setup-checklist-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.setup-checklist-item:last-child { border-bottom: none; }
.setup-checklist-icon { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; border: 2px solid var(--border); color: var(--text-dim); }
.setup-checklist-icon.done { background: var(--success); border-color: var(--success); color: #000; }

/* ── Channel Setup Steps Indicator ── */
.channel-steps { display: flex; align-items: center; gap: 0; margin-bottom: 20px; }
.channel-step-item { display: flex; align-items: center; gap: 6px; flex: 1; }
.channel-step-num { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; border: 2px solid var(--border); color: var(--text-dim); flex-shrink: 0; transition: all 0.2s; }
.channel-step-num.active { border-color: var(--accent); background: var(--accent); color: var(--bg-primary); }
.channel-step-num.done { border-color: var(--success); background: var(--success); color: #000; }
.channel-step-label { font-size: 11px; color: var(--text-dim); }
.channel-step-label.active { color: var(--accent); font-weight: 600; }
.channel-step-label.done { color: var(--success); }
.channel-step-line { flex: 1; height: 2px; background: var(--border); margin: 0 8px; }
.channel-step-line.done { background: var(--success); }

/* ── Chat Tip Bar ── */
.tip-bar { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 4px 8px; font-size: 11px; color: var(--text-muted); transition: opacity 0.3s; }
.tip-bar-dismiss { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 0 4px; line-height: 1; }
.tip-bar-dismiss:hover { color: var(--text); }

/* ── Wizard Category Filter ── */
.wizard-category-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.wizard-category-pill { padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--text-dim); transition: all 0.15s; font-family: var(--font-mono); }
.wizard-category-pill:hover { border-color: var(--accent); color: var(--text); }
.wizard-category-pill.active { background: var(--accent); color: var(--bg-primary); border-color: var(--accent); }

/* ── Capability Preview Panel ── */
.capability-preview { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; margin-top: 12px; }
.capability-preview-title { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

/* ── Ready Panel (Channel step 3) ── */
.ready-panel { text-align: center; padding: 24px 16px; }
.ready-panel-icon { font-size: 48px; color: var(--success); margin-bottom: 8px; }
.ready-panel-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.ready-panel-desc { font-size: 12px; color: var(--text-dim); line-height: 1.6; }

/* ── Wizard Step Indicator ── */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 8px 0;
}
.wizard-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--text-dim);
  background: var(--surface);
  transition: all 0.2s ease;
}
.wizard-dot.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.wizard-dot.done {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-subtle, rgba(34, 197, 94, 0.1));
}
.wizard-dot + .wizard-dot::before {
  content: '';
  display: block;
  width: 16px;
  height: 2px;
  background: var(--border);
  position: relative;
  left: -12px;
}

/* ── Emoji Grid ── */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.emoji-grid-item {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.emoji-grid-item:hover {
  border-color: var(--accent);
  background: var(--surface2);
  transform: scale(1.1);
}
.emoji-grid-item.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

/* ── Personality Pills ── */
.personality-pill {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.personality-pill:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}
.personality-pill.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 12px var(--accent-subtle);
}

/* ── File List ── */
.file-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--surface);
}
.file-list-item:hover {
  border-color: var(--accent);
  background: var(--surface2);
}

/* ── File Editor ── */
.file-editor {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text);
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}
.file-editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

/* ── Stat Value Semantic Colors ── */
.stat-value-success { color: var(--success) !important; }
.stat-value-warning { color: var(--warning) !important; }
.stat-value-error { color: var(--error) !important; }
.stat-value-accent { color: var(--accent) !important; }

/* ── Additional Skeleton Variants ── */
.skeleton-stat { height: 88px; border-radius: var(--radius-lg); background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; }
.skeleton-table { height: 200px; border-radius: var(--radius-lg); width: 100%; background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; }
.skeleton-row { display: flex; gap: 16px; margin-bottom: 12px; }

/* ── Enhanced Empty State ── */
.empty-state svg, .empty-state-icon svg { opacity: 0.3; }
.empty-state-cta { margin-top: 16px; }

/* ── Nav Section Collapsible ── */
.nav-section-title {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-section-chevron {
  font-size: 8px;
  transition: transform var(--transition-fast);
  color: var(--text-muted);
}

/* ── Settings Secondary Tabs ── */
.tab-secondary { font-size: 11px; opacity: 0.7; }
.tab-secondary:hover, .tab-secondary.active { opacity: 1; }
.tabs-separator { flex: 1; min-width: 16px; }

/* ── Quick Action Cards ── */
.quick-action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-xs), var(--shadow-inset);
}
.quick-action-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-inset);
}
.quick-action-card .quick-action-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.quick-action-card .quick-action-label { font-size: 13px; font-weight: 600; }
.quick-action-card .quick-action-desc { font-size: 11px; color: var(--text-dim); }

/* ── Hand Setup Wizard ── */
.hand-wizard {
  max-width: 680px;
  width: 95vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
}
.hand-wizard-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.hand-wizard-header .wizard-icon { font-size: 2rem; line-height: 1; }
.hand-wizard-header .wizard-title { font-size: 16px; font-weight: 700; margin: 0; }
.hand-wizard-header .wizard-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.hand-wizard-header .wizard-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.hand-wizard-header .wizard-close:hover { color: var(--text); }
.hand-wizard-body { padding: 20px 24px; }

/* Step Progress Indicator */
.hand-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 16px 24px 0;
}
.hand-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hand-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--text-dim);
  background: var(--bg-primary);
  transition: all 0.2s;
  flex-shrink: 0;
}
.hand-step-item.active .hand-step-num {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg-primary);
}
.hand-step-item.done .hand-step-num {
  border-color: var(--success);
  background: var(--success);
  color: #000;
}
.hand-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}
.hand-step-item.active .hand-step-label { color: var(--text); }
.hand-step-item.done .hand-step-label { color: var(--success); }
.hand-step-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
  flex-shrink: 0;
}
.hand-step-line.done { background: var(--success); }

/* Dependency Cards */
.dep-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.dep-card.dep-met { border-left-color: var(--success); }
.dep-card.dep-missing { border-left-color: var(--warning); }
.dep-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.dep-status-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.dep-status-icon.met { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.dep-status-icon.missing { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.dep-status-icon.checking { animation: depPulse 1.2s ease-in-out infinite; }
.dep-card-title { font-size: 13px; font-weight: 600; }
.dep-card-desc { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.dep-time-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  background: var(--surface2);
  border-radius: 10px;
  color: var(--text-dim);
  margin-left: 8px;
}
.dep-met-msg {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--success);
  padding: 4px 0;
}

/* Platform Install Selector */
.install-block {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 8px;
}
.install-platform-pills {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.install-platform-pill {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-dim);
  border: none;
  background: none;
  transition: all 0.15s;
  border-bottom: 2px solid transparent;
}
.install-platform-pill:hover { color: var(--text); background: var(--surface2); }
.install-platform-pill.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}
.install-cmd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  gap: 8px;
}
.install-cmd code {
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
}
.copy-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.copy-btn:hover { background: var(--surface2); color: var(--text); }
.copy-btn.copied { background: var(--success); color: #000; border-color: var(--success); }

/* API Key Steps */
.api-key-steps {
  list-style: none;
  counter-reset: api-step;
  padding: 0;
  margin: 8px 0 0;
}
.api-key-steps li {
  counter-increment: api-step;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--text-dim);
  padding: 5px 0;
  line-height: 1.5;
}
.api-key-steps li::before {
  content: counter(api-step);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  background: var(--surface2);
  color: var(--text-dim);
  flex-shrink: 0;
  margin-top: 1px;
}

/* Dependency Progress Bar */
.dep-progress {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.dep-progress-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.dep-progress-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.dep-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Auto-Install Progress */
.install-progress-panel {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.install-progress-header {
  margin-bottom: 8px;
}
.install-results-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.install-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
}
.install-result-row.dep-met { color: var(--green); }
.install-result-row.dep-missing { color: var(--red); }
.install-result-icon {
  width: 16px;
  text-align: center;
  font-weight: bold;
  flex-shrink: 0;
}

/* Small spinner */
.spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Launch Summary */
.launch-summary {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}
.launch-summary-icon { font-size: 3rem; margin-bottom: 8px; }
.launch-summary-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.launch-summary-rows {
  text-align: left;
  margin: 0 auto;
  max-width: 400px;
}
.launch-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.launch-summary-row:last-child { border-bottom: none; }
.launch-summary-row .row-label { color: var(--text-dim); }
.launch-summary-row .row-value { font-weight: 600; }
.launch-summary-row .row-check { color: var(--success); }

/* Wizard Navigation */
.hand-wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  gap: 12px;
}
.hand-wizard-nav .btn-launch {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 700;
}

@keyframes depPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Workflow Visual Builder ─────────────────────────── */
.wf-builder-layout {
  display: flex;
  height: calc(100vh - 120px);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-secondary);
}
.wf-palette {
  width: 200px;
  min-width: 200px;
  padding: 12px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}
.wf-palette-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.wf-palette-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
  border-radius: 6px;
  background: var(--bg-secondary);
  cursor: grab;
  transition: background 0.15s;
  user-select: none;
}
.wf-palette-node:hover { background: var(--hover); }
.wf-palette-node:active { cursor: grabbing; }
.wf-palette-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.wf-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.wf-canvas {
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  cursor: default;
}
.wf-canvas .wf-node { cursor: grab; }
.wf-canvas .wf-node:active { cursor: grabbing; }
.wf-port {
  cursor: crosshair;
  transition: r 0.15s, fill 0.15s;
}
.wf-port:hover {
  r: 8;
  fill: var(--accent);
}
.wf-zoom-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 4px;
  z-index: 10;
}
.wf-canvas-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 5;
}
.wf-editor-panel {
  width: 240px;
  min-width: 240px;
  padding: 12px;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}
.wf-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.wf-conn-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.wf-toml-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  color: var(--text);
  max-height: 400px;
  overflow-y: auto;
}
.flex-col { flex-direction: column; }
