/* ===== Reset ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

/* ===== Theme Variables ===== */
:root {
  --bg: #ffffff;
  --surface: #f5f5f5;
  --border: #d4d4d4;
  --text: #171717;
  --text-secondary: #404040;
  --text-muted: #737373;
  --primary: #171717;
  --primary-text: #ffffff;
  --accent: #71717a;
  --success: #171717;
  --success-soft: #52525b;
  --warning: #b45309;
  --error: #171717;
  --panel: #f5f5f5;
  --panel-alt: #ebebeb;
  --muted: #737373;
  --accent-soft: rgba(161, 161, 170, 0.15);
  --code-bg: #f5f5f5;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 5px;
  --radius-full: 74px;
  --sidebar-width: 260px;
  --sidebar-collapsed: 64px;
  --topbar-height: 48px;
  --transition: 0.15s ease;
  --selection-bg: rgba(161, 161, 170, 0.3);
  --caret-color: var(--text);
  --caret-width: 2px;
  --caret-style: line;
}

[data-theme='dark'] {
  --bg: #0A0A0C;
  --surface: #0F0F11;
  --border: #1A1A1E;
  --text: #D4D4D8;
  --text-secondary: #90909A;
  --text-muted: #5C5C66;
  --primary: #FFFFFF;
  --primary-text: #0F0F11;
  --accent: #a1a1aa;
  --success: #ffffff;
  --success-soft: #52525b;
  --warning: #f59e0b;
  --error: #ffffff;
  --panel: #0F0F11;
  --panel-alt: #1A1A1E;
  --muted: #5C5C66;
  --accent-soft: rgba(161, 161, 170, 0.1);
  --code-bg: #1A1A1D;
  --import-accent: #a1a1aa;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --selection-bg: rgba(161, 161, 170, 0.25);
  --caret-color: var(--text);
  --caret-width: 2px;
  --caret-style: line;
}

::selection {
  background: var(--selection-bg);
}

.selection-color-preview {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* ===== Base ===== */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Top Bar ===== */
.top-bar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--bg);
  border-bottom: none;
  flex-shrink: 0;
  z-index: 100;
}

.top-bar-left,
.top-bar-center,
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar-left {
  min-width: 200px;
}

.top-bar-right {
  min-width: 200px;
  justify-content: flex-end;
}

.brand {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 4px 10px;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-bar .btn {
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  line-height: 1;
}



.model-selector {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 2px 6px;
}

.model-selector .select-sm {
  font-size: 12px;
  padding: 3px 8px;
  max-width: 260px;
}

/* ===== Layout ===== */
.app-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  position: relative;
  margin-right: 0;
  transition: margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.right-open {
  margin-right: 260px;
}

.main-content.empty-chat {
  justify-content: center;
}

/* ===== Context Window Meter (bottom-right text) ===== */
.context-meter {
  position: fixed;
  bottom: 12px;
  right: 8px;
  z-index: 100;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ===== Vue Custom Elements ===== */
core-welcome,
core-chat {
  display: flex;
  flex: 1;
  min-height: 0;
}

core-composer {
  display: block;
  flex-shrink: 0;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 0;
  border-right: none;
  overflow: hidden;
}

.sidebar-header {
  padding: 48px 12px 8px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: none;
}

.sidebar-search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}

.sidebar-search:focus {
}

.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .thread-title,
.sidebar.collapsed .thread-time,
.sidebar.collapsed .new-chat-label,
.sidebar.collapsed .new-agent-btn {
  display: none;
}

.sidebar.collapsed .sidebar-header {
  padding: 12px 8px;
  align-items: center;
}

.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.new-chat-btn:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.sidebar.collapsed .new-chat-btn {
  padding: 7px;
  border-style: solid;
}

.sidebar-threads {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 8px 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  margin-bottom: 2px;
}

.sidebar-item:hover {
  background: var(--bg);
}

.sidebar-item.active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.sidebar-item.active .thread-title {
  color: var(--accent);
  font-weight: 500;
}

.thread-info {
  flex: 1;
  min-width: 0;
}

.thread-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.thread-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.thread-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.sidebar-item:hover .thread-actions {
  opacity: 1;
}

.thread-action-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition);
}

.thread-action-btn:hover {
  background: var(--border);
  color: var(--text);
}

.thread-action-btn.danger:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

/* Thread menu dropdown */
.thread-menu-trigger {
  position: relative;
}

.thread-menu-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 100;
  min-width: 140px;
  padding: 4px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

[data-theme='dark'] .thread-menu-dropdown {
  background: #1e1e22;
  border-color: rgba(255,255,255,0.08);
}

.thread-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.thread-menu-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.thread-menu-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.thread-menu-item:hover svg {
  opacity: 1;
}

.thread-menu-item.danger {
  color: var(--error, #ef4444);
}

.thread-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

.thread-menu-separator {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}

.sidebar-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== Chat / Messages ===== */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  scroll-behavior: smooth;
}

