*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg-secondary: #f5f5f5;
  --text: #1a1a1a;
  --text-muted: #666666;
  --border: #e0e0e0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --green: #16a34a;
  --yellow: #ca8a04;
  --gray: #9ca3af;
  --red: #dc2626;
  --card-pending-bg: #f0fdf4;
  --card-pending-border: #16a34a;
  --item-bg: rgba(255, 255, 255, 0.7);
  --sidebar-width: 260px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --text: #e5e5e5;
    --text-muted: #999999;
    --border: #333333;
    --card-pending-bg: #0a2614;
    --item-bg: rgba(255, 255, 255, 0.08);
  }
  .session-item.recently-active { background: rgba(37, 99, 235, 0.15); }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Login */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.login-card h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.login-card .subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.25rem; }

.input-wrapper { position: relative; }
.input-wrapper input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  font-family: monospace;
}
.input-wrapper input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

.error-msg { color: var(--red); font-size: 0.8125rem; margin-top: 0.5rem; }

/* Dashboard layout */
.dashboard { display: flex; height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  flex-shrink: 0;
  position: relative;
}
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/logo-bg.png') center center / 80% auto no-repeat;
  opacity: 0.8;
  pointer-events: none;
  z-index: 0;
}
.sidebar > * { position: relative; z-index: 1; }

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-header h2 { font-size: 1rem; }
.settings-gear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.settings-gear-btn:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.session-list { flex: 1; overflow-y: auto; padding: 0.5rem; }

.session-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8125rem;
  transition: background 0.1s;
  background: var(--item-bg);
}
.session-item.recently-active { background: rgba(37, 99, 235, 0.08); border-left: 3px solid var(--accent); }
.session-item:hover { background: var(--border); }
.session-item.active { background: var(--accent); color: #fff; border-left: none; }

.pipeline-item { border-radius: 4px; transition: background 0.1s; }
.pipeline-item.clickable { cursor: pointer; }
.pipeline-item.clickable:hover { background: var(--border); }

.section-action { font-size: 0.6rem; color: var(--text-muted); cursor: pointer; padding: 2px 4px; border-radius: 3px; }
.section-action:hover { color: var(--text); background: var(--border); }

.session-delete {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
}
.session-delete:hover { color: var(--red); }
.session-item:hover .session-delete { display: block; }
.session-item.active .session-delete { color: rgba(255,255,255,0.6); }
.session-item.active .session-delete:hover { color: #fff; }

/* Usage panel */
.usage-panel {
  padding: 12px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.usage-bar {
  background: var(--bg-secondary);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease, background 0.3s ease;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.waiting { background: var(--green); }
.status-dot.active {
  background: var(--yellow);
  animation: status-pulse 1.5s ease-in-out infinite;
}
.status-dot.idle { background: var(--gray); }
.status-dot.input_needed {
  background: var(--yellow);
  animation: status-pulse 0.8s ease-in-out infinite;
}

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

.badge {
  background: var(--red);
  color: #fff;
  font-size: 0.6875rem;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0 5px;
}

/* Collapse toggle button */
.collapse-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.collapse-toggle:hover { background: var(--bg-secondary); color: var(--text); }

/* Collapsed sidebar states */
.sidebar.collapsed {
  width: 40px !important;
  min-width: 40px;
}
.sidebar.collapsed .session-list,
.sidebar.collapsed .usage-panel { display: none; }
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 1rem 0.5rem;
}

.file-tree-sidebar.collapsed {
  width: 40px !important;
  min-width: 40px !important;
}
.file-tree-sidebar.collapsed .file-tree-list,
.file-tree-sidebar.collapsed .git-status-bar,
.file-tree-sidebar.collapsed .issues-section { display: none; }
.file-tree-sidebar.collapsed .file-tree-header {
  justify-content: center;
  padding: 12px 8px;
}

/* Resize handle */
.resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s;
  position: relative;
  z-index: 10;
}
.resize-handle::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -3px; right: -3px;
}
.resize-handle:hover,
.resize-handle.active { background: var(--accent); }

/* Main area */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.main-header h2 { font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turns-monitor { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; white-space: nowrap; }
.turns-monitor.hidden { display: none; }

/* Agent View Pixel Bar */
.agent-pixel {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.agent-pixel:hover {
  transform: scale(1.6);
  opacity: 0.9;
}
.agent-pixel-running {
  animation: agent-pulse 1.2s ease-in-out infinite;
}
@keyframes agent-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Chat area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Floating "jump to bottom" button — anchored above the input bar
   (.instruction-bar is position:relative, and sticky-bottom on mobile),
   so it clears the bar at any height on both desktop and mobile. */
.jump-to-bottom {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 14px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 5;
}

.jump-to-bottom:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Mobile: the document scrolls and the input bar sits at the end of the
   page (overflow:hidden ancestors defeat its sticky positioning), so the
   button pins to the viewport instead. It hides within 150px of the
   bottom, before it would overlap the input bar. */
@media (max-width: 768px) {
  .jump-to-bottom {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    z-index: 20;
  }
}

.chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 1rem;
}

.chat-bubble {
  max-width: 75%;
  padding: 0.375rem 0.75rem;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble .bubble-time {
  display: block;
  font-size: 0.625rem;
  margin-top: 0.125rem;
  opacity: 0.5;
}

.chat-bubble.assistant .bubble-time { color: var(--text-muted); }

/* Tool use bubbles */
.chat-bubble.tool {
  align-self: flex-start;
  max-width: 85%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 0.8125rem;
  padding: 0.5rem 0.75rem;
}

.tool-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.command-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent);
  margin-bottom: 0.25rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.tool-filepath {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--accent);
  word-break: break-all;
}

.file-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
}
.file-link:hover {
  text-decoration-style: solid;
}