.messages-inner {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message {
  animation: fadeIn 0.2s ease;
}

.message.user {
  display: flex;
  justify-content: flex-end;
  padding: 4px 0;
  margin-right: 0;
}

.message.user .message-bubble {
  background: var(--primary-text);
  color: var(--primary);
  padding: 10px 14px;
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
  max-width: 80%;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.assistant {
  padding: 8px 0;
}

/* ===== Error Block in Assistant Message ===== */
.message-error-block {
  margin: 8px 0;
  padding: 10px 14px;
  border-left: none;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
}

.error-block-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.error-block-label {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.error-block-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
}

.error-retry-inline-btn {
  margin-top: 8px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.error-retry-inline-btn:hover {
  background: var(--border);
}

.message-content {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.message-role {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ===== Turn Plan ===== */
.turn-plan {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.plan-step-completed {
  color: var(--text);
}

.plan-step-completed .plan-step-icon svg {
  stroke: #4ade80;
}

.plan-step-in_progress {
  color: var(--text);
}

.plan-step-in_progress .plan-step-icon svg {
  stroke: var(--accent);
  animation: plan-spin 1.5s linear infinite;
}

.plan-step-pending .plan-step-icon svg {
  stroke: var(--text-muted);
  opacity: 0.5;
}

.plan-step-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.plan-step-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes plan-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.compaction-marker {
  text-align: center;
  padding: 8px 16px;
  margin: 12px 0;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ===== Diff View ===== */
.diff-view {
  margin: 6px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.diff-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  background: var(--surface);
  user-select: none;
}

.diff-header:hover {
  background: var(--bg);
}

.diff-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid var(--text-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform var(--transition);
}

.diff-chevron.expanded {
  transform: rotate(90deg);
}

.diff-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.diff-stats {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 10px;
}

.diff-body {
  border-top: 1px solid var(--border);
  max-height: 300px;
  overflow-y: auto;
}

.diff-line {
  padding: 1px 10px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

.diff-add {
  background: color-mix(in srgb, var(--success) 10%, transparent);
  color: var(--success);
}

.diff-del {
  background: color-mix(in srgb, var(--error) 10%, transparent);
  color: var(--error);
}

.diff-hunk {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text-muted);
  font-style: italic;
}

/* ===== Tool Image ===== */
.tool-image {
  max-width: 100%;
  max-height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 6px 0;
  display: block;
}

.message-usage {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-right: auto;
}

.usage-sep {
  opacity: 0.4;
}

/* ===== Typing Indicator ===== */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 8px 0;
}

.typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ===== Waiting Animation (iframe) ===== */
.waiting-animation-container {
  display: flex;
  align-items: flex-start;
  padding: 8px 0 16px;
  animation: fadeIn 0.3s ease;
}

.waiting-animation-frame {
  width: 280px;
  height: 180px;
  border: none;
  border-radius: var(--radius-md);
  overflow: hidden;
  opacity: 0.9;
}

/* ===== Composer ===== */
.composer {
  padding: 12px 24px 16px;
  background: transparent;
  flex-shrink: 0;
  position: relative;
}

.composer-panel {
  max-width: 768px;
  margin: 0 auto;
  transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px 12px 8px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
}

[data-theme='dark'] .composer-panel {
  background: rgba(26, 26, 30, 0.75);
  border-color: rgba(255,255,255,0.06);
}

.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.composer-attachments {
  max-width: 768px;
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px;
}

.composer-attachments .attachment-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 200px;
}

.composer-attachments .attachment-preview {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
}

.composer-attachments .attachment-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.composer-attachments .attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-attachments .attachment-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}

.composer-attachments .attachment-remove:hover {
  color: var(--text);
}

.composer .custom-textarea {
  flex: 1;
  resize: none;
  border: none;
  border-radius: 7499px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.2;
  color: var(--text);
  background: transparent;
  outline: none;
  max-height: 160px;
  min-height: 32px;
  transition: border-radius 0.2s ease;
}

.composer .custom-textarea.multi-line {
  border-radius: var(--radius-md);
}

.composer .custom-textarea:focus {
  outline: none;
}

.send-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: #1A1A1E;
  color: #FFFFFF;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter 0.15s ease;
}

[data-theme='dark'] .send-btn {
  background: #D0D0D8;
  color: #000000;
}

.send-btn:hover:not(:disabled) {
  filter: brightness(1.15);
}

.send-btn:disabled {
  background: inherit;
  color: inherit;
  cursor: pointer;
  opacity: 1;
}

[data-theme='dark'] .send-btn:disabled {
  background: inherit;
  color: inherit;
}

/* ===== Sub-agent Card ===== */
.sub-agent-card {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.sa-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s ease;
}

.sa-header:hover {
  background: var(--bg);
}

.sa-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--text-muted);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.sa-chevron.expanded {
  transform: rotate(90deg);
}

.sa-icon {
  flex-shrink: 0;
  color: var(--accent);
}

.sa-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

.sa-status-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.sa-status-badge.sa-done {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.sa-status-badge.sa-error {
  background: color-mix(in srgb, var(--error) 12%, transparent);
  color: var(--error);
}

.sa-meta {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
}

.sa-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  margin-left: 6px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sa-view-btn:hover {
  background: var(--border);
  color: var(--text);
}

.sa-body {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.sa-task {
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-style: italic;
}

.sa-output {
  max-height: 300px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* Sub-agent pulse animation for running state */
.sa-pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #8b949e);
  margin-right: 4px;
  vertical-align: middle;
  animation: sa-pulse-anim 1.5s ease-in-out infinite;
}

@keyframes sa-pulse-anim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Sub-agent preview (collapsed state) */
.sa-preview {
  position: relative;
  padding: 6px 12px 12px;
  max-height: 80px;
  overflow: hidden;
  cursor: pointer;
}

.sa-preview-text {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.sa-preview-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(to bottom, transparent, var(--surface));
  pointer-events: none;
}

/* Expanded state styling */
.sub-agent-card.sa-expanded .sa-header {
  border-bottom: 1px solid var(--border);
}

/* ===== Tool Call ===== */
.tool-call {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.tool-call-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
  font-size: 12px;
}

.tool-call-header:hover {
  background: var(--bg);
}

.tool-call-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid var(--text-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.tool-call-chevron.expanded {
  transform: rotate(90deg);
}

.tool-call-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

.tool-call-status {
  margin-left: auto;
}

.tool-call-body {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  animation: slideUp 0.15s ease;
}

.tool-call-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.tool-call-args,
.tool-call-output {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-secondary);
  margin-bottom: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.tool-call-output:last-child {
  margin-bottom: 0;
}

/* --- Tool call type-specific styles --- */

.tool-call-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tool-call-summary {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

.tool-code-block {
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 6px 0;
  overflow-x: auto;
}

.tool-code-block pre {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}

.tool-expand-hint {
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 0 0;
  user-select: none;
}

.tool-expand-hint:hover {
  text-decoration: underline;
}

.tool-collapse-hint {
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
}

.tool-collapse-hint:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.tool-file-path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.tool-file-path .path-dir {
  color: var(--text-muted);
}

.tool-file-path .path-file {
  color: var(--accent);
  font-weight: 500;
}

.tool-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-right: 6px;
}

.tool-match-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}

/* Shell */
.tool-call-shell .tool-shell-cmd {
  margin-top: 0;
}

.tool-shell-exit {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin: 4px 0;
}

.tool-shell-exit.exit-ok {
  background: rgba(46, 160, 67, 0.15);
  color: #3fb950;
}

.tool-shell-exit.exit-fail {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
}

.tool-shell-output {
  background: #0d1117;
}

.tool-shell-output pre {
  color: #c9d1d9;
}

/* Read */
.tool-call-read .tool-read-content {
  max-height: 500px;
  overflow-y: auto;
}

/* Write / Edit */
.tool-write-diff-stats {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  margin-bottom: 6px;
  display: flex;
  gap: 10px;
}

.tool-write-diff-stats .diff-add {
  color: #3fb950;
  font-weight: 500;
}

.tool-write-diff-stats .diff-del {
  color: #f85149;
  font-weight: 500;
}

.tool-call-write .tool-write-content {
  max-height: 400px;
  overflow-y: auto;
}

/* Grep / Search */
.tool-grep-pattern {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.tool-grep-pattern code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--accent);
}

.tool-match-list {
  max-height: 400px;
  overflow-y: auto;
}

.tool-match-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  padding: 2px 0;
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.tool-match-line .match-file {
  color: var(--accent);
  flex-shrink: 0;
}

.tool-match-line .match-lineno {
  color: var(--text-muted);
  min-width: 30px;
  text-align: right;
  flex-shrink: 0;
}

.tool-match-line .match-text {
  color: var(--text-secondary);
  word-break: break-all;
}

.tool-match-line .match-text mark {
  background: rgba(210, 153, 34, 0.3);
  color: var(--text);
  border-radius: 2px;
  padding: 0 1px;
}

/* Glob / Find */
.tool-glob-pattern {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.tool-glob-pattern code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--accent);
}

.tool-file-list {
  max-height: 300px;
  overflow-y: auto;
}

.tool-file-item {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-secondary);
  padding: 1px 0;
}

.tool-file-item::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-right: 8px;
  vertical-align: middle;
  opacity: 0.5;
}

/* Web Search */
.tool-web-query {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 6px;
  font-weight: 500;
}

.tool-call-web_search .tool-web-results {
  max-height: 400px;
  overflow-y: auto;
}

/* Web Fetch */
.tool-fetch-url {
  margin-bottom: 6px;
}

.tool-fetch-url a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
}

.tool-fetch-url a:hover {
  text-decoration: underline;
}

.tool-call-web_fetch .tool-fetch-content {
  max-height: 400px;
  overflow-y: auto;
}

/* Expand/collapse transition */
.tool-expand-enter-active,
.tool-expand-leave-active {
  transition: all 0.2s ease;
  overflow: hidden;
}

.tool-expand-enter-from,
.tool-expand-leave-to {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.tool-expand-enter-to,
.tool-expand-leave-from {
  opacity: 1;
  max-height: 2000px;
}

/* ===== Approval ===== */
.approval-card {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 14px 16px;
  animation: slideUp 0.2s ease;
}

.approval-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--warning);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.approval-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.approval-detail code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
}

.approval-args {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 8px 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-secondary);
  max-height: 160px;
  overflow-y: auto;
}

.approval-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.approval-feedback {
  margin-top: 8px;
}

.approval-feedback-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 48px;
}

.approval-feedback-input:focus {
  outline: none;
}

.approval-options {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.approval-option-btn {
  padding: 4px 12px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
}

.approval-option-btn.active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--accent);
}

.approval-option-btn:hover {
  color: var(--text);
  background: var(--accent-soft);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fadeIn 0.15s ease;
  backdrop-filter: blur(2px);
  pointer-events: auto;
  cursor: default;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 66.67vw;
  height: 66.67vh;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: row;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
  overflow: hidden;
}

/* ===== Settings Sidebar ===== */
.settings-sidebar {
  width: 33.33%;
  min-width: 180px;
  max-width: 260px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--bg);
}
.settings-sidebar-header {
  padding: 18px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.settings-sidebar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.settings-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: all var(--transition);
  margin-bottom: 2px;
}
.settings-nav-item:hover {
  background: var(--border);
  color: var(--text);
}
.settings-nav-item.active {
  background: var(--border);
  color: var(--text);
  font-weight: 500;
}
.settings-nav-item svg {
  flex-shrink: 0;
  color: var(--text-muted);
}
.settings-nav-item.active svg {
  color: var(--text);
}

/* ===== Settings Main Content ===== */
.settings-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.settings-main-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.settings-main-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.settings-main-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.settings-main-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Legacy modal classes kept for non-settings modals */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ===== Settings Sections ===== */
.settings-section {
  margin-bottom: 24px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.provider-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: all var(--transition);
}

.provider-item:hover {
}

.provider-name {
  font-weight: 500;
  font-size: 13px;
}

.provider-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.provider-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

/* ===== Skill Toggle Switch ===== */
.skill-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
}

.skill-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.skill-toggle-slider {
  position: absolute;
  inset: 0;
  background: #4a4a4e;
  border: 1px solid #5a5a5e;
  border-radius: 11px;
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-toggle input:checked + .skill-toggle-slider {
  background: #ffffff;
  border-color: #ffffff;
}

.skill-toggle input:checked + .skill-toggle-slider::before {
  transform: translateX(18px);
  background: #0f0f11;
}

[data-theme='light'] .skill-toggle-slider {
  background: #c8c8ca;
  border-color: #b0b0b2;
}

[data-theme='light'] .skill-toggle-slider::before {
  background: #ffffff;
}

[data-theme='light'] .skill-toggle input:checked + .skill-toggle-slider {
  background: #1a1a1c;
  border-color: #1a1a1c;
}

[data-theme='light'] .skill-toggle input:checked + .skill-toggle-slider::before {
  background: #ffffff;
}

.field:has(.skill-toggle) {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field:has(.skill-toggle) .field-label {
  margin-bottom: 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

.btn-primary:hover {
  box-shadow: var(--shadow-md);
}

.btn-danger {
  color: var(--error);
  border-color: color-mix(in srgb, var(--error) 30%, transparent);
}

.btn-danger:hover {
  background: rgba(255,255,255,0.06);
}

.btn-success {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

.btn-success:hover {
  background: color-mix(in srgb, var(--success) 8%, transparent);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover {
  background: var(--bg);
  box-shadow: none;
  transform: none;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ===== Inputs ===== */
.input, .select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  caret-color: var(--text);
  cursor: text;
}

/* Disable all focus highlights globally for inputs */
input:focus, input:focus-visible,
textarea:focus, textarea:focus-visible,
select:focus, select:focus-visible,
[contenteditable]:focus, [contenteditable]:focus-visible,
.custom-textarea:focus, .custom-textarea:focus-visible,
.custom-input:focus, .custom-input:focus-visible,
.input:focus, .input:focus-visible,
.select:focus, .select:focus-visible,
.search-input:focus, .search-input:focus-visible,
.confirm-input:focus, .confirm-input:focus-visible,
.fb-search-input:focus, .fb-search-input:focus-visible,
.fb-dialog-input:focus, .fb-dialog-input:focus-visible,
.bv-url-input:focus, .bv-url-input:focus-visible,
.user-input-other-field:focus, .user-input-other-field:focus-visible,
.sa-followup-input:focus, .sa-followup-input:focus-visible,
.ms-search:focus, .ms-search:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border-color: var(--border) !important;
  transition: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* Strip native browser appearance from all form elements */
input:not([type="button"]):not([type="submit"]):not([type="reset"]),
textarea,
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Custom cursor for all interactive input elements */
input, textarea, select, [contenteditable="true"] {
  caret-color: var(--text);
  cursor: text;
}

input[type="button"], input[type="submit"], input[type="reset"], button {
  cursor: pointer;
}

/* Custom textarea replacement using contenteditable div */
.custom-textarea {
  flex: 1;
  min-height: 40px;
  max-height: 200px;
  overflow-y: auto;
  padding: 14px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.2;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  resize: none;
}

.custom-textarea:focus,
.custom-textarea:focus-visible,
.custom-textarea:active {
  border-color: var(--border) !important;
  outline: none !important;
  box-shadow: none !important;
}

.custom-textarea:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

/* Custom range slider */
.custom-range-slider {
  position: relative;
  width: 100px;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.custom-range-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.custom-range-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.custom-range-thumb {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--text);
  border-radius: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.select, select {
  cursor: pointer;
}

.select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.field {
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-green {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.badge-red {
  background: color-mix(in srgb, var(--error) 12%, transparent);
  color: var(--error);
}

.badge-blue {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.badge-yellow {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  color: var(--warning);
}

.badge-gray {
  background: var(--code-bg);
  color: var(--text-muted);
}

/* ===== Utilities ===== */
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mono { font-family: 'JetBrains Mono', monospace; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; gap: 8px; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ===== Code Blocks ===== */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.6;
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
}

p code, li code, td code {
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* ===== Markdown Content ===== */
.md-content h1 { font-size: 20px; font-weight: 700; margin: 16px 0 8px; }
.md-content h2 { font-size: 17px; font-weight: 600; margin: 14px 0 6px; }
.md-content h3 { font-size: 15px; font-weight: 600; margin: 12px 0 6px; }
.md-content h4 { font-size: 13px; font-weight: 600; margin: 10px 0 4px; }

.md-content p {
  margin: 6px 0;
}

.md-content ul, .md-content ol {
  margin: 6px 0;
  padding-left: 20px;
}

.md-content li {
  margin: 3px 0;
}

.md-content blockquote {
  border-left: 3px solid var(--border);
  padding: 4px 12px;
  margin: 8px 0;
  color: var(--text-secondary);
}

.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12px;
}

.md-content th, .md-content td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.md-content th {
  background: var(--code-bg);
  font-weight: 600;
}

.md-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

.md-content a {
  color: var(--accent);
  text-decoration: none;
}

.md-content a:hover {
  text-decoration: underline;
}

.md-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast-container .toast {
  pointer-events: auto;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  color: var(--text);
  animation: slideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-warning {
  background: var(--warning);
  color: #1a1a1a;
  border-color: var(--warning);
}

.toast-exit {
  animation: fadeOut 0.2s ease forwards;
}

/* ===== Confirm Dialog ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  animation: fadeIn 0.15s ease;
}

.confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  width: 380px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

.confirm-message {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  color: var(--text);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.confirm-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 10px;
}

.confirm-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.confirm-input:focus {
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 8px;
  padding: 40px;
}

.empty-state-icon {
  font-size: 32px;
  opacity: 0.4;
}

.empty-state-text {
  font-size: 13px;
}

/* ===== Responsive (wide-mode only; narrow uses page layout via JS) ===== */
@media (max-width: 768px) {
  body:not(.narrow-active) .messages-inner {
    padding: 0 12px;
  }

  body:not(.narrow-active) .composer {
    padding: 8px 12px 12px;
  }

  body:not(.narrow-active) .message.user .message-bubble {
    max-width: 90%;
  }
}

/* ===== Custom Select ===== */
.custom-select {
  position: relative;
  display: inline-block;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}

.custom-select-trigger:hover {
}

.custom-select-open .custom-select-trigger {
}

.custom-select-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.custom-select-arrow {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
  flex-shrink: 0;
  font-style: normal;
  transition: transform var(--transition);
}

.custom-select-open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  max-height: 240px;
  overflow-y: auto;
  animation: slideUp 0.15s ease;
}

.custom-select-option {
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}

.custom-select-option:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.custom-select-option.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-weight: 500;
}

.custom-select-empty {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.custom-select-sm .custom-select-trigger {
  font-size: 12px;
  padding: 3px 8px;
}

.custom-select-sm {
  max-width: 260px;
}

/* ===== Collapsible ===== */
.collapsible {
  border: none;
}

.collapsible-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  user-select: none;
  padding: 2px 0;
}

.collapsible-header em {
  font-style: normal;
}

.collapsible-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid var(--text-muted);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.collapsible-arrow.expanded {
  transform: rotate(90deg);
}

.collapsible-body {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.reasoning-block .collapsible-body {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== Top Left Actions ===== */
.top-left-actions {
  position: fixed;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 200;
}

/* ===== Top Actions (Right Corner) ===== */
.top-actions {
  position: fixed;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 201;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Right panel is now a modal overlay; top-actions no longer shift */

.top-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.top-action-btn:hover {
  background: var(--surface);
  color: var(--text);
}



/* ===== Keyboard Shortcuts Help Panel ===== */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  backdrop-filter: blur(2px);
}

.shortcuts-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.shortcuts-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.shortcuts-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  transition: background var(--transition), color var(--transition);
}

.shortcuts-close:hover {
  background: var(--border);
  color: var(--text);
}

.shortcuts-body {
  padding: 16px 20px;
  overflow-y: auto;
}

.shortcuts-group {
  margin-bottom: 20px;
}

.shortcuts-group:last-child {
  margin-bottom: 0;
}

.shortcuts-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.shortcut-keys {
  display: flex;
  align-items: center;
  gap: 4px;
}

.shortcut-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.shortcut-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.drive-loading:hover,
.drive-empty:hover {
  background: transparent;
}

/* ===== Welcome Page ===== */
.welcome-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  gap: 16px;
  overflow-y: auto;
}

.welcome-input-panel {
  width: calc((100vw - var(--left-sidebar-width, 0px) - var(--right-sidebar-width, 0px)) * 0.6);
  max-width: 900px;
  min-width: 420px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  align-self: center;
  background: rgba(var(--surface-rgb, 255,255,255), 0.75);
  border: 1px solid rgba(var(--border-rgb, 200,200,200), 0.3);
  border-radius: 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

[data-theme='dark'] .welcome-input-panel {
  background: rgba(26, 26, 30, 0.75);
  border-color: rgba(255,255,255,0.06);
  box-shadow: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* New input layout structure */
.welcome-input-panel .input-main {
  display: flex;
  flex-direction: column;
}

.welcome-input-panel .input-row {
  display: flex;
  align-items: flex-start;
  padding: 14px 16px 2px;
  gap: 8px;
}

.welcome-input-panel .input-right-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.welcome-input-panel .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.welcome-input-panel .icon-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

/* Attachment preview area (bottom edge card) */
.welcome-input-panel .attachment-preview-area {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
}

.welcome-input-panel .attachment-preview-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 6px 10px;
  max-width: 200px;
}

.welcome-input-panel .attachment-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.welcome-input-panel .attachment-label {
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.welcome-input-panel .attachment-preview-card .attachment-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.welcome-input-panel .attachment-preview-card .attachment-remove:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

/* Bottom bar with plus button, model selector, and send button */
.welcome-input-panel .input-bottom-bar,
.composer .input-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 12px;
}

.welcome-input-panel .bottom-left,
.composer .bottom-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.welcome-input-panel .bottom-right,
.composer .bottom-right {
  display: flex;
  align-items: center;
  gap: 4px;
}



/* Send button inside input panel */
.welcome-input-panel .bottom-right .send-btn,
.composer .bottom-right .send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #1A1A1E;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme='dark'] .welcome-input-panel .bottom-right .send-btn,
[data-theme='dark'] .composer .bottom-right .send-btn {
  background: #D0D0D8;
  color: #000000;
}

.welcome-input-panel .bottom-right .send-btn:hover:not(:disabled),
.composer .bottom-right .send-btn:hover:not(:disabled) {
  filter: brightness(1.15);
}

.welcome-input-panel .bottom-right .send-btn:disabled,
.composer .bottom-right .send-btn:disabled {
  opacity: 1;
  cursor: pointer;
}

/* Thread rename input in sidebar */
.thread-rename-input {
  width: 100%;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.welcome-input-panel .input-row .custom-textarea {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  min-height: 80px;
  max-height: 200px;
  padding: 0;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  resize: none;
}

.welcome-input-panel .input-row .custom-textarea::-webkit-scrollbar {
  display: none;
}

.welcome-input-panel .input-row .custom-textarea:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.welcome-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 10px;
}

.welcome-toolbar .plus-btn {
  border: none !important;
  background: transparent !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
  padding: 8px;
  border-radius: 6px;
}

.welcome-toolbar .plus-btn:hover {
  color: var(--text) !important;
  background: rgba(255,255,255,0.06) !important;
}

.model-selector-container .custom-dropdown-trigger:hover {
}

.welcome-toolbar .send-btn {
  margin-left: auto;
  background: #1A1A1E !important;
  color: #FFFFFF !important;
  border-radius: 50% !important;
  opacity: 1 !important;
  transform: none !important;
  box-shadow: none !important;
  cursor: pointer !important;
  width: 32px !important;
  height: 32px !important;
}

[data-theme='dark'] .welcome-toolbar .send-btn {
  background: #D0D0D8 !important;
  color: #000000 !important;
}

.welcome-toolbar .send-btn svg {
  stroke-width: 3.5;
}

.welcome-toolbar .send-btn:disabled {
  background: inherit !important;
  color: inherit !important;
  cursor: pointer !important;
  opacity: 1 !important;
}

[data-theme='dark'] .welcome-toolbar .send-btn:disabled {
  background: inherit !important;
  color: inherit !important;
}

.welcome-toolbar .send-btn:hover:not(:disabled) {
  background: #2A2A2E !important;
  filter: brightness(1.15);
}

[data-theme='dark'] .welcome-toolbar .send-btn:hover:not(:disabled) {
  background: #E0E0E8 !important;
  filter: brightness(1.08);
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.plus-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.ask-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--success-soft);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}

.ask-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ask-btn:not(:disabled):hover {
  filter: brightness(1.1);
}

.ask-close {
  opacity: 0.7;
}

.model-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.model-indicator:hover {
  background: var(--surface);
}

.model-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.model-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mic-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.mic-btn:hover {
  background: var(--surface);
  color: var(--text);
}

/* ===== Shortcut List ===== */
.shortcut-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.shortcut-item:hover {
  background: var(--surface);
}

.shortcut-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.shortcut-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shortcut-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.shortcut-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.shortcut-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition);
}

.shortcut-item:hover .shortcut-arrow {
  opacity: 1;
}

/* ===== Import Section ===== */
.import-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
  width: 100%;
}

.import-section:hover {
  background: var(--surface);
}

.import-icons {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.import-sparkle {
  color: var(--import-accent);
}

.import-cube {
  color: var(--text-muted);
}

.import-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.import-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.import-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== Loading Overlay ===== */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #0F0F11);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-icon {
  width: 200px;
  height: 200px;
  max-width: 40vw;
  max-height: 40vh;
  color: var(--text, #FFFFFF);
  opacity: 0.85;
}

[data-theme='light'] .loading-icon {
  opacity: 0.75;
}

/* ===== New Agent Button ===== */
/* ===== New Agent Button (Sidebar) ===== */
.new-agent-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.new-agent-btn:hover {
  background: var(--border);
}

.new-agent-btn svg {
  flex-shrink: 0;
}

.sidebar-search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.sidebar-search-btn:hover {
  background: var(--border);
}

.sidebar-search-btn svg {
  flex-shrink: 0;
}

/* ===== Message Action Buttons ===== */
.msg-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}

.msg-action-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.regenerate-btn {
}

.undo-btn {
}

.msg-actions-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.copy-btn {
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.copy-btn:hover {
  opacity: 1;
}

/* ===== Thread Preview (Search Results) ===== */
.thread-preview {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Cancel Edit Button ===== */
.cancel-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  font-size: 12px;
  transition: color var(--transition);
}

.cancel-edit-btn:hover {
  color: var(--text);
}

/* ===== Search Button ===== */
.search-btn {
  border-radius: 50%;
}

/* ===== Search Overlay ===== */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.15s ease;
}

.search-dialog {
  width: 66.67vw;
  height: 66.67vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

.search-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  flex-shrink: 0;
}

.search-divider {
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

.search-dialog-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.search-input {
  flex: 1;
  border: none !important;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none !important;
  box-shadow: none !important;
  min-width: 0;
  padding: 10px 0;
}

.search-input:focus,
.search-input:focus-visible,
.search-input:active {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-close-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.search-close-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.search-results {
  flex: 1;
  overflow-y: auto;
  max-height: calc(70vh - 52px);
}

.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition);
}

.search-result-item:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.search-result-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.search-result-preview {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-meta {
  font-size: 10px;
  color: var(--text-muted);
}

.search-empty,
.search-hint {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Right Panel ===== */
/* Right panel modal content (reuses .modal-overlay + .modal-content from settings) */
.rp-close-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.right-panel-modal {
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
  position: relative;
  z-index: 2;
}



/* ===== Terminal ===== */
.terminal-container {
  flex: 1;
  padding: 8px;
  overflow: hidden;
  background: var(--bg);
}

.terminal-container .xterm {
  height: 100%;
}

/* ===== File Browser ===== */
.file-browser {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.file-browser-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.file-browser-back {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.file-browser-back:hover:not(:disabled) {
  background: var(--border);
  color: var(--text);
}

.file-browser-back:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.file-browser-path {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-browser-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.file-browser-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background var(--transition);
}

.file-browser-item:hover {
  background: var(--bg);
}

.file-browser-item.is-dir {
  color: var(--text);
}

.file-browser-item svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.file-browser-item.is-dir svg {
  color: var(--accent);
}

.file-browser-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-browser-loading,
.file-browser-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}/* ===== File Browser ===== */
.fb-root { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.fb-breadcrumb { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow-x: auto; flex-shrink: 0; display: flex; align-items: center; }
.fb-crumb { cursor: pointer; display: inline-flex; align-items: center; }
.fb-crumb:hover .fb-crumb-name { color: var(--text); text-decoration: underline; }
.fb-crumb-sep { margin: 0 4px; color: var(--text-muted); }
.fb-toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.fb-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition); flex-shrink: 0; }
.fb-btn:hover { background: var(--border); color: var(--text); }
.fb-search-input { flex: 1; min-width: 0; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 12px; font-family: inherit; outline: none; caret-color: var(--text); }
.fb-search-input:focus { }
.fb-body { flex: 1; overflow-y: auto; padding: 4px 0; }
.fb-loading, .fb-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 12px; }
.fb-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer; transition: background var(--transition); font-size: 13px; position: relative; }
.fb-item:hover { background: var(--surface); }
.fb-item svg { flex-shrink: 0; color: var(--text-muted); }
.fb-item.is-dir svg { color: var(--accent); }
.fb-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.fb-item-size { font-size: 11px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; flex-shrink: 0; }
.fb-item-path { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.fb-item-menu-btn { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-muted); border-radius: 4px; cursor: pointer; opacity: 0; transition: all var(--transition); flex-shrink: 0; }
.fb-item:hover .fb-item-menu-btn { opacity: 1; }
.fb-item-menu-btn:hover { background: var(--border); color: var(--text); }
.fb-context-menu { position: fixed; z-index: 1000; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: none; min-width: 120px; padding: 4px 0; animation: fadeIn 0.1s ease; }
.fb-menu-item { padding: 6px 12px; font-size: 12px; color: var(--text); cursor: pointer; transition: background var(--transition); }
.fb-menu-item:hover { background: var(--bg); }
.fb-menu-danger { color: var(--error); }
.fb-menu-danger:hover { background: rgba(255,255,255,0.06); }
.fb-dialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 2000; animation: fadeIn 0.15s ease; backdrop-filter: blur(2px); }
.fb-dialog { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 480px; max-width: 90vw; max-height: 80vh; display: flex; flex-direction: column; box-shadow: none; animation: slideUp 0.2s ease; }
.fb-dialog-title { padding: 14px 16px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.fb-dialog-preview { padding: 12px 16px; flex: 1; min-height: 200px; }
.fb-preview-content { width: 100%; height: 300px; resize: vertical; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--code-bg); color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.5; outline: none; caret-color: var(--text); }
.fb-dialog-message { padding: 16px; font-size: 13px; color: var(--text); line-height: 1.5; }
.fb-dialog-input-wrap { padding: 12px 16px; }
.fb-dialog-input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 13px; font-family: inherit; outline: none; caret-color: var(--text); }
.fb-dialog-input:focus { }
.fb-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }
.fb-btn-secondary { padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 12px; font-family: inherit; cursor: pointer; transition: all var(--transition); }
.fb-btn-secondary:hover { background: var(--surface); }
.fb-btn-primary { padding: 6px 14px; border: 1px solid var(--primary); border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-text); font-size: 12px; font-family: inherit; cursor: pointer; transition: all var(--transition); }
.fb-btn-primary:hover { opacity: 0.9; }

/* ===== Terminal Multi-Tab ===== */
.term-root { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
/* Terminal internal tabs removed -- tabs managed by right_panel */
.term-body { flex: 1; position: relative; overflow: hidden; background: #0A0A0C; }
.term-pane { position: absolute; inset: 0; padding: 4px; }
.term-status { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; flex-shrink: 0; transition: background var(--transition); }
.term-status-ok { background: var(--success); }
.term-status-err { background: var(--error); }
.term-ctx-menu { position: fixed; z-index: 9999; min-width: 140px; padding: 4px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; box-shadow: none; font-size: 12px; color: var(--text-muted); user-select: none; }
.term-ctx-item { padding: 6px 14px; cursor: pointer; transition: background 0.1s; white-space: nowrap; }
.term-ctx-item:hover { background: var(--border); color: var(--text); }
.term-ctx-sep { height: 1px; margin: 4px 8px; background: var(--border); }
.xterm a { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.xterm a:hover { text-decoration-style: solid; }
/* ===== Right Panel Dynamic Tabs ===== */
.rp-empty-state { display: flex; align-items: center; justify-content: center; height: 100%; }
.rp-add-large { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius-md); background: transparent; color: var(--text-muted); cursor: pointer; transition: all var(--transition); }
.rp-add-large:hover { color: var(--text); background: var(--surface); }
.rp-tab-bar { display: flex; align-items: center; gap: 0; padding: 0 8px; border-bottom: 1px solid var(--border); background: var(--bg); flex-shrink: 0; height: 36px; overflow-x: auto; }

/* Vertical tab bar */
.rp-tab-bar-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  width: 44px;
  overflow-y: auto;
}

.rp-tab-v {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  flex-shrink: 0;
}

.rp-tab-v:hover {
  color: var(--text);
  background: var(--surface);
}

.rp-tab-v.active {
  color: var(--text);
  background: var(--surface);
}

.rp-tab-v.active::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.rp-tab-v .rp-tab-icon svg {
  width: 16px;
  height: 16px;
}

.rp-tab-v .rp-tab-close {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  font-size: 10px;
  opacity: 0;
  transition: opacity var(--transition);
}

.rp-tab-v:hover .rp-tab-close {
  opacity: 1;
}

.rp-add-btn-v {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  margin-top: 4px;
}

.rp-add-btn-v:hover {
  color: var(--text);
  background: var(--surface);
}
.rp-tab-spacer { flex: 1; min-width: 0; }
.rp-add-wrapper { position: relative; display: flex; align-items: center; margin-left: auto; flex-shrink: 0; }
.rp-tab { display: flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 12px; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all var(--transition); white-space: nowrap; user-select: none; max-width: 160px; }
.rp-tab:hover { color: var(--text); background: var(--surface); }
.rp-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.rp-tab-icon { display: flex; align-items: center; flex-shrink: 0; }
.rp-tab-icon svg { width: 12px; height: 12px; }
.rp-tab-title { overflow: hidden; text-overflow: ellipsis; }
.rp-tab-close { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-muted); border-radius: 3px; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; transition: all var(--transition); flex-shrink: 0; }
.rp-tab-close:hover { background: var(--border); color: var(--text); }
.rp-tab-add { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; font-size: 16px; line-height: 1; margin-left: 4px; transition: all var(--transition); flex-shrink: 0; }
.rp-tab-add:hover { background: var(--border); color: var(--text); }
.rp-content { flex: 1; min-height: 0; overflow: hidden; position: relative; }
.rp-selector-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center; z-index: 10; backdrop-filter: blur(2px); animation: fadeIn 0.15s ease; }
.rp-selector { display: flex; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: none; }
.rp-selector-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); color: var(--text); cursor: pointer; transition: all var(--transition); font-size: 12px; font-family: inherit; min-width: 80px; }
.rp-selector-item:hover { background: var(--surface); transform: translateY(-1px); }
.rp-selector-item svg { color: var(--text-secondary); }/* ===== Halved Input Border Radius ===== */
input, textarea, select,
.input, .select,
.sidebar-search,
.search-input,
.fb-search-input,
.fb-dialog-input,
.fb-preview-content {
  border-radius: 3px;
}