.diff-block {
  margin-top: 0.375rem;
  font-family: monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  border-radius: 6px;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}

.diff-old, .diff-new {
  padding: 0.375rem 0.5rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-old {
  background: #fdd;
  color: #900;
  border-radius: 6px 6px 0 0;
}

.diff-new {
  background: #dfd;
  color: #060;
  border-radius: 0 0 6px 6px;
}

@media (prefers-color-scheme: dark) {
  .diff-old { background: #3d1f1f; color: #f88; }
  .diff-new { background: #1f3d1f; color: #8f8; }
}

.bash-cmd {
  margin-top: 0.25rem;
  font-family: monospace;
  font-size: 0.75rem;
  background: var(--bg-secondary);
  padding: 0.375rem 0.5rem;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 150px;
  overflow-y: auto;
}
.chat-bubble.user .bubble-time { color: rgba(255,255,255,0.7); }

/* Option selector buttons — rendered below assistant messages with detected choices */
.option-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.625rem;
}

.option-btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.option-btn:hover {
  background: var(--accent);
  color: #fff;
}

.chat-bubble.waiting {
  border-color: var(--green);
  background: var(--card-pending-bg);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 0.875rem;
  border-radius: 8px;
  font-size: 0.75rem;
  z-index: 100;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast.visible {
  opacity: 1;
  transform: translateY(0);
}
.toast.warning {
  background: #f59e0b;
  color: #000;
  border-color: #d97706;
}
.toast.error {
  background: #ef4444;
  color: #fff;
  border-color: #dc2626;
}

/* Response area (textarea + send) */
.response-area {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.response-area textarea {
  flex: 1;
  min-height: 80px;
  max-height: 200px;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
}
.response-area textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Instruction bar (secondary) */
.instruction-bar {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  background: var(--bg-secondary);
  font-size: 0.8125rem;
}
.instruction-bar .input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  width: 100%;
}
.instruction-bar .input-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.instruction-bar .shortcut-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.instruction-bar textarea {
  width: 100%;
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8125rem;
  font-family: inherit;
  resize: none;
  overflow-y: auto;
  min-height: 1.75rem;
  max-height: 150px;
  line-height: 1.4;
  box-sizing: border-box;
}
.instruction-bar textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.instruction-bar .input-hint {
  font-size: 0.625rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.instruction-bar .helper { font-size: 0.6875rem; color: var(--text-muted); }

/* Status line */
.status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 4px 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
  flex-shrink: 0;
  min-height: 24px;
}
.status-line-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.status-line-item + .status-line-item::before {
  content: '|';
  color: var(--border);
  margin-right: 4px;
}
.status-line-label {
  opacity: 0.6;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-line-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

/* Connection banner */
.connection-banner {
  background: var(--yellow);
  color: #000;
  text-align: center;
  padding: 0.375rem;
  font-size: 0.8125rem;
}
.restart-banner {
  background: #f59e0b;
  color: #000;
  text-align: center;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
}

/* Mobile */
.mobile-session-select {
  display: none;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.mobile-session-select select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

/* Directory browser */
.browse-breadcrumbs {
  padding: 6px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  min-height: 28px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.browse-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 200px;
}

.browse-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.browse-item:last-child { border-bottom: none; }
.browse-item:hover { background: var(--bg-secondary); }

.browse-icon {
  flex-shrink: 0;
  font-size: 14px;
  width: 18px;
  text-align: center;
}

/* File Tree Sidebar */
.file-tree-sidebar {
  width: 280px; min-width: 280px; border-left: 1px solid var(--border);
  background: var(--bg-secondary); display: flex; flex-direction: column; overflow: hidden;
  position: relative;
}
.file-tree-sidebar > * { position: relative; z-index: 1; }
.file-tree-header {
  padding: 12px 16px; font-weight: 600; font-size: 14px;
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px;
  background: var(--bg-secondary);
}
.file-count-badge {
  background: var(--bg-secondary); color: var(--text-muted); font-size: 11px;
  padding: 2px 6px; border-radius: 8px; font-weight: 500;
}
.file-tree-refresh {
  margin-left: auto; background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px; line-height: 1;
}
.file-tree-refresh:hover { color: var(--text-primary); background: var(--bg-secondary); }
.file-tree-list { overflow-y: auto; flex: 1; padding: 0.5rem; }
.file-tree-empty { color: var(--text-muted); font-size: 13px; padding: 16px; text-align: center; }
.file-tree-item {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 0.75rem;
  cursor: pointer; font-size: 0.8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-radius: 8px; transition: background 0.1s; background: var(--item-bg);
}
.file-tree-item:hover { background: var(--border); }
.file-tree-item.is-selected { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.file-tree-icon { width: 12px; font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.file-tree-name { overflow: hidden; text-overflow: ellipsis; }
.file-tree-name.name-modified { color: var(--yellow); }
.file-tree-status {
  font-size: 10px; font-weight: 600; padding: 1px 4px; border-radius: 3px; flex-shrink: 0; margin-left: auto;
}
.file-tree-status.git-M { color: var(--yellow); }
.file-tree-status.git-A { color: var(--green); }
.file-tree-status.git-D { color: var(--red); }
.file-tree-status.git-R { color: var(--accent); }
.file-tree-status.git-untracked { color: var(--text-muted); }
.file-tree-action {
  font-size: 10px; font-weight: 600; padding: 1px 4px; border-radius: 3px; flex-shrink: 0;
}
.file-tree-action.action-edit { color: var(--yellow); }
.file-tree-action.action-write { color: var(--green); }
.file-tree-action.action-read { color: var(--text-muted); }

/* Git Status Bar */
.git-status-bar {
  border-top: 1px solid var(--border); padding: 10px 12px;
  font-size: 12px; background: var(--bg-secondary); flex-shrink: 0;
}
.git-branch-row {
  display: flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 4px;
}
.git-branch-icon { font-size: 14px; color: var(--text-muted); }
.git-branch-name { color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.git-ahead { color: var(--green); font-size: 11px; font-weight: 500; }
.git-behind { color: var(--yellow); font-size: 11px; font-weight: 500; }
.git-pr-link { color: var(--text-muted); font-size: 11px; font-weight: 500; text-decoration: none; flex-shrink: 0; }
.git-pr-link:hover { color: var(--accent); text-decoration: underline; }
.git-file-counts {
  display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--text-muted); font-size: 11px;
}
.git-stat { white-space: nowrap; }
.git-stat-staged { color: var(--green); }
.git-stat-modified { color: var(--yellow); }
.git-stat-added { color: var(--green); }
.git-stat-deleted { color: var(--red); }
.git-stat-untracked { color: var(--text-muted); }
.git-clean { color: var(--text-muted); font-size: 11px; }
.git-clean-text { font-style: italic; }

/* Provider Placeholder */
.provider-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  text-align: center;
  gap: 8px;
}

.provider-placeholder-icon {
  opacity: 0.6;
}

.provider-placeholder-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.provider-placeholder-url {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
}

.provider-placeholder-msg {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* GitHub Issues Section */
.issues-section {
  border-top: 1px solid var(--border);
}

.issues-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  padding: 8px 12px;
}

.issues-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.issues-toggle {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.issue-row.is-selected {
  background: var(--border);
  border-left: 2px solid var(--accent);
}

.issue-state-toggles {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.issue-state-toggle {
  font-size: 11px;
  height: 28px;
  line-height: 26px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.issue-state-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.issue-state-toggle.active-open {
  background: #238636;
  color: #fff;
  border-color: #238636;
}

.issue-state-toggle.active-closed {
  background: #8957e5;
  color: #fff;
  border-color: #8957e5;
}

.issue-state-toggle.active-skills-all,
.issue-state-toggle.active-skills-global,
.issue-state-toggle.active-skills-project {
  background: #238636;
  color: #fff;
  border-color: #238636;
}

.pipeline-status-pill {
  font-size: 11px;
  height: 22px;
  line-height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.pipeline-status-pill.sm {
  font-size: 9px;
  height: 18px;
  line-height: 16px;
  padding: 0 6px;
}
.pipeline-status-pill.running  { background: rgba(245,158,11,0.15); color: #f59e0b; border-color: #f59e0b; }
.pipeline-status-pill.completed { background: #14532d; color: #86efac; border-color: #14532d; }
.pipeline-status-pill.failed   { background: #7f1d1d; color: #fca5a5; border-color: #7f1d1d; }
.pipeline-status-pill.stale    { background: rgba(249,115,22,0.15); color: #fb923c; border-color: #fb923c; }
.pipeline-status-pill.cancelled { background: #374151; color: #d1d5db; border-color: #374151; }
.pipeline-status-pill.paused   { background: #374151; color: #d1d5db; border-color: #374151; }

.issues-search {
  width: 100%;
  padding: 5px 8px;
  font-size: 11px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  margin-bottom: 6px;
  box-sizing: border-box;
}

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

.issue-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 30vh;
  overflow-y: auto;
}

/* Full-height variant for mobile tabs where the tab container scrolls */
.issue-list.full {
  max-height: none;
  overflow-y: visible;
}

.issue-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  background: var(--item-bg);
  font-size: 0.8125rem;
}

.issue-row:hover {
  background: var(--border);
}

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

.issue-dot.open {
  background: #238636;
}

.issue-dot.closed {
  background: #8957e5;
}

.issue-row-content {
  flex: 1;
  min-width: 0;
}

.issue-row-title {
  font-size: 0.8125rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-row-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Skill row action buttons */
.skill-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 3px;
  font-size: 10px;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}
.skill-action-btn:hover {
  background: var(--bg-secondary);
  color: var(--accent);
}
.skill-action-btn.skill-play { font-size: 9px; }
.skill-action-btn.skill-inspect { font-size: 11px; }

/* Mobile: larger touch targets for skill actions */
@media (max-width: 768px) {
  .skill-action-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  .skill-action-btn.skill-play { font-size: 12px; }
  .skill-action-btn.skill-inspect { font-size: 14px; }
}

.issues-show-more {
  display: block;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 0;
  width: 100%;
}

.issues-show-more:hover {
  color: var(--text);
  text-decoration: underline;
}

.issues-loading,
.issues-error,
.issues-empty {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 0;
}

.issues-error {
  color: var(--red);
}

/* Issue Detail Panel */
.issue-detail {
  padding: 4px 0;
}

.issue-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.issue-detail-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.issue-detail-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.issue-detail-close {
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
}

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

.issue-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.issue-label {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid;
  font-weight: 500;
}

.issue-body {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 8px;
}

.issue-body p { margin: 0.25em 0; }
.issue-body p:first-child { margin-top: 0; }
.issue-body p:last-child { margin-bottom: 0; }

.issue-body code {
  background: rgba(0,0,0,0.1);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.9em;
}

.issue-body pre {
  background: rgba(0,0,0,0.1);
  padding: 6px 8px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.85em;
  margin: 0.4em 0;
}

.issue-body pre code {
  background: none;
  padding: 0;
}

.generate-prompt-btn {
  width: 100%;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  background: #238636;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 4px;
}

.generate-prompt-btn:hover {
  background: #2ea043;
}

.issue-link-btn {
  padding: 2px 10px;
  font-size: 11px;
  border-radius: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.issue-link-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.generate-prompt-hint {
  display: block;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
}

/* Issue row badges (PR link count, comment count) */
.issue-row-badges {
  display: inline-flex;
  gap: 6px;
  margin-left: 4px;
}

.issue-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-muted);
}

.issue-badge svg {
  opacity: 0.7;
}

.issue-badge-pr {
  color: #3fb950;
}

.issue-badge-comments {
  color: var(--text-muted);
}

/* Linked PRs section in issue detail */
.issue-linked-prs {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.issue-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.linked-pr-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  margin-bottom: 2px;
  font-size: 12px;
}

.linked-pr-item:hover {
  background: var(--bg-secondary);
}

.linked-pr-link {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.linked-pr-link:hover {
  color: var(--accent);
}

.linked-pr-number {
  font-weight: 600;
  flex-shrink: 0;
}

.linked-pr-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linked-pr-state {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 500;
  flex-shrink: 0;
}

.linked-pr-branch {
  font-size: 10px;
  font-family: monospace;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 1px 5px;
  border-radius: 3px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Issue comments section */
.issue-comments-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.issue-comment {
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
}

.issue-comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.issue-comment-author {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.issue-comment-time {
  font-size: 10px;
  color: var(--text-muted);
}

.issue-comment-body {
  max-height: none;
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 0;
}

.issue-comment-body p { margin: 0.25em 0; }
.issue-comment-body p:first-child { margin-top: 0; }
.issue-comment-body p:last-child { margin-bottom: 0; }

/* Mod Bar */
.mod-bar {
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: 4px 12px;
  flex-shrink: 0;
}
.mod-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  font-size: 12px;
}
.mod-bar-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.mod-bar-panel-title {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mod-bar-panel-data {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.mod-bar-pane-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 11px;
  flex-shrink: 0;
}
.mod-bar-pane-toggle:hover { color: var(--text); border-color: var(--accent); }

/* Mod Pane (side panel) */
.mod-pane {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.mod-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.mod-pane-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}
.mod-pane-close:hover { color: var(--text); }
.mod-pane-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mod-pane-panel {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.mod-pane-panel-title {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.mod-pane-panel-content {
  padding: 8px 10px;
  font-size: 12px;
}
.mod-pane-data-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.mod-pane-data-row:last-child { border-bottom: none; }
.mod-pane-data-key {
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
}
.mod-pane-data-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
  word-break: break-word;
}

/* Main content split */
.main-content-split { display: flex; flex: 1; overflow: hidden; }
.chat-column { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow: hidden; }

/* File Viewer */
.file-viewer-column {
  flex: 1; min-width: 0; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.file-viewer-header {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--bg-secondary);
}
.file-viewer-path { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-viewer-controls { display: flex; gap: 4px; flex-shrink: 0; }
.file-viewer-controls button {
  padding: 3px 10px; font-size: 12px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); border-radius: 4px; cursor: pointer;
}
.file-viewer-controls button.active { background: var(--accent); color: white; border-color: var(--accent); }
.file-viewer-close { border: none !important; background: none !important; color: var(--text-muted) !important; font-size: 16px !important; padding: 2px 6px !important; }
.file-viewer-close:hover { color: var(--text) !important; }
.file-viewer-body {
  flex: 1; overflow-y: auto; padding: 12px;
  font-family: 'SF Mono', 'Consolas', 'Menlo', monospace; font-size: 12px; line-height: 1.5;
}
.file-viewer-body .diff-block { margin-bottom: 16px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.file-viewer-body .diff-old { background: color-mix(in srgb, var(--red) 12%, var(--bg)); padding: 8px 12px; white-space: pre-wrap; word-break: break-word; border-left: 3px solid var(--red); }
.file-viewer-body .diff-new { background: color-mix(in srgb, var(--green) 12%, var(--bg)); padding: 8px 12px; white-space: pre-wrap; word-break: break-word; border-left: 3px solid var(--green); }
.diff-empty { color: var(--text-muted); padding: 24px; text-align: center; }
.git-diff-content { margin: 0; font-family: monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.git-diff-content .diff-line { display: block; padding: 0 12px; }
.git-diff-content .diff-add { background: color-mix(in srgb, var(--green) 12%, var(--bg)); color: var(--green); }
.git-diff-content .diff-remove { background: color-mix(in srgb, var(--red) 12%, var(--bg)); color: var(--red); }
.git-diff-content .diff-hunk { color: var(--accent); font-weight: 600; margin-top: 8px; }
.git-diff-content .diff-meta { color: var(--text-muted); }
.full-file-content { margin: 0; white-space: pre-wrap; word-break: break-word; }
/* Full-height chain: lets HTML/media previews fill the panel while text content
   still grows and scrolls in .file-viewer-body / .mobile-detail-body */
.full-view { display: flex; flex-direction: column; min-height: 100%; }
.full-view .full-file-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.full-file-content > .html-preview,
.full-file-content > .image-preview,
.full-file-content > .video-preview,
.full-file-content > .audio-preview { flex: 1; min-height: 0; }
.viewer-loading, .viewer-binary, .viewer-truncated { color: var(--text-muted); padding: 8px 0; }
.viewer-truncated { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; font-size: 11px; }

/* Markdown content in chat bubbles */
.chat-bubble.assistant { white-space: normal; }
.chat-bubble.user { white-space: normal; }
.markdown-content { overflow-wrap: break-word; }
.markdown-content p { margin: 0.25em 0; }
.markdown-content p:first-child { margin-top: 0; }
.markdown-content p:last-child { margin-bottom: 0; }
.markdown-content pre {
  background: rgba(0,0,0,0.25); padding: 0.5em 0.75em; border-radius: 6px;
  overflow-x: auto; font-size: 0.8em; margin: 0.5em 0; line-height: 1.4;
}
.markdown-content code {
  background: rgba(0,0,0,0.15); padding: 0.1em 0.3em; border-radius: 3px; font-size: 0.85em;
}
.markdown-content pre code { background: none; padding: 0; font-size: inherit; }
.markdown-content ul, .markdown-content ol { margin: 0.25em 0; padding-left: 1.5em; }
.markdown-content li { margin: 0.15em 0; }
.markdown-content h1, .markdown-content h2, .markdown-content h3 {
  margin: 0.5em 0 0.25em; font-size: 1em; font-weight: 600;
}
.markdown-content blockquote {
  border-left: 3px solid var(--border); margin: 0.5em 0; padding: 0.25em 0.75em;
  color: var(--text-muted);
}
.markdown-content a { color: inherit; text-decoration: underline; }
.markdown-content table { border-collapse: collapse; margin: 0.5em 0; font-size: 0.85em; }
.markdown-content th, .markdown-content td {
  border: 1px solid var(--border); padding: 0.25em 0.5em;
}

/* Markdown overrides for user (blue) bubbles */
.chat-bubble.user .markdown-content code {
  background: rgba(255,255,255,0.2);
}
.chat-bubble.user .markdown-content pre {
  background: rgba(0,0,0,0.3);
}
.chat-bubble.user .markdown-content pre code { background: none; }
.chat-bubble.user .markdown-content blockquote {
  border-left-color: rgba(255,255,255,0.4); color: rgba(255,255,255,0.8);
}
.chat-bubble.user .markdown-content th,
.chat-bubble.user .markdown-content td {
  border-color: rgba(255,255,255,0.3);
}
.chat-bubble.user .markdown-content a { color: #fff; }

/* ===== Modal System ===== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-sm,
.modal-md,
.modal-lg {
  background: var(--bg);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  max-width: 90vw;
  overflow: hidden;
}

.modal-sm { width: 480px; }
.modal-md { width: 560px; }
.modal-lg { width: 640px; }

.modal-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}

.modal-close-btn:hover {
  background: var(--border);
}

.modal-body {
  padding: 0 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.modal-footer .btn-primary,
.modal-header .btn-primary {
  width: auto;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  box-sizing: border-box;
}

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

.modal-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
}

.modal-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ===== New Session Modal ===== */
.modal-columns {
  display: flex;
  min-height: 280px;
  border-top: 1px solid var(--border);
}

.modal-columns-left {
  width: 45%;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
}

.modal-columns-right {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

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

.new-folder-toggle {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}

.new-folder-toggle:hover {
  text-decoration: underline;
}

/* ===== Settings Modal ===== */
.settings-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--border);
}

.settings-tabs {
  width: 160px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 12px 0;
  background: var(--bg-secondary);
}

.settings-tab {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-left: 2px solid transparent;
}

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

.settings-tab.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--bg);
  font-weight: 500;
}

.settings-tab-divider {
  border-top: 1px solid var(--border);
  margin: 8px 16px;
}

.settings-tab.danger {
  color: var(--red);
}

.settings-tab.danger:hover {
  background: var(--bg);
}

.settings-content {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  min-height: 0;
}

.settings-section-header {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-field {
  margin-bottom: 16px;
}

.settings-change-badge {
  font-size: 9px;
  background: var(--yellow);
  color: #000;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 6px;
}

.modal-footer-status {
  margin-right: auto;
  font-size: 12px;
  color: var(--yellow);
  font-weight: 500;
}

/* ===== Mobile Menu (hidden on desktop) ===== */
.mobile-hamburger { display: none; }
.mobile-menu-overlay { display: none; }
.mobile-modal-back { display: none; }
.mobile-modal-header { display: none; }

@media (max-width: 768px) {
  /* Hide desktop elements */
  .sidebar { display: none; }
  .mobile-session-select { display: none; }
  .file-tree-sidebar { display: none; }
  .file-viewer-column { display: none; }
  .resize-handle { display: none; }
  .mod-pane { display: none; }
  .mod-bar-pane-toggle { display: none; }

  .dashboard { flex-direction: column; }

  /* Hamburger button */
  .mobile-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
    margin-right: 8px;
    flex-shrink: 0;
  }

  /* Main header mobile layout — sticky so hamburger is always accessible */
  .main-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
  }
  .main-header h2 {
    font-size: 0.9rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-model-label {
    display: none !important;
  }

  /* Chat area mobile sizing */
  .chat-bubble.user,
  .chat-bubble.assistant,
  .chat-bubble.tool {
    max-width: 90%;
  }

  /* Input bar sticky — stack vertically on mobile */
  .instruction-bar {
    position: sticky;
    bottom: 0;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0));
  }
  .instruction-bar .input-wrapper {
    order: -1;
    flex-basis: 100%;
    margin-bottom: 0.375rem;
  }
  .instruction-bar textarea {
    font-size: 16px; /* prevent iOS auto-zoom on focus */
    min-height: 5rem;
    max-height: 200px;
  }
  .instruction-bar .input-hint {
    display: none;
  }
  .instruction-bar .btn-primary {
    margin-left: auto;
  }

  /* Mobile Menu Overlay */
  .mobile-menu-overlay {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh; /* fallback */
    height: 100dvh;
    background: var(--bg);
    z-index: 1000;
    transition: transform 250ms ease-out;
  }

  .mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .mobile-menu-close {
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
  }

  .mobile-menu-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  /* Bottom Tab Bar — scrolls horizontally so every section stays reachable */
  .mobile-tab-bar {
    display: flex;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }

  .mobile-tab-bar::-webkit-scrollbar {
    display: none;
  }

  .mobile-tab {
    flex: 1 0 auto;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 10px;
    min-height: 44px;
    transition: color 0.15s;
  }

  .mobile-tab.active {
    color: var(--accent);
  }

  /* Session items in mobile menu — larger tap targets */
  .mobile-menu-content .session-item {
    min-height: 44px;
    padding: 10px 12px;
  }

  /* Detail Overlays (file viewer, issue detail) */
  .mobile-detail-overlay {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh; /* fallback */
    height: 100dvh;
    background: var(--bg);
    z-index: 1001;
    transition: transform 250ms ease-out;
  }

  .mobile-detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    min-height: 44px;
  }

  .mobile-back-btn {
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
  }

  .mobile-detail-title {
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
  }

  .mobile-detail-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  .mobile-detail-body:has(.html-preview-frame) {
    overflow: hidden;
  }

  /* Modal full-screen on mobile */
  .modal-sm,
  .modal-md,
  .modal-lg {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-body {
    padding: 0 16px;
  }

  .modal-footer {
    padding: 12px 16px;
  }

  /* New Session: stack columns vertically on mobile */
  .modal-columns {
    flex-direction: column;
  }

  .modal-columns-left {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 200px;
  }

  .modal-columns-right {
    flex: 1;
  }

  /* Settings: horizontal tab bar on mobile */
  .settings-layout {
    flex-direction: column;
  }

  .settings-tabs {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    overflow-x: auto;
    padding: 0;
    flex-shrink: 0;
  }

  .settings-tab {
    border-left: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    padding: 10px 16px;
  }

  .settings-tab.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .settings-tab-divider {
    display: none;
  }

  /* Larger tap targets in modals */
  .browse-item {
    min-height: 44px;
    padding: 10px 12px;
  }

  /* Mobile modal header: sticky at top of scrollable modal */
  .mobile-modal-header {
    display: flex;
    position: sticky;
    top: 0;
    margin: 0 -24px 16px -24px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    min-height: 44px;
    z-index: 1;
  }

  /* Hide the desktop title row in modals on mobile */
  .desktop-modal-title {
    display: none !important;
  }

  .mobile-run-btn {
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-run-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
  }
}

/* ===== Smart File Viewer Styles ===== */

/* File type badge */
.file-type-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent);
  color: white;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Code viewer with line numbers */
.code-viewer-wrapper {
  position: relative;
}

.code-viewer-wrapper .language-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--input-bg);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  z-index: 1;
}

.code-viewer {
  margin: 0;
  padding: 12px 12px 12px 52px;
  font-family: 'SF Mono', Consolas, 'Menlo', monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  counter-reset: line;
  background: transparent;
}

.code-viewer .line {
  display: block;
  counter-increment: line;
}

.code-viewer .line::before {
  content: counter(line);
  display: inline-block;
  width: 32px;
  margin-left: -40px;
  margin-right: 8px;
  text-align: right;
  color: var(--text-muted);
  opacity: 0.5;
  font-size: 11px;
  user-select: none;
}

/* Markdown rendered content */
.full-file-content .markdown-content {
  padding: 16px 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.full-file-content .markdown-content h1,
.full-file-content .markdown-content h2,
.full-file-content .markdown-content h3,
.full-file-content .markdown-content h4,
.full-file-content .markdown-content h5,
.full-file-content .markdown-content h6 {
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  font-weight: 600;
}

.full-file-content .markdown-content h1 { font-size: 1.5em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.full-file-content .markdown-content h2 { font-size: 1.3em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.full-file-content .markdown-content h3 { font-size: 1.15em; }

.full-file-content .markdown-content p { margin: 0.8em 0; }
.full-file-content .markdown-content ul,
.full-file-content .markdown-content ol { padding-left: 2em; margin: 0.5em 0; }

.full-file-content .markdown-content code {
  background: var(--input-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'SF Mono', Consolas, 'Menlo', monospace;
}

.full-file-content .markdown-content pre {
  background: var(--input-bg);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
}

.full-file-content .markdown-content pre code {
  background: transparent;
  padding: 0;
}

.full-file-content .markdown-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 0.8em 0;
  padding: 0.5em 1em;
  color: var(--text-muted);
}

.full-file-content .markdown-content table {
  border-collapse: collapse;
  margin: 0.8em 0;
  width: 100%;
}

.full-file-content .markdown-content th,
.full-file-content .markdown-content td {
  border: 1px solid var(--border);
  padding: 6px 12px;
  text-align: left;
}

.full-file-content .markdown-content th {
  background: var(--input-bg);
  font-weight: 600;
}

.full-file-content .markdown-content a {
  color: var(--accent);
  text-decoration: none;
}

.full-file-content .markdown-content a:hover {
  text-decoration: underline;
}

.full-file-content .markdown-content img {
  max-width: 100%;
  border-radius: 4px;
}

.full-file-content .markdown-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5em 0;
}

/* JSON tree */
.json-tree {
  padding: 12px;
  font-family: 'SF Mono', Consolas, 'Menlo', monospace;
  font-size: 12px;
  line-height: 1.6;
}

.json-line {
  white-space: nowrap;
}

.json-toggle {
  cursor: pointer;
  user-select: none;
  display: inline-block;
  width: 12px;
  text-align: center;
  color: var(--text-muted);
}

.json-toggle:hover {
  color: var(--accent);
}

.json-key {
  color: var(--text);
  font-weight: 600;
}

.json-string { color: var(--green); }
.json-number { color: var(--accent); }
.json-boolean { color: #e67e22; }
.json-null { color: var(--text-muted); font-style: italic; }
.json-bracket { color: var(--text-muted); }
.json-count { color: var(--text-muted); font-size: 10px; font-style: italic; }

/* CSV table */
.csv-table-wrapper {
  overflow-x: auto;
  padding: 8px;
}

.csv-table {
  border-collapse: collapse;
  font-family: 'SF Mono', Consolas, 'Menlo', monospace;
  font-size: 12px;
  width: 100%;
}

.csv-table th,
.csv-table td {
  border: 1px solid var(--border);
  padding: 4px 10px;
  text-align: left;
  white-space: nowrap;
}

.csv-table th {
  background: var(--input-bg);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.csv-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--input-bg) 50%, var(--bg));
}

/* Image preview */
.image-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 200px;
}

.image-preview img {
  max-width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: scale-down; /* fill the panel but never upscale */
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-preview .image-filename {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.video-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 200px;
}

.video-preview video {
  max-width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.audio-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  min-height: 100px;
}

.audio-preview audio {
  width: 100%;
  max-width: 500px;
}

.media-filename {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.binary-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  min-height: 200px;
  color: var(--text-muted);
  font-size: 14px;
}

/* HTML preview */
.html-preview {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.html-preview-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  flex-shrink: 0;
}

.html-tab {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

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

.html-preview-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: white;
  min-height: 300px;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

.html-source {
  overflow: auto;
  flex: 1;
}

/* Plain text fallback */
.full-file-content-pre {
  margin: 0;
  padding: 12px;
  font-family: 'SF Mono', Consolas, 'Menlo', monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Chat item wrapper - invisible to flex layout */
.chat-item {
    display: contents;
}

/* Activity Status Pills */
.activity-pills {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin: 4px 0;
}

.activity-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-family: var(--font-mono, monospace);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-pill.active {
    background: #1a2a1a;
    border: 1px solid #3a4a3a;
    color: #7cb87c;
}

.activity-pill.completed {
    background: #2a2a3a;
    border: 1px solid #3a3a4a;
    color: #6a7a8a;
}

.activity-pill.stale {
    background: #2a1a0a;
    border: 1px solid #5a4a2a;
    color: #c8a040;
}

.activity-pill.disconnected {
    background: #2a0a0a;
    border: 1px solid #5a2a2a;
    color: #c05050;
}

.pill-icon {
    flex-shrink: 0;
}

.pill-icon.pulse {
    animation: pill-pulse 1.5s ease-in-out infinite;
}

@keyframes pill-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.pill-duration {
    margin-left: 4px;
    opacity: 0.6;
    font-size: 10px;
}

/* Shortcut drag-and-drop reorder */
.shortcut-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.shortcut-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    padding: 4px;
    flex-shrink: 0;
    touch-action: none;
}

.shortcut-drag-handle:hover {
    color: var(--text-primary);
}

.shortcut-row.dragging {
    opacity: 0.4;
}

.shortcut-row.drag-over-above {
    border-top: 2px solid var(--accent);
}

.shortcut-row.drag-over-below {
    border-bottom: 2px solid var(--accent);
}

@media (max-width: 768px) {
    .shortcut-drag-handle {
        padding: 10px;
        font-size: 18px;
    }
}

/* Shortcut picker trigger button */
.shortcut-picker-btn {
  background: var(--bg-secondary, #f3f4f6);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
}
.shortcut-picker-btn:hover {
  background: var(--bg-tertiary, #e5e7eb);
}
.shortcut-picker-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Shortcut picker popup */
.shortcut-picker-popup {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  max-width: 400px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 4px;
}
.shortcut-picker-empty {
  grid-column: 1 / -1;
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.shortcut-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  min-width: 48px;
  min-height: 48px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 20px;
  transition: background 0.1s, transform 0.1s;
}
.shortcut-picker-item:hover {
  background: var(--bg-secondary);
}
.shortcut-picker-item:active {
  background: var(--bg-tertiary, #d1d5db);
  transform: scale(0.95);
}
.shortcut-picker-key {
  font-weight: 600;
  flex-shrink: 0;
  font-size: 20px;
  min-width: auto;
  text-align: center;
}

.shortcut-picker-item--shell {
  background: rgba(34, 197, 94, 0.15);
}
.shortcut-picker-item--shell:hover {
  background: rgba(34, 197, 94, 0.25);
}

/* Shortcut picker backdrop — hidden on desktop */
.shortcut-picker-backdrop {
  display: none;
}

/* Mobile shortcut picker — emoji-picker-style grid */
@media (max-width: 768px) {
  .shortcut-picker-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 99;
  }
  .shortcut-picker-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-width: 100%;
    max-height: 45vh;
    border-radius: 16px 16px 0 0;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 6px;
    z-index: 100;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-bottom: none;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
  }
  .shortcut-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 10px;
    font-size: 24px;
    -webkit-tap-highlight-color: transparent;
  }
  .shortcut-picker-item:active {
    background: var(--bg-tertiary, #d1d5db);
    transform: scale(0.92);
  }
  .shortcut-picker-key {
    font-size: 24px;
    min-width: auto;
  }
  .shortcut-picker-empty {
    grid-column: 1 / -1;
    padding: 24px;
    font-size: 14px;
  }
}


/* Image upload button */
.image-upload-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.image-upload-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.image-upload-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Voice chat toggle button */
.voice-chat-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
  position: relative;
}
.voice-chat-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.voice-chat-btn.active {
  color: #dc2626;
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}
.voice-chat-btn.active.listening {
  animation: voice-pulse 1.5s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

/* Model selector styled as toolbar button */
.model-select-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary, #6b7280);
  font-size: 0.75rem;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  transition: background 0.15s;
}
.model-select-btn:hover {
  background: var(--bg-tertiary, #e5e7eb);
}

/* Image preview strip */
.image-preview-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.image-preview-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.image-preview-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-preview-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 4px;
  line-height: 1;
}
.image-preview-remove:hover {
  color: var(--danger, #ef4444);
}

/* Shell mode toggle button */
.shell-toggle-btn {
  background: var(--bg-secondary, #f3f4f6);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: monospace;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  flex-shrink: 0;
}
.shell-toggle-btn.active {
  background: #1a1a2e;
  color: #4ade80;
  border-color: #4ade80;
}

/* Shell input styling */
.shell-input {
  font-family: monospace !important;
  background: #1a1a2e !important;
  color: #e2e8f0 !important;
}

/* Shell command block */
.shell-command-block {
  background: #1a1a2e;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 4px 0;
}
.shell-header {
  font-family: monospace;
  font-size: 13px;
  color: #e2e8f0;
}
.shell-prompt {
  color: #4ade80;
  font-weight: bold;
  margin-right: 6px;
}
.shell-cmd {
  color: #e2e8f0;
}

/* Shell output block */
.shell-output-block {
  background: #1a1a2e;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 0 0 4px 0;
  border-top: 1px solid #2d2d44;
}
.shell-stdout {
  font-family: monospace;
  font-size: 12px;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  padding: 0;
}
.shell-stderr {
  font-family: monospace;
  font-size: 12px;
  color: #f87171;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  padding: 0;
}

/* Exit code badges */
.shell-exit {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid #2d2d44;
}
.exit-badge {
  font-family: monospace;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
}
.exit-success {
  background: #166534;
  color: #4ade80;
}
.exit-error {
  background: #7f1d1d;
  color: #f87171;
}

/* Slash command autocomplete */
.slash-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 4px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
  z-index: 100;
}
.slash-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.875rem;
}
.slash-menu-item:hover, .slash-menu-item.selected {
  background: var(--accent);
  color: #fff;
}
.slash-menu-item.selected .slash-cmd-desc,
.slash-menu-item.selected .slash-cmd-hint,
.slash-menu-item.selected .slash-cmd-source {
  color: rgba(255,255,255,0.8);
}
.slash-cmd-name {
  font-weight: 600;
  white-space: nowrap;
}
.slash-cmd-hint {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.8rem;
  white-space: nowrap;
}
.slash-cmd-desc {
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slash-cmd-source {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

/* AskUserQuestion card */
.question-card {
  background: var(--card);
  border: 1px solid var(--yellow);
  border-radius: 12px;
  padding: 16px;
  margin: 8px 0;
  max-width: 600px;
}
.question-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.question-header {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--yellow);
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}
.question-text {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
}
.question-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.question-option-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}
.question-option-btn:hover:not(:disabled) {
  border-color: var(--yellow);
  background: rgba(245, 158, 11, 0.08);
}
.question-option-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.question-option-btn.selected {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.1);
}
.question-option-btn .option-label {
  font-size: 0.85rem;
  font-weight: 500;
}
.question-option-btn .option-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.question-other {
  margin-top: 4px;
  display: flex;
  gap: 8px;
  width: 100%;
}
.question-other-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}
.question-other-input:focus {
  border-color: var(--yellow);
}
.question-other-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--yellow);
  color: #000;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.question-other-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.question-answered {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 0;
}

@media (max-width: 768px) {
  .question-card {
    max-width: 100%;
  }
}