.composer textarea {
  border-radius: 4px;
}

/* ===== Browser View ===== */
.bv-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}

.bv-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.bv-nav-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.bv-nav-btn:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.bv-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.bv-url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.bv-url-input {
  flex: 1;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.bv-url-input:focus {
}

.bv-url-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.bv-go-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity var(--transition);
  flex-shrink: 0;
}

.bv-go-btn:hover {
  opacity: 0.85;
}

.bv-content {
  flex: 1;
  position: relative;
  min-height: 0;
}

.bv-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.bv-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg);
  z-index: 1;
}

.bv-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: bv-spin 0.8s linear infinite;
}

@keyframes bv-spin {
  to { transform: rotate(360deg); }
}

.bv-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg);
  z-index: 2;
}/* ===== Right Panel Header (+ Button Top-Left) ===== */
.rp-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.rp-add-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.rp-add-btn:hover {
  background: var(--border);
  color: var(--text);
}

.rp-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.rp-empty-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.rp-selector-inline {
  display: flex;
  gap: 12px;
  padding: 16px;
}

.rp-selector-inline .rp-selector-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 12px;
  font-family: inherit;
  min-width: 80px;
}

.rp-selector-inline .rp-selector-item:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.rp-selector-inline .rp-selector-item svg {
  color: var(--text-secondary);
}/* ===== Right Panel Resize Handle ===== */
.rp-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  z-index: 20;
  transition: background 0.15s ease;
}
.rp-resize-handle:hover,
.rp-resize-handle:active {
  background: var(--accent);
}/* ===== Right Panel Add Menu (Inline) ===== */
.rp-add-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  gap: 8px;
  padding: 8px;
  margin-top: 4px;
}
.rp-add-menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  transition: all var(--transition);
  white-space: nowrap;
}
.rp-add-menu-item:hover {
  background: var(--border);
}
.rp-add-menu-item svg {
  color: var(--text-secondary);
  flex-shrink: 0;
}/* ===== Model Selector (Welcome Toolbar) ===== */
.model-selector-container {
  display: inline-flex;
  align-items: center;
  margin: 0 4px;
  min-width: 240px;
  max-width: 480px;
}
.model-selector-container .custom-dropdown {
  width: auto;
  min-width: 480px;
  max-width: 960px;
}
.model-selector-container .custom-dropdown-trigger {
  min-height: 20px !important;
  padding: 2px 6px !important;
  font-size: 15px !important;
  border: none !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
  border-radius: var(--radius-sm) !important;
  gap: 3px !important;
  box-shadow: none !important;
}
.model-selector-container .custom-dropdown-trigger:hover {
  background: transparent !important;
  color: var(--text-secondary) !important;
  border: none !important;
  box-shadow: none !important;
}
.model-selector-container .custom-dropdown-trigger:focus-visible,
.model-selector-container .custom-dropdown-trigger[aria-expanded="true"] {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
}
.model-selector-container .custom-dropdown-chevron {
  width: 7px;
  height: 7px;
}
.model-selector-container .custom-dropdown-search {
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  font-size: 10px;
  padding: 3px 5px;
  border-radius: 0;
  outline: none !important;
  box-shadow: none !important;
}
.model-selector-container .custom-dropdown-search:focus,
.model-selector-container .custom-dropdown-search:focus-visible,
.model-selector-container .custom-dropdown-search:active {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}
.model-selector-container .custom-dropdown-list {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 4px;
}
.model-selector-container .custom-dropdown-option {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  line-height: 1.3;
}
.model-selector-container .custom-dropdown-option:hover,
.model-selector-container .custom-dropdown-option[data-highlighted="true"] {
  background: var(--border);
}
.model-selector-container .custom-dropdown-option[aria-selected="true"] {
  background: transparent;
  color: var(--accent);
  font-weight: 500;
}
.model-selector-wrap {
  position: relative;
}
.model-selector-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  transition: all var(--transition);
  white-space: nowrap;
}
.model-selector-btn:hover {
  background: var(--border);
  color: var(--text);
}
.model-selector-btn .model-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.model-selector-btn .model-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  padding: 4px 0;
  animation: fadeIn 0.12s ease;
}
.model-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: background var(--transition);
  text-align: left;
}
.model-dropdown-item:hover {
  background: var(--border);
}
.model-dropdown-item.active {
  color: var(--accent);
}
.model-dropdown-item svg {
  flex-shrink: 0;
  color: var(--accent);
}/* ===== Toast Copy Button ===== */
.toast-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  flex-shrink: 0;
  padding: 0;
}
.toast-copy-btn:hover {
  background: var(--border);
  color: var(--text);
}
.toast-copy-btn.copied {
  color: var(--success);
}

/* ===== Error Dialog ===== */
.error-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100001;
  animation: fadeIn 0.15s ease;
  backdrop-filter: blur(2px);
}
.error-dialog-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 66.67vw;
  height: 66.67vh;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.error-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.error-dialog-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--error, #e5484d);
}
.error-dialog-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 18px;
  line-height: 1;
  transition: all var(--transition);
}
.error-dialog-close:hover {
  background: var(--border);
  color: var(--text);
}
.error-dialog-content {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  tab-size: 2;
}
.error-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.error-dialog-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.error-dialog-copy-btn svg {
  flex-shrink: 0;
}
.error-dialog-copy-btn.copied {
  color: var(--success);
}

/* ===== User Input Request Card ===== */
.user-input-overlay {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  animation: user-input-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes user-input-slide-up {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.user-input-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  min-width: 360px;
  max-width: 520px;
  box-shadow: none;
}
.user-input-card.submitted {
  opacity: 0.5;
  pointer-events: none;
}
.user-input-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.user-input-header svg {
  flex-shrink: 0;
  color: var(--text-muted);
}
.user-input-questions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.user-input-question {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.user-input-q-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
}
.user-input-q-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}
.user-input-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-input-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  transition: all 0.15s ease;
}
.user-input-option:hover:not(.disabled) {
  background: var(--bg-tertiary);
}
.user-input-option.selected {
  background: var(--accent-bg, rgba(255,255,255,0.08));
  border-color: var(--text);
}
.user-input-option.disabled {
  cursor: default;
  opacity: 0.6;
}
.option-label {
  font-weight: 500;
}
.option-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}
.user-input-other-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-input-other-field {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.user-input-other-field:focus {
}
.user-input-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.user-input-submit-btn {
  padding: 6px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.user-input-submit-btn:hover:not(:disabled) {
  opacity: 0.85;
}
.user-input-submit-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ===== Model Config Editor ===== */
.model-config-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 2px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  width: fit-content;
}
.model-config-toggle .btn {
  padding: 4px 16px;
  font-size: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}
.model-config-toggle .btn.active {
  background: var(--bg-primary);
  color: var(--text);
  box-shadow: none;
}
.model-config-toggle .btn:hover:not(.active) {
  color: var(--text);
}
.model-config-editor {
  width: 100%;
  min-height: 400px;
  max-height: calc(85vh - 200px);
  padding: 12px 16px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  resize: vertical;
  outline: none;
  tab-size: 2;
  white-space: pre;
  overflow-x: auto;
}
.model-config-editor:focus {
}
.model-config-error {
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  word-break: break-word;
}

/* ========================================================================== */
/* Paint View Component                                                       */
/* ========================================================================== */

.paint-view-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.paint-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--bg-primary, #0F0F11);
}

.paint-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 10px;
  gap: 8px;
  border-top: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
  background: var(--bg-secondary, #1a1a1e);
}

.paint-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary, #e4e4e7);
  background: var(--bg-tertiary, #27272a);
  border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: background 0.15s;
}

.paint-action-btn:hover {
  background: var(--bg-hover, #3f3f46);
}

.paint-action-btn svg {
  flex-shrink: 0;
}

/* Paint modal with iframe embedding */
.paint-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.paint-modal {
  background: var(--surface, #1A1A1D);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.paint-modal-iframe {
  width: 66vw;
  height: 66vh;
  max-width: 1200px;
  max-height: 800px;
}

.paint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
  background: var(--surface, #1A1A1D);
}

.paint-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #FFFFFF);
}

.paint-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.paint-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--text-secondary, #A1A1AA);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.paint-close-btn:hover {
  background: var(--surface-hover, #252528);
  color: var(--text, #FFFFFF);
}

/* Sub-agent action buttons */
.sa-actions { display: flex; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-subtle); }
.sa-action-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: all 0.15s ease; }
.sa-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.sa-interrupt-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.sa-followup { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-subtle); }
.sa-followup-input { flex: 1; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border-subtle); background: var(--bg-input, #1a1a1e); color: var(--text-primary); font-size: 13px; outline: none; }
.sa-followup-input:focus { }
.sa-followup-btn { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; }
.sa-followup-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Agents monitor panel */
.agents-monitor { padding: 16px; height: 100%; overflow-y: auto; }
.am-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 200px; color: var(--text-tertiary); gap: 12px; }
.am-empty p { margin: 0; font-size: 14px; }
.am-item { padding: 12px; border-radius: 8px; border: 1px solid var(--border-subtle); margin-bottom: 8px; background: var(--bg-secondary, #1a1a1e); }
.am-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.am-status { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.am-status.running { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.am-status.complete { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.am-status.error { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.am-status.interrupted { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.am-task { font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.am-output { font-size: 12px; color: var(--text-secondary); font-family: monospace; white-space: pre-wrap; word-break: break-all; max-height: 80px; overflow: hidden; margin-bottom: 8px; line-height: 1.4; }
.am-actions { display: flex; gap: 6px; }
.am-btn { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: all 0.15s ease; }
.am-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.am-btn-danger:hover { color: var(--text); background: rgba(255,255,255,0.06); }

/* Enhanced error dialog */
.error-dialog-content { padding: 16px; max-width: 500px; }
.error-dialog-header { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.error-dialog-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; word-break: break-word; margin-bottom: 16px; white-space: pre-wrap; }
.error-dialog-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.error-retry-btn { padding: 6px 16px; border-radius: 6px; border: 1px solid var(--border-subtle); background: var(--bg-hover); color: var(--text-primary); font-size: 13px; cursor: pointer; transition: all 0.15s ease; }
.error-retry-btn:hover { background: var(--accent, #555); color: #fff; }
.error-copy-btn { padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: all 0.15s ease; }
.error-copy-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.error-copy-btn.copied { border-color: var(--text); color: var(--text); }

/* ===== Empty Right Sidebar (horizontal 3-dot button) ===== */
.empty-right-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.empty-right-sidebar.collapsed {
  width: 0;
  border-left: none;
  overflow: hidden;
}

/* Shift top-actions when empty right sidebar is open */
.top-actions.shifted-right {
  right: calc(var(--sidebar-width) + 12px);
  z-index: 201;
}

/* Global: no border highlight on any interactive element */
*:focus, *:focus-within {
  outline: none !important;
  box-shadow: none !important;
  border-color: var(--border) !important;
  -webkit-tap-highlight-color: transparent !important;
}
*:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border-color: var(--border) !important;
}
*:active {
  outline: none !important;
  box-shadow: none !important;
  border-color: var(--border) !important;
}
*:hover {
  outline: none !important;
  box-shadow: none !important;
  border-color: var(--border) !important;
}

/* ===== Slash Command Popup ===== */
.slash-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary, #1a1a1e);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: none;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  margin-bottom: 4px;
}

[data-theme='dark'] .slash-popup {
  background: #1a1a1e;
}

.slash-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  gap: 12px;
  transition: background 0.1s ease;
}

.slash-item:hover,
.slash-item.selected {
  background: var(--hover-bg, rgba(255,255,255,0.06));
}

.slash-item-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--primary, #4a9eff);
  min-width: 80px;
}

.slash-item-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Shortcuts Help Panel ===== */
.shortcuts-help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shortcuts-help-panel {
  background: var(--bg-secondary, #1a1a1e);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: none;
}

.shortcuts-help-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.shortcuts-help-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.shortcuts-help-body {
  padding: 16px 20px;
}

.shortcuts-group {
  margin-bottom: 20px;
}

.shortcuts-group:last-child {
  margin-bottom: 0;
}

.shortcuts-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.shortcut-desc {
  font-size: 13px;
  color: var(--text);
}

.shortcut-keys {
  font-family: monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--text);
  min-width: 40px;
  text-align: center;
}

[data-theme='light'] .shortcut-keys {
  background: rgba(0,0,0,0.06);
}

/* ===== Message Queue Indicator ===== */
.queue-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  margin: 4px 0;
}

[data-theme='light'] .queue-indicator {
  background: rgba(0,0,0,0.04);
}

.queue-indicator .queue-count {
  font-weight: 600;
  color: var(--primary);
}

/* ===== Status Panel ===== */
.status-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-panel {
  background: var(--bg-secondary, #1a1a1e);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: none;
}

.status-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.status-panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.status-panel-body {
  padding: 16px 20px;
}

.status-section {
  margin-bottom: 20px;
}

.status-section:last-child {
  margin-bottom: 0;
}

.status-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.status-label {
  font-size: 13px;
  color: var(--text-muted);
}

.status-value {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.status-value.status-mono {
  font-family: monospace;
  font-size: 12px;
}

.status-value.status-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-value.status-connected {
  color: #4ade80;
}

.status-value.status-disconnected {
  color: #f87171;
}

.status-meter-container {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

[data-theme='light'] .status-meter-container {
  background: rgba(0,0,0,0.08);
}

.status-meter-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.status-meter-bar.meter-ok {
  background: #4ade80;
}

.status-meter-bar.meter-warning {
  background: #fbbf24;
}

.status-meter-bar.meter-critical {
  background: #f87171;
}

.status-meter-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

/* ===== Global Text Selection ===== */
::selection {
  background: rgba(100, 140, 255, 0.25);
  color: inherit;
}
[data-theme="dark"] ::selection {
  background: rgba(100, 140, 255, 0.3);
  color: inherit;
}

/* ===== Custom Caret ===== */
@keyframes caret-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.custom-caret {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  animation: caret-blink 1.06s step-end infinite;
  background: var(--caret-color, var(--text));
  border-radius: 2px;
}
.custom-caret.style-line {
  width: var(--caret-width, 2px);
  height: auto;
}
.custom-caret.style-bar {
  width: var(--caret-width, 4px);
  height: auto;
  border-radius: 2px;
}
.custom-caret.style-block {
  opacity: 0.7;
  border-radius: 2px;
}
.custom-caret.style-underline {
  height: 2px !important;
  border-radius: 1px;
}
.custom-textarea {
  caret-color: transparent;
  position: relative;
}

/* ===== Voice Button Styles ===== */
.voice-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: color var(--transition), background var(--transition);
}
.voice-btn:hover {
  color: var(--text);
  background: var(--surface);
}
.voice-btn.recording {
  color: var(--text);
}
.voice-btn-mini {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: color var(--transition), background var(--transition);
  margin-right: 4px;
}
.voice-btn-mini:hover {
  color: var(--text);
  background: var(--surface);
}
.voice-btn-mini.recording {
  color: var(--text);
}
.voice-wave-img {
  width: 19px;
  height: 19px;
  display: block;
  pointer-events: none;
}

/* ===== Browser View (Playwright streaming) ===== */
.bv-frame-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: default;
  user-select: none;
  -webkit-user-drag: none;
}
.bv-content {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bv-content:focus {
  outline: none;
  box-shadow: none;
}
.bv-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.bv-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: bv-spin 0.8s linear infinite;
}
@keyframes bv-spin {
  to { transform: rotate(360deg); }
}
.bv-error {
  padding: 16px 24px;
  color: var(--error);
  font-size: 13px;
  text-align: center;
}

/* ===== Changes View ===== */
.changes-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.changes-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.changes-summary-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.changes-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.changes-file {
  border-bottom: 1px solid var(--border);
}

.changes-file-path {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}

.changes-file-path:hover {
  background: var(--bg);
}

.changes-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid var(--text-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.changes-chevron.expanded {
  transform: rotate(90deg);
}

.changes-filename {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}

.changes-file-stats {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.changes-diff-body {
  border-top: 1px solid var(--border);
  max-height: 300px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.changes-diff-body .diff-line {
  padding: 1px 10px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

.changes-diff-body .diff-add {
  background: rgba(46, 160, 67, 0.19);
  color: #3fb950;
}

.changes-diff-body .diff-del {
  background: rgba(248, 81, 73, 0.19);
  color: #f85149;
}

.changes-diff-body .diff-hunk {
  background: rgba(161, 161, 170, 0.08);
  color: var(--text-muted);
  font-style: italic;
}

.changes-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Narrow Mode (Portrait/Narrow Viewport) ===== */

/* Disable ALL transitions and animations in narrow mode */
body.narrow-active *,
body.narrow-active *::before,
body.narrow-active *::after {
  transition: none !important;
  animation: none !important;
}

/* Narrow mode container */
.narrow-mode {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg);
}

/* Top bar */
.narrow-top-bar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
  position: relative;
  padding: 0 12px;
}

.narrow-back-btn {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.narrow-back-btn:hover {
  background: var(--accent-soft);
}

.narrow-back-spacer {
  position: absolute;
  right: 12px;
  width: 32px;
}

.narrow-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Page content area */
.narrow-page-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.narrow-page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* Bottom navigation bar */
.narrow-nav-bar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}

.narrow-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  padding: 4px 8px;
  font-family: inherit;
  line-height: 1;
}

.narrow-nav-item.active {
  color: var(--text);
}

.narrow-nav-item svg {
  width: 20px;
  height: 20px;
}

/* Sidebar in narrow mode - full width, no border */
.narrow-page .sidebar {
  width: 100% !important;
  height: 100%;
  border-right: none;
  flex-shrink: 0;
}

.narrow-page .sidebar.collapsed {
  width: 100% !important;
}

/* Settings in narrow mode - no modal overlay, inline */
.narrow-page core-settings {
  display: block;
  width: 100%;
  height: 100%;
}

.narrow-page .modal-overlay {
  position: static !important;
  background: none !important;
  display: block !important;
  padding: 0 !important;
}

.narrow-page .modal-content {
  position: static !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  display: block !important;
}

/* Settings narrow mode - page based layout */
.settings-narrow {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}

.settings-narrow-list {
  padding: 16px;
  overflow-y: auto;
}

.settings-narrow-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding: 0 4px;
}

.settings-narrow-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}

.settings-narrow-item:hover {
  background: var(--accent-soft);
}

.settings-narrow-item svg:first-child {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.settings-narrow-chevron {
  margin-left: auto;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.settings-narrow-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.settings-narrow-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-narrow-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.settings-narrow-back:hover {
  background: var(--accent-soft);
}

.settings-narrow-detail-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.settings-narrow-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.settings-narrow-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Search in narrow mode - inline container */
.narrow-search-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
}

.narrow-search-container .search-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.narrow-search-container .search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.narrow-search-container .search-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.narrow-search-container .search-results {
  flex: 1;
  overflow-y: auto;
}

.narrow-search-container .search-result-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 2px;
}

.narrow-search-container .search-result-item:hover {
  background: var(--surface);
}

.narrow-search-container .search-empty,
.narrow-search-container .search-hint {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Right panel in narrow mode - full screen */
.narrow-page core-right-panel {
  display: block;
  width: 100%;
  height: 100%;
}

.narrow-page .rp-overlay {
  position: static;
  background: none;
  display: block;
}

.narrow-page .modal-content,
.narrow-page .right-panel-modal {
  position: static !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  animation: none !important;
  flex-direction: column;
}

.narrow-page .rp-overlay.modal-overlay {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1;
  display: flex !important;
  flex-direction: column;
  position: static !important;
  background: none !important;
}

.narrow-page .rp-tab-bar-vertical {
  flex-direction: row;
  width: 100%;
  height: auto;
  border-right: none;
  border-bottom: 1px solid var(--border);
  padding: 4px 8px;
  overflow-x: auto;
  overflow-y: hidden;
}

.narrow-page .rp-tab-v.active::before {
  left: 8px;
  right: 8px;
  top: auto;
  bottom: -4px;
  width: auto;
  height: 2px;
}

.narrow-page .rp-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.narrow-page .rp-empty-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.narrow-page .rp-selector-inline {
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Chat page in narrow mode - main content fills available space */
.narrow-page core-welcome,
.narrow-page core-chat {
  display: flex;
  flex: 1;
  min-height: 0;
}

.narrow-page core-composer {
  display: block;
  flex-shrink: 0;
}

.narrow-page .main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-right: 0 !important;
}

/* Queue indicator in narrow mode */
.narrow-page .queue-indicator {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* ===== Right Panel Sub-components in Narrow Mode ===== */

/* Terminal in narrow mode */
.narrow-page .term-root {
  height: 100%;
  width: 100%;
}

.narrow-page .term-body {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* Browser view in narrow mode */
.narrow-page .bv-container {
  height: 100%;
  width: 100%;
  flex-direction: column;
}

.narrow-page .bv-toolbar {
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 8px;
}

.narrow-page .bv-url-bar {
  flex: 1;
  min-width: 0;
}

.narrow-page .bv-content {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: auto;
}

.narrow-page .bv-frame-img {
  max-width: 100%;
  height: 100%;
  object-fit: contain;
}

/* File browser in narrow mode */
.narrow-page .fb-root {
  height: 100%;
  width: 100%;
}

.narrow-page .fb-breadcrumb {
  flex-shrink: 0;
  overflow-x: auto;
  white-space: nowrap;
  padding: 4px 8px;
}

.narrow-page .fb-toolbar {
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 8px;
}

.narrow-page .fb-search-input {
  flex: 1;
  min-width: 80px;
}

.narrow-page .fb-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Changes view in narrow mode */
.narrow-page .changes-view {
  height: 100%;
  width: 100%;
}

.narrow-page .changes-header {
  flex-shrink: 0;
  padding: 4px 8px;
}

.narrow-page .changes-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.narrow-page .changes-file-path {
  word-break: break-all;
}

.narrow-page .changes-diff-body {
  overflow-x: auto;
}

.narrow-page .changes-diff-body .diff-line {
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 11px;
}

/* Close layer hidden in narrow mode (no overlay needed) */
.narrow-page .rp-close-layer {
  display: none !important;
}

/* Resize handle hidden in narrow mode */
.narrow-page .rp-resize-handle {
  display: none !important;
}

/* ===== Typing Cursor for Streaming ===== */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--text);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===== Mermaid Containers ===== */
.mermaid-container {
  margin: 12px 0;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.mermaid-container svg {
  max-width: 100%;
  height: auto;
}

.mermaid-fallback {
  margin: 0;
  font-size: 12px;
}

.mermaid-error {
  border-left: 2px solid var(--error);
  padding-left: 8px;
}

/* ===== KaTeX Styles ===== */
.katex-block {
  margin: 12px 0;
  padding: 8px 0;
  overflow-x: auto;
  text-align: center;
}

.katex-inline {
  padding: 0 2px;
}

.katex-error {
  color: var(--error);
  font-family: monospace;
  font-size: 0.9em;
}

/* ===== Goal Panel ===== */
.goal-panel {
  margin: 0 0 12px 0;
  padding: 12px;
  background: #f4f4f5;
  border-radius: 8px;
  font-size: 13px;
}

[data-theme='dark'] .goal-panel {
  background: #1a1a1e;
}

.goal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.goal-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.goal-status {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.goal-status.status-active {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.goal-status.status-complete {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

.goal-status.status-blocked {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

.goal-status.status-paused {
  background: rgba(161, 161, 170, 0.15);
  color: #a1a1aa;
}

.goal-objective {
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.goal-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.goal-progress-bar {
  margin-top: 6px;
  height: 4px;
  background: rgba(128, 128, 128, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.goal-progress-fill {
  height: 100%;
  background: #4ade80;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ===== Badge Component ===== */
.core-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-default { background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); }
.badge-success { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.badge-warning { background: var(--surface); color: var(--warning); border: 1px solid var(--border); }
.badge-info { background: var(--accent-soft); color: var(--text-secondary); border: 1px solid var(--border); }
.core-badge.clickable { cursor: pointer; transition: opacity 0.15s ease; }
.core-badge.clickable:hover { opacity: 0.8; }

/* ===== Skills Panel ===== */
.skills-panel {
  padding: 12px;
}
.skills-panel-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.skills-panel-loading,
.skills-panel-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
}
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.skill-detail {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.skill-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.skill-detail-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.skill-detail-scope {
  font-size: 11px;
  color: var(--text-muted);
}
.skill-detail-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}
.skill-detail-loading {
  font-size: 12px;
  color: var(--text-muted);
}
.skill-detail-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
  background: var(--code-bg);
  padding: 8px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* ===== Side Chat Panel ===== */
.side-chat-panel {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: right 0.25s ease;
  z-index: 900;
}
.side-chat-panel.open { right: 0; }
.side-chat-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.side-chat-title { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.side-chat-new-btn, .side-chat-close-btn {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-muted); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition);
}
.side-chat-new-btn:hover, .side-chat-close-btn:hover { background: var(--panel-alt); color: var(--text); }
.side-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.side-chat-msg { max-width: 90%; padding: 8px 12px; border-radius: var(--radius-md); font-size: 13px; line-height: 1.4; word-break: break-word; }
.side-chat-msg.user { align-self: flex-end; background: var(--primary); color: var(--primary-text); }
.side-chat-msg.assistant { align-self: flex-start; background: var(--panel-alt); color: var(--text); }
.side-chat-waiting { align-self: flex-start; padding: 8px 12px; font-size: 12px; color: var(--text-muted); font-style: italic; }
.side-chat-input-area {
  display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--border);
}
.side-chat-input-area textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 8px 10px; font-family: inherit; font-size: 13px; line-height: 1.3; color: var(--text);
  background: var(--bg); outline: none; min-height: 36px; max-height: 100px;
}
.side-chat-send-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: none; background: var(--primary); color: var(--primary-text); border-radius: var(--radius-sm);
  cursor: pointer; transition: opacity var(--transition); flex-shrink: 0;
}
.side-chat-send-btn:disabled { opacity: 0.4; cursor: default; }
.side-chat-send-btn:hover:not(:disabled) { opacity: 0.85; }

/* ===== Cron Panel ===== */
.cron-panel { display: flex; flex-direction: column; gap: 12px; }
.cron-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cron-form { background: var(--panel-alt); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.cron-form-actions { display: flex; gap: 8px; margin-top: 4px; }
.cron-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.cron-prompt-input { resize: vertical; min-height: 60px; line-height: 1.4; }
.cron-error { font-size: 12px; color: var(--error); margin-top: 4px; }
.cron-loading, .cron-empty { text-align: center; padding: 24px 0; color: var(--text-muted); font-size: 13px; }
.cron-list { display: flex; flex-direction: column; gap: 6px; }
.cron-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); }
.cron-item:hover { background: var(--surface); }
.cron-item.disabled { opacity: 0.55; }
.cron-item-main { flex: 1; min-width: 0; }
.cron-item-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cron-item-schedule { font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--accent); margin-top: 2px; }
.cron-item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cron-meta-tag { font-size: 11px; color: var(--text-muted); }
.cron-disabled-tag { color: var(--warning); }
.cron-item-actions { display: flex; gap: 2px; flex-shrink: 0; margin-left: 8px; }
.cron-delete-btn:hover { color: var(--error) !important; }

/* ===== Code Highlight ===== */
.hl-keyword { color: var(--accent); font-weight: 500; }
.hl-string { color: #a5d6ff; }
.hl-comment { color: var(--text-muted); font-style: italic; }
.hl-number { color: #79c0ff; }
code.highlighted {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.5;
}
.fb-code-preview {
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow: auto;
  max-height: 500px;
  white-space: pre;
  tab-size: 4;
}
.fb-code-preview code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
}

/* ===== PDF Viewer ===== */
.pdf-viewer {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.pdf-filename {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
  text-decoration: none;
}
.pdf-download-btn:hover {
  background: var(--panel-alt);
  color: var(--text);
}
.pdf-frame {
  width: 100%;
  height: 600px;
  border: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--bg);
}

/* ===== Video Player ===== */
.video-player {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.video-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.video-filename {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
  text-decoration: none;
}
.video-download-btn:hover {
  background: var(--panel-alt);
  color: var(--text);
}
.video-frame {
  max-width: 100%;
  max-height: 500px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: #000;
}