@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --bg: #0f1117;
  --surface: #161b22;
  --surface2: #21262d;
  --border: #444c56;
  --text: #e6edf3;
  --muted: #adbac7;
  --accent: #f78166;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --blue: #58a6ff;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Toolbar */
#toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.logo svg { width: 22px; height: 22px; }

.divider-v {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 6px;
}

.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s;
  white-space: nowrap;
  height: 34px;
  min-width: 70px;
  background: var(--surface2);
  color: var(--text);
  user-select: none;
}
.btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--blue);
}
.btn:active {
  border-bottom: 2px solid var(--blue);
  padding-bottom: 6px;
}

#btn-run {
  background: var(--green);
  color: #000;
  border-color: var(--green);
  font-weight: 600;
  min-width: 80px;
}
#btn-run:hover {
  filter: brightness(1.15);
  background: var(--green);
  color: #000;
}
#btn-run:active {
  border-bottom: 2px solid #2a6a3a;
  padding-bottom: 4px;
}
#btn-run:disabled {
  background: #2a3a2a;
  color: #4a6a4a;
  border-color: #2a3a2a;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--blue);
}
.btn-ghost:active {
  border-bottom: 2px solid var(--blue);
  padding-bottom: 6px;
}

.mode-select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  height: 36px;
}
.mode-select:hover {
  border-color: var(--blue);
  color: var(--text);
  background: var(--surface);
}
.mode-select:focus {
  border-color: var(--blue);
}

/* Donate button */
.donate-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: #ff9800;
  color: #000;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
  margin-left: 8px;
}
.donate-btn:hover {
  background: #e68900;
  transform: translateY(-1px);
}

#toolbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

kbd {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--muted);
  font-family: inherit;
}

#btn-settings {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
#btn-settings:hover { background: var(--surface); color: var(--text); border-color: var(--blue); }
#btn-settings:active { background: var(--blue); color: #000; }

/* User display and sign out */
#user-display {
  font-size: 12px;
  color: var(--text);
  margin-left: 8px;
  padding: 4px 8px;
  background: var(--surface2);
  border-radius: 4px;
  border: 1px solid var(--border);
}
#user-display:empty { display: none; }

#btn-signout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
#btn-signout:hover { background: var(--red); color: white; border-color: var(--red); }
#btn-signout:active { opacity: 0.8; }

/* Settings panel */
#settings-panel {
  position: absolute;
  top: 56px;
  right: 12px;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  z-index: 100;
  display: none;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#settings-panel.open { display: flex; }

.setting-row { display: flex; flex-direction: column; gap: 8px; }
.setting-label { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.setting-control {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  height: 48px;
}
.settings-actions { margin-top: 4px; }
.settings-actions .btn { width: 100%; justify-content: center; }

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

/* Hamburger button */
.btn-icon {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  height: 34px;
  transition: all 0.12s;
}
.btn-icon:hover { background: #2a3036; color: var(--text); border-color: #484f58; }
.btn-icon:active { border-bottom: 2px solid var(--blue); padding-bottom: 6px; }

/* Main layout */
#main {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: 0;
  min-width: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.15s ease-out, min-width 0.15s ease-out;
}
#sidebar.open {
  width: 300px;
  min-width: 200px;
  max-width: 500px;
  position: relative;
}
body.sidebar-resizing #sidebar {
  transition: none;
}

#sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  z-index: 10;
}
#sidebar-resize-handle:hover,
#sidebar-resize-handle.dragging {
  background: var(--blue);
}
body.sidebar-resizing {
  cursor: ew-resize !important;
  user-select: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.sidebar-actions {
  display: flex;
  gap: 4px;
}
.sidebar-btn {
  background: #2d333b;
  border: 1px solid #444c56;
  color: #adbac7;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
  transition: all 0.12s;
}
.sidebar-btn:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

#file-tree {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  font-size: 14px;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}
#file-tree::-webkit-scrollbar { width: 6px; }
#file-tree::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

.tree-item {
  display: flex;
  align-items: center;
  padding: 5px 8px;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  font-weight: 400;
  color: var(--muted);
  gap: 8px;
  position: relative;
}
.tree-item:hover { background: var(--surface2); color: var(--text); }
.tree-item.active { background: rgba(88, 166, 255, 0.15); color: var(--text); }
.tree-item.file .tree-delete {
  position: absolute;
  right: 8px;
  opacity: 0.5;
  color: var(--muted);
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
}
.tree-item.file:hover .tree-delete { opacity: 0.8; }
.tree-item.file .tree-delete:hover { opacity: 1; color: var(--red); }

.tree-icon { font-size: inherit; flex-shrink: 0; }
.tree-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: inherit; }

.tree-item.folder { font-weight: 500; color: var(--text); }
.tree-item.folder.selected { background: rgba(88, 166, 255, 0.2); border-left: 2px solid var(--blue); }
.tree-item.folder.collapsed .tree-folder::before { content: '▶'; font-size: 8px; margin-right: 4px; }
.tree-item.folder:not(.collapsed) .tree-folder::before { content: '▼'; font-size: 8px; margin-right: 4px; }

.tree-children { }
.tree-children.collapsed { display: none; }

/* Project items in tree */
.tree-project {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.tree-project:hover { background: #2a3036; color: var(--text); }
.tree-project.active {
  background: rgba(88, 166, 255, 0.15);
  color: var(--text);
  border-left: 3px solid var(--blue);
}
.tree-project-icon { font-size: 14px; }
.tree-project-name { flex: 1; font-size: inherit; }
.tree-project-type {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  padding: 2px 6px;
  background: var(--surface);
  border-radius: 4px;
  color: var(--muted);
}
.tree-project.active .tree-project-type { background: rgba(88, 166, 255, 0.2); color: var(--blue); }
.tree-project-delete {
  opacity: 0.5;
  color: var(--muted);
  font-size: 18px;
  padding: 0 4px;
  cursor: pointer;
}
.tree-project:hover .tree-project-delete { opacity: 0.8; }
.tree-project-delete:hover { opacity: 1 !important; color: var(--red); }
.tree-project-settings {
  opacity: 0.5;
  color: var(--muted);
  font-size: 18px;
  padding: 0 4px;
  cursor: pointer;
}
.tree-project:hover .tree-project-settings { opacity: 0.8; }
.tree-project-settings:hover { opacity: 1 !important; color: var(--blue); }

.tree-project-files {
  padding: 4px 0;
}

/* Add button in folder */
.tree-add-btn {
  opacity: 0.5;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0 6px;
  margin-left: auto;
}
.tree-item.folder:hover .tree-add-btn { opacity: 0.8; }
.tree-add-btn:hover { opacity: 1 !important; color: var(--blue); }

/* Context Menu */
.context-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 160px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  display: none;
}
.context-menu.visible {
  display: block;
}
.context-menu-item {
  padding: 6px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.context-menu-item:hover {
  background: var(--hover);
}
.context-menu-item[data-danger="true"] {
  color: var(--red);
}
.context-menu-item[data-danger="true"]:hover {
  background: rgba(248, 81, 73, 0.1);
}
.context-menu-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.context-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Add file context */
.add-file-context {
  font-size: 12px;
  color: var(--blue);
  background: rgba(88, 166, 255, 0.1);
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-family: 'Cascadia Code', monospace;
}

/* Cargo template dropdown */
.cargo-template-select {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  height: 28px;
  margin-left: 8px;
}
.cargo-template-select:hover {
  border-color: var(--blue);
  color: var(--text);
}
.cargo-template-select:focus {
  outline: none;
  border-color: var(--blue);
}

/* Workspace (editor + output) */
#workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* File tabs */
#file-tabs-container {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 36px;
  padding: 0 8px;
  gap: 4px;
  flex-shrink: 0;
}

#file-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  flex: 1;
}

.file-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  height: 30px;
  transition: all 0.12s;
}
.file-tab:hover { color: var(--text); border-color: #484f58; background: #2a3036; }
.file-tab:active { border-bottom: 2px solid var(--blue); padding-bottom: 4px; }
.file-tab.active {
  background: var(--bg);
  color: var(--text);
  border-color: var(--blue);
}
.file-tab .tab-close {
  opacity: 0;
  font-size: 14px;
  line-height: 1;
  padding: 2px;
  border-radius: 3px;
  transition: all 0.12s;
}
.file-tab:hover .tab-close { opacity: 0.6; }
.file-tab .tab-close:hover { opacity: 1; color: var(--red); background: rgba(248, 81, 73, 0.15); }

#btn-add-file {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
#btn-add-file:hover { background: #2a3036; color: var(--text); border-color: #484f58; }
#btn-add-file:active { border-bottom: 2px solid var(--blue); }

#editor-output-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#editor-pane {
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--bg);
}

#monaco-container {
  width: 100%;
  height: 100%;
  background: var(--bg);
}

/* ===== Editor Status Bar ===== */
#editor-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 32px;
  padding: 0 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 14px;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  color: var(--muted);
  flex-shrink: 0;
}

.status-left, .status-center, .status-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-sep {
  color: var(--border);
  margin: 0 2px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.ready {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.status-dot.running {
  background: var(--yellow);
  box-shadow: 0 0 6px var(--yellow);
  animation: pulse 1s infinite;
}

.status-dot.success {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.status-dot.error {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.status-conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-conn-dot.connected {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.status-conn-dot.disconnected {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.status-conn-dot.connecting {
  background: var(--yellow);
  animation: pulse 1s infinite;
}

/* Status bar app type */
.status-app-type {
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}
.status-native {
  color: var(--green);
  background: rgba(63, 185, 80, 0.15);
}
.status-wasm {
  color: var(--blue);
  background: rgba(88, 166, 255, 0.15);
}

/* Status bar active module indicator */
.status-active-module {
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--yellow);
  background: rgba(210, 153, 34, 0.15);
  cursor: default;
}

/* Status bar user tier */
.status-user-tier {
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}
.status-tier-evaluate {
  color: var(--muted);
  background: rgba(128, 128, 128, 0.15);
}
.status-tier-collaborate {
  color: var(--accent);
  background: rgba(139, 92, 246, 0.15);
}
.status-tier-innovate {
  color: var(--yellow);
  background: rgba(245, 158, 11, 0.15);
}

#info-workspace-name {
  color: var(--blue);
  font-weight: 600;
}

#info-file-name {
  color: var(--text);
  font-family: 'Fira Code', monospace;
}

#status-cursor, #status-lines {
  font-family: 'Fira Code', monospace;
}

.status-selection {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  font-family: 'Fira Code', monospace;
}

#status-lang {
  color: var(--accent);
  font-weight: 500;
}

.status-warn {
  color: var(--yellow);
}

.status-err {
  color: var(--red);
}

#info-warnings, #info-errors {
  font-weight: 600;
}

.status-compile-ready { color: var(--muted); }
.status-compile-running { color: var(--yellow); font-weight: 500; }
.status-compile-success { color: var(--green); font-weight: 600; }
.status-compile-error { color: var(--red); font-weight: 600; }

/* Preview containers */
.preview-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: 40px;
}

.preview-title {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.preview-info {
  color: var(--muted);
  font-size: 13px;
  font-family: 'Fira Code', monospace;
}

.preview-content {
  flex: 1;
  overflow: auto;
}

/* Image preview */
.image-preview-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: repeating-conic-gradient(var(--surface) 0% 25%, var(--bg) 0% 50%) 50% / 20px 20px;
}

#image-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

/* Markdown preview */
.preview-tabs {
  display: flex;
  gap: 4px;
}

.preview-tab {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

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

.preview-tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.markdown-preview-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.md-editor-pane {
  flex: 1;
  overflow: hidden;
  background: var(--bg);
  min-height: 0;
}

#monaco-md-container {
  width: 100%;
  height: 100%;
  background: var(--bg);
}

.md-preview-pane {
  flex: 1;
  overflow: auto;
  padding: 24px 32px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.7;
}

/* Markdown rendered styles */
.md-preview-pane h1,
.md-preview-pane h2,
.md-preview-pane h3,
.md-preview-pane h4,
.md-preview-pane h5,
.md-preview-pane h6 {
  color: var(--text);
  margin: 1.5em 0 0.5em;
  font-weight: 600;
  line-height: 1.3;
}

.md-preview-pane h1 { font-size: 2em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.md-preview-pane h2 { font-size: 1.5em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.md-preview-pane h3 { font-size: 1.25em; }
.md-preview-pane h4 { font-size: 1em; }

.md-preview-pane p {
  margin: 1em 0;
}

.md-preview-pane a {
  color: var(--blue);
  text-decoration: none;
}

.md-preview-pane a:hover {
  text-decoration: underline;
}

.md-preview-pane code {
  background: var(--surface);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
  font-size: 0.9em;
  color: var(--accent);
}

.md-preview-pane pre {
  background: var(--surface);
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1em 0;
}

.md-preview-pane pre code {
  background: transparent;
  padding: 0;
  color: var(--text);
}

.md-preview-pane blockquote {
  border-left: 4px solid var(--blue);
  margin: 1em 0;
  padding: 0.5em 1em;
  background: var(--surface);
  color: var(--muted);
}

.md-preview-pane ul,
.md-preview-pane ol {
  margin: 1em 0;
  padding-left: 2em;
}

.md-preview-pane li {
  margin: 0.5em 0;
}

.md-preview-pane table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.md-preview-pane th,
.md-preview-pane td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.md-preview-pane th {
  background: var(--surface);
  font-weight: 600;
}

.md-preview-pane tr:nth-child(even) {
  background: var(--surface);
}

.md-preview-pane hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.md-preview-pane img {
  max-width: 100%;
  border-radius: 4px;
}

#drag-handle {
  width: 4px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
}
#drag-handle:hover, #drag-handle.dragging { background: var(--blue); }

/* Output pane */
#output-pane {
  width: 40%;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transition: width 0.2s, min-width 0.2s;
}

#output-pane.collapsed {
  width: 36px;
  min-width: 36px;
}

#output-pane.collapsed #out-tabs,
#output-pane.collapsed .out-tab-content,
#output-pane.collapsed #drag-handle {
  display: none;
}

#output-pane.collapsed #out-tab-bar {
  flex-direction: column;
  height: 100%;
  padding: 8px 0;
}

#output-pane.collapsed #btn-toggle-output {
  transform: rotate(-90deg);
}

#btn-toggle-output {
  transition: transform 0.2s;
}

#out-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 36px;
}

#out-toolbar-left { display: flex; gap: 6px; align-items: center; }
#out-toolbar-right { display: flex; gap: 4px; align-items: center; margin-left: auto; }
#out-toolbar-title { font-size: 12px; color: var(--muted); font-weight: 500; }
#out-toolbar-actions { display: flex; gap: 6px; }

.out-icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.out-icon-btn:hover {
  background: var(--surface2);
  color: var(--fg);
}
.out-icon-btn svg {
  display: block;
}

.out-tool-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.out-tool-btn:hover { background: #2a3036; color: var(--text); border-color: #484f58; }
.out-tool-btn:active { border-bottom: 2px solid var(--blue); padding-bottom: 4px; }

#out-unified {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#out-unified::-webkit-scrollbar { width: 6px; }
#out-unified::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

.out-section { white-space: pre-wrap; word-break: break-word; }
#out-compile { color: var(--muted); font-size: 12px; margin-bottom: 8px; white-space: pre-wrap; word-break: break-word; }
#out-compile:empty { margin-bottom: 0; }
#out-stdout { color: var(--text); white-space: pre-wrap; word-break: break-word; }

/* Xterm.js terminal container */
#xterm-container {
  flex: 1;
  min-height: 200px;
  background: #0d1117;
  border-radius: 4px;
  overflow: hidden;
}
#xterm-container .xterm {
  height: 100%;
  padding: 8px;
}
#xterm-container .xterm-viewport {
  overflow-y: auto !important;
}
#xterm-container:empty {
  display: none;
}

.err-line { color: var(--red); }
.warn-line { color: var(--yellow); }
.muted { color: var(--muted); font-style: italic; }

#rust-canvas {
  border: 1px solid var(--border);
  image-rendering: pixelated;
  width: 100%;
  height: auto;
  display: none;
  margin-top: 8px;
}
#rust-canvas.visible { display: block; }

/* Terminal Collapsible Section */
.terminal-section {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.terminal-section-header {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.terminal-section-header:hover {
  background: var(--surface2);
}

.section-chevron {
  font-size: 10px;
  margin-right: 8px;
  transition: transform 0.2s;
  color: var(--muted);
}

.terminal-section.collapsed .section-chevron {
  transform: rotate(-90deg);
}

.terminal-section.collapsed .terminal-section-content {
  display: none;
}

.section-title {
  flex: 1;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.section-copy-btn {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, background 0.15s;
}

.terminal-section-header:hover .section-copy-btn {
  opacity: 1;
}

.section-copy-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.terminal-section-content {
  padding: 12px 16px;
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 0;
}

.terminal-section-content::-webkit-scrollbar { width: 6px; }
.terminal-section-content::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

/* Editor Toolbar */
#editor-toolbar {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 4px;
  flex-shrink: 0;
}

.editor-toolbar-group {
  display: flex;
  gap: 2px;
}

.editor-toolbar-separator {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.editor-tool-btn {
  height: 26px;
  padding: 0 8px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s, color 0.15s;
  font-size: 11px;
  font-family: inherit;
}

.editor-tool-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.editor-tool-btn:active {
  background: var(--blue);
  color: white;
}

.editor-tool-btn svg {
  display: block;
  flex-shrink: 0;
}

.editor-tool-btn .btn-label {
  white-space: nowrap;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px;
  width: 520px;
  max-width: 90vw;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(88, 166, 255, 0.1);
}
.modal h3 { font-size: 20px; font-weight: 600; margin-bottom: 20px; color: var(--text); }
.modal input[type="text"] {
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.modal input[type="text"]:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2); }
.modal input[type="text"]::placeholder { color: var(--muted); }
.modal textarea {
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.modal textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2); }
.modal textarea::placeholder { color: var(--muted); }
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}
.form-group input,
.form-group textarea,
.form-group select {
  margin-top: 0;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}
.modal-actions .btn {
  padding: 12px 24px;
  font-size: 14px;
  height: 44px;
}

/* Save dialog tabs */
.save-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.save-tab {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.save-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}
.save-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.save-tab-content {
  min-height: 80px;
}

/* Share options */
.share-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.share-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.share-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

/* Wide modal for app settings */
.modal.modal-wide {
  width: 680px;
  max-height: 85vh;
  overflow-y: auto;
}

/* App settings sections */
/* Modal tabs */
.modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: 16px -20px 20px -20px;
  padding: 0 20px;
  background: var(--surface);
}

.modal-tab {
  flex: 1;
  padding: 14px 20px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
  font-family: inherit;
}

.modal-tab:hover {
  color: var(--text);
  background: var(--surface2);
}

.modal-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: var(--bg);
}

.modal-tab-content {
  display: none;
}

.modal-tab-content.active {
  display: block;
}

.app-settings-section {
  margin-bottom: 28px;
}
.app-settings-section h4 {
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--blue);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* Key-value list for args/env */
.kv-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.kv-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.kv-input {
  flex: 1;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: 'Cascadia Code', monospace;
  outline: none;
  height: 48px;
}
.kv-input:focus { border-color: var(--blue); }
.kv-input.env-key { max-width: 180px; text-transform: uppercase; }
.kv-eq { color: var(--muted); font-weight: 600; font-size: 16px; }
.kv-remove {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.12s;
}
.kv-remove:hover { background: rgba(248, 81, 73, 0.15); color: var(--red); border-color: var(--red); }

.setting-hint {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.stdin-textarea {
  width: 100%;
  min-height: 120px;
  max-height: 240px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 15px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  outline: none;
  resize: vertical;
}
.stdin-textarea:focus { border-color: var(--blue); }
.stdin-textarea::placeholder { color: var(--muted); }

/* Contributors section */
.contributors-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 150px;
  overflow-y: auto;
}
.contributor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.contributor-item .contributor-id {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}
.contributor-item .contributor-role {
  font-size: 12px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.contributor-item .contributor-role.viewer {
  background: rgba(88, 166, 255, 0.15);
  color: var(--blue);
}
.contributor-item .contributor-role.editor {
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
}
.contributor-item .contributor-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.12s;
}
.contributor-item .contributor-remove:hover {
  background: rgba(248, 81, 73, 0.15);
  color: var(--red);
}
.contributor-add-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-small {
  padding: 8px 14px;
  font-size: 14px;
  height: 36px;
  min-width: auto;
}

/* Stats modal */
.modal-stats {
  width: 480px;
}
.stats-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface2);
  border-radius: 10px;
  font-size: 15px;
  border: 1px solid var(--border);
}
.stat-label { color: var(--muted); font-weight: 500; font-size: 15px; }
.stat-value { font-weight: 600; font-family: 'Fira Code', monospace; font-size: 15px; }
.stat-success { color: var(--green); font-weight: 600; }
.stat-error { color: var(--red); font-weight: 600; }
.stat-warning { color: var(--yellow); font-weight: 600; }

/* Stats button disabled state */
#btn-stats:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Copy button feedback */
.out-tool-btn.copy-success { background: var(--green); color: #000; border-color: var(--green); }
.out-tool-btn.copy-error { background: var(--red); color: #fff; border-color: var(--red); }
.out-tool-btn.copy-feedback { background: var(--yellow); color: #000; border-color: var(--yellow); }

/* WASM tab */
.file-tab.wasm-tab {
  background: rgba(88, 166, 255, 0.15);
  border-color: var(--blue);
  color: var(--blue);
}
.file-tab.wasm-tab.active {
  background: var(--bg);
  color: var(--blue);
  border-color: var(--blue);
}

/* Diff tab (git diff viewer in tabs) */
.file-tab.diff-tab {
  background: rgba(210, 153, 34, 0.15);
  border-color: var(--yellow);
  color: var(--text);
}
.file-tab.diff-tab.active {
  background: var(--bg);
  color: var(--text);
  border-color: var(--yellow);
}
.file-tab.diff-tab .diff-icon {
  color: var(--yellow);
  font-weight: bold;
  margin-right: 2px;
}
.file-tab.diff-tab .diff-badge {
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
}
.file-tab.diff-tab .diff-badge.new {
  background: rgba(63, 185, 80, 0.25);
  color: var(--green);
}
.file-tab.diff-tab .diff-badge.modified {
  background: rgba(210, 153, 34, 0.25);
  color: var(--yellow);
}

/* Diff preview container (in-tab diff viewer) */
#diff-preview-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 10;
}
#diff-tab-editor {
  flex: 1;
  min-height: 0;
}

/* WASM preview container */
#wasm-preview-container {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #0d1117;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.wasm-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--blue);
  font-weight: 600;
  flex-shrink: 0;
}

.wasm-preview-canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #05080f;
  overflow: auto;
  min-height: 0;
}

#wasm-preview-container canvas {
  border: 1px solid var(--border);
  image-rendering: pixelated;
  display: block;
}

/* Interactive stdin */
#stdin-container {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 0;
}

#stdin-bar {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

#stdin-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#stdin-timer {
  font-size: 12px;
  color: var(--muted);
  font-family: 'Fira Code', monospace;
}

#stdin-timer.warning {
  color: var(--yellow);
}

#stdin-timer.critical {
  color: var(--red);
  animation: blink 0.5s infinite;
}

@keyframes blink {
  50% { opacity: 0.5; }
}

#stdin-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: none;
  color: var(--text);
  font-family: 'Fira Code', 'JetBrains Mono', monospace;
  font-size: 14px;
  outline: none;
}

#stdin-input:focus {
  background: #0d1117;
}

#stdin-input::placeholder {
  color: var(--muted);
}

#btn-run-interactive {
  background: transparent;
  color: var(--green);
  border-color: var(--green);
}

#btn-run-interactive:hover {
  background: rgba(63, 185, 80, 0.1);
}

#btn-run-interactive:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#btn-stop-interactive {
  background: var(--red);
  color: white;
  border: none;
}

#btn-stop-interactive:hover {
  background: #da3633;
}

/* Stdin echo in output */
.stdin-echo {
  color: var(--blue);
  opacity: 0.7;
}

/* ===== Find Files / Search Code Modal (Telescope-style) ===== */
.finder-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 300;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  backdrop-filter: blur(4px);
}
.finder-overlay.open {
  display: flex;
}

.finder-modal {
  width: 720px;
  max-width: 90vw;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(88, 166, 255, 0.15);
  overflow: hidden;
}

.finder-modal-wide {
  width: 860px;
}

.finder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.finder-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.finder-count {
  font-size: 14px;
  color: var(--muted);
  font-family: 'Fira Code', monospace;
}

.finder-input-row {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  gap: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.finder-prompt {
  color: var(--green);
  font-family: 'Fira Code', monospace;
  font-weight: 600;
  font-size: 20px;
}

.finder-input-row input[type="text"] {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 17px;
  font-family: 'Fira Code', 'JetBrains Mono', monospace;
  outline: none;
  padding: 4px 0;
}

.finder-input-row input[type="text"]::placeholder {
  color: var(--muted);
}

.finder-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Fira Code', monospace;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  user-select: none;
}

.finder-checkbox:hover {
  border-color: var(--blue);
  color: var(--text);
}

.finder-checkbox input[type="checkbox"] {
  display: none;
}

.finder-checkbox:has(input:checked) {
  background: rgba(88, 166, 255, 0.2);
  border-color: var(--blue);
  color: var(--blue);
}

.finder-results {
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg);
}

.finder-results-tall {
  max-height: 500px;
}

.finder-results::-webkit-scrollbar {
  width: 8px;
}

.finder-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.finder-results::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

/* File result item */
.finder-file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  cursor: pointer;
  font-size: 15px;
  color: var(--muted);
  border-left: 3px solid transparent;
}

.finder-file-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.finder-file-item.selected {
  background: rgba(88, 166, 255, 0.15);
  color: var(--text);
  border-left-color: var(--blue);
}

.finder-file-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.finder-file-icon.rs { color: #f78166; }
.finder-file-icon.toml { color: #7d8590; }
.finder-file-icon.md { color: #58a6ff; }
.finder-file-icon.json { color: #d29922; }
.finder-file-icon.folder { color: #58a6ff; }

.finder-file-path {
  flex: 1;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finder-file-project {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface2);
  padding: 4px 10px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Search code result item */
.finder-search-item {
  padding: 14px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--border);
}

.finder-search-item:last-child {
  border-bottom: none;
}

.finder-search-item:hover {
  background: var(--surface2);
}

.finder-search-item.selected {
  background: rgba(88, 166, 255, 0.15);
  border-left-color: var(--blue);
}

.finder-search-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.finder-search-file {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-family: 'Fira Code', monospace;
}

.finder-search-line {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface2);
  padding: 3px 8px;
  border-radius: 4px;
}

.finder-search-preview {
  font-size: 13px;
  font-family: 'Fira Code', monospace;
  color: var(--muted);
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.6;
}

.finder-search-preview mark {
  background: rgba(210, 153, 34, 0.4);
  color: var(--yellow);
  padding: 1px 2px;
  border-radius: 2px;
}

/* Empty state */
.finder-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.finder-empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Keyboard hint */
.finder-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.finder-hint kbd {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: 'Fira Code', monospace;
}

/* ===== Help Modal ===== */
.modal-help {
  width: 640px;
  padding: 0;
  overflow: hidden;
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.help-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.help-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.help-close:hover {
  color: var(--text);
}

.help-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.help-tab {
  flex: 1;
  padding: 14px 20px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
}
.help-tab:hover {
  color: var(--text);
  background: var(--surface2);
}
.help-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: var(--bg);
}

.help-content {
  background: var(--bg);
  max-height: 400px;
  overflow-y: auto;
}

.help-tab-content {
  display: none;
  padding: 20px;
}
.help-tab-content.active {
  display: block;
}

/* Shortcuts tab */
.shortcut-section {
  margin-bottom: 20px;
}
.shortcut-section:last-child {
  margin-bottom: 0;
}

.shortcut-section h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 15px;
}

.shortcut-desc {
  color: var(--text);
}

.shortcut-row kbd {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: 'Fira Code', monospace;
  color: var(--muted);
  margin-left: 6px;
}

/* About tab */
.about-content {
  text-align: center;
  padding: 20px 0;
}

.about-logo {
  margin-bottom: 16px;
}

.about-content h4 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text);
}

.about-version {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 16px 0;
}

.about-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 20px 0;
  padding: 0 20px;
}

.about-features {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.about-feature {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--blue);
}

.about-footer {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

/* Help button style */
#btn-help {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  height: 34px;
  width: 34px;
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
#btn-help:hover {
  background: var(--blue);
  color: #000;
  border-color: var(--blue);
}

/* Project Picker Modal */
.project-picker-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.project-picker-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}

.project-picker-tab:hover {
  background: var(--surface2);
  color: var(--text);
}

.project-picker-tab.active {
  background: var(--blue);
  color: #000;
  border-color: var(--blue);
}

.project-picker-content {
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
}

.cloud-projects-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cloud-project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface2);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.cloud-project-item:hover {
  background: var(--bg-secondary);
  border-color: var(--border);
}

.cloud-project-item.selected {
  border-color: var(--blue);
  background: rgba(88, 166, 255, 0.1);
}

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

.cloud-project-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.cloud-project-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-left: 12px;
}

.cloud-project-item:hover .cloud-project-delete {
  opacity: 1;
}

.cloud-project-delete:hover {
  background: var(--red);
  color: white;
}

.cloud-project-delete:disabled {
  opacity: 0.5;
  cursor: wait;
}

.cloud-project-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.cloud-project-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Templates UI */
.templates-header {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.templates-search-input {
  flex: 1;
  background: var(--surface);
  border: 2px solid #3d444d;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.templates-search-input::placeholder {
  color: #6e7681;
}
.templates-search-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}
.templates-sort-select {
  background: var(--surface);
  border: 2px solid #3d444d;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
}
.templates-sort-select:hover {
  border-color: #58a6ff;
}
.templates-list {
  max-height: 450px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}
.modal-large {
  min-height: 500px;
  display: flex;
  flex-direction: column;
}
.modal-large .project-picker-content {
  flex: 1;
  overflow-y: auto;
  min-height: 350px;
}
.modal-large .modal-actions {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Custom Confirm/Prompt Dialogs - highest z-index to appear above ALL modals including profile (z-index: 10000) */
#confirm-dialog-overlay,
#prompt-dialog-overlay {
  z-index: 50000;
}
.confirm-dialog {
  width: 420px;
  text-align: center;
}
.confirm-dialog h3 {
  margin-bottom: 16px;
}
.confirm-dialog-message {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 24px;
  padding: 0 12px;
}
.confirm-dialog .modal-actions {
  justify-content: center;
  gap: 16px;
}
.confirm-dialog .btn {
  min-width: 100px;
}
.prompt-dialog-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 20px;
}
.prompt-dialog-input:focus {
  outline: none;
  border-color: var(--blue);
}
.template-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--surface2);
  border: 2px solid #3d444d;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.template-item:hover {
  border-color: var(--blue);
  background: rgba(88, 166, 255, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(88, 166, 255, 0.15);
}
.template-item.selected {
  border-color: var(--blue);
  background: rgba(88, 166, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3), 0 4px 16px rgba(88, 166, 255, 0.2);
}
.template-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.template-name {
  font-weight: 600;
  font-size: 15px;
  color: #ffffff;
  letter-spacing: -0.2px;
}
.template-downloads {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
}
.template-downloads::before {
  content: '↓';
  font-size: 11px;
}
.template-description {
  font-size: 13px;
  color: #a8b1ba;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.template-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #8b949e;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.template-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.template-tag {
  background: rgba(88, 166, 255, 0.2);
  color: #79c0ff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(88, 166, 255, 0.3);
}

/* Radio buttons in modals */
.share-option input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

/* User Profile Modal - Sidebar Layout */
#profile-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

#profile-modal.open {
  display: flex;
}

.profile-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 680px;
  max-width: 90vw;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Left Sidebar */
.profile-sidebar {
  width: 220px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.profile-sidebar .profile-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar svg {
  color: var(--muted);
}

.profile-user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-username {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Navigation */
.profile-nav {
  flex: 1;
  padding: 12px 0;
}

.profile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.profile-nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.profile-nav-item.active {
  background: var(--surface);
  color: var(--blue);
  border-left: 3px solid var(--blue);
  padding-left: 13px;
}

.profile-nav-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-nav-item.disabled:hover {
  background: transparent;
  color: var(--muted);
}

.profile-nav-item svg {
  flex-shrink: 0;
}

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

.btn-signout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-signout:hover {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

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

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.profile-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.profile-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
}

.profile-close:hover {
  color: var(--text);
  background: var(--surface2);
}

.profile-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Panes */
.profile-pane {
  display: none;
}

.profile-pane.active {
  display: block;
}

/* Settings */
.profile-setting {
  margin-bottom: 24px;
}

.profile-setting:last-child {
  margin-bottom: 0;
}

.profile-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.profile-setting-desc {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px 0;
}

.profile-select {
  display: block;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.profile-select:hover {
  border-color: var(--muted);
}

.profile-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

/* Coming Soon (Billing) */
.profile-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.profile-coming-soon svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.profile-coming-soon h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
}

.profile-coming-soon p {
  font-size: 13px;
  margin: 0;
}

/* Button styles */
.btn-danger {
  background: var(--red);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn-danger:hover {
  background: #da3633;
}

#btn-profile {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#btn-profile:hover {
  background: var(--surface2);
  color: var(--text);
}

/* Responsive: Stack on mobile */
@media (max-width: 640px) {
  .profile-dialog {
    flex-direction: column;
    width: 95vw;
    max-height: 90vh;
  }

  .profile-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .profile-nav {
    display: flex;
    flex-direction: row;
    padding: 8px;
    gap: 4px;
    overflow-x: auto;
  }

  .profile-nav-item {
    padding: 8px 12px;
    border-radius: 6px;
  }

  .profile-nav-item.active {
    border-left: none;
    padding-left: 12px;
    background: var(--blue);
    color: white;
  }

  .profile-sidebar-footer {
    display: none;
  }

  .profile-main::after {
    content: '';
    display: block;
    padding: 16px;
  }
}

/* ===== Output Pane Tabs ===== */
#out-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 36px;
  flex-shrink: 0;
}

#out-tabs {
  display: flex;
  gap: 0;
}

.out-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
}

.out-tab:hover {
  color: var(--text);
  background: var(--surface2);
}

.out-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.out-tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.out-tab-content.active {
  display: flex;
}

/* Git/Source Control Tab Styles */
#git-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 36px;
}

#git-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.git-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}

.git-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.git-empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

#git-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Git Header Section - Branch name and sync status */
#git-header-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#git-branch-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.git-branch-icon {
  font-size: 16px;
  color: var(--blue);
}

#git-branch-name {
  font-size: 14px;
  font-weight: 600;
  font-family: 'Fira Code', monospace;
  color: var(--text);
}

/* Sync Status Box */
#git-sync-status-box {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

#git-sync-status-box.synced {
  background: rgba(63, 185, 80, 0.15);
  color: #3fb950;
  border-color: rgba(63, 185, 80, 0.3);
}

#git-sync-status-box.ahead {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
  border-color: rgba(88, 166, 255, 0.3);
}

#git-sync-status-box.behind {
  background: rgba(240, 136, 62, 0.15);
  color: #f0883e;
  border-color: rgba(240, 136, 62, 0.3);
}

#git-sync-status-box.diverged {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
  border-color: rgba(248, 81, 73, 0.3);
}

#git-sync-status-box.no-remote {
  background: var(--surface2);
  color: var(--muted);
  border-color: var(--border);
}

#git-changes-section {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

#git-changes-section h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

#git-changes-section h4:not(:first-child) {
  margin-top: 16px;
}

.git-file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.git-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--surface2);
  border-radius: 4px;
  font-size: 13px;
  font-family: 'Fira Code', monospace;
  cursor: pointer;
  transition: background 0.12s;
}

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

.git-file-status {
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  flex-shrink: 0;
}

.git-file-status.added,
.git-file-status.A {
  background: rgba(63, 185, 80, 0.2);
  color: var(--green);
}

.git-file-status.modified,
.git-file-status.M {
  background: rgba(210, 153, 34, 0.2);
  color: var(--yellow);
}

.git-file-status.deleted,
.git-file-status.D {
  background: rgba(248, 81, 73, 0.2);
  color: var(--red);
}

.git-file-status.untracked,
.git-file-status.U {
  background: rgba(88, 166, 255, 0.2);
  color: var(--blue);
}

.git-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.git-file-name.clickable {
  cursor: pointer;
}
.git-file-name.clickable:hover {
  color: var(--blue);
  text-decoration: underline;
}

.git-file-action {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  opacity: 0;
  transition: all 0.12s;
}

.git-file-item:hover .git-file-action {
  opacity: 1;
}

.git-file-action:hover {
  background: var(--surface);
  color: var(--blue);
}

.git-file-action.discard:hover {
  color: var(--red);
}

.git-file-actions {
  display: flex;
  gap: 2px;
  align-items: center;
}

.git-empty-list {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  padding: 8px;
}

#git-commit-section {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

#git-commit-message {
  width: 100%;
  min-height: 60px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  margin-bottom: 8px;
}

#git-commit-message:focus {
  border-color: var(--blue);
}

#git-commit-message::placeholder {
  color: var(--muted);
}

#git-commit-message:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--surface);
}

#btn-git-commit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.git-commit-actions {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.git-actions-left,
.git-actions-right {
  display: flex;
  gap: 8px;
}

.git-commit-actions .btn {
  min-width: 70px;
}

.btn-primary {
  background: var(--green);
  color: #000;
  border-color: var(--green);
}

.btn-primary:hover {
  filter: brightness(1.1);
  background: var(--green);
  color: #000;
}

#git-history-section {
  padding: 12px;
}

#git-history-section h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

.git-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.git-commit-item {
  background: var(--surface2);
  border-radius: 6px;
  border-left: 3px solid var(--blue);
  overflow: hidden;
}

.git-commit-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.12s;
}

.git-commit-header:hover {
  background: var(--bg);
}

.git-commit-expand {
  font-size: 10px;
  color: var(--muted);
  width: 12px;
  flex-shrink: 0;
  margin-top: 3px;
  transition: transform 0.15s;
}

.git-commit-expand.expanded {
  transform: rotate(0deg);
}

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

.git-commit-top {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
}

.git-commit-hash {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: var(--blue);
  flex-shrink: 0;
}

.git-commit-msg {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.git-commit-meta {
  font-size: 11px;
  color: var(--muted);
}

.git-commit-loading {
  color: var(--blue);
  animation: spin 1s linear infinite;
}

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

/* Local commit styling - unpushed commits */
.git-commit-item.local-commit {
  border-left-color: var(--yellow);
  background: rgba(210, 153, 34, 0.08);
}

.git-commit-local-badge {
  font-size: 9px;
  font-weight: 600;
  color: var(--yellow);
  background: rgba(210, 153, 34, 0.2);
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.git-commit-item .git-commit-actions {
  display: flex;
  gap: 6px;
  padding: 0 12px 10px 32px;
}

.git-reset-btn {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
}

.git-reset-btn:hover {
  background: var(--surface2);
}

.git-reset-btn.soft {
  color: var(--blue);
  border-color: var(--blue);
}

.git-reset-btn.soft:hover {
  background: rgba(88, 166, 255, 0.15);
}

.git-reset-btn.hard {
  color: var(--red);
  border-color: var(--red);
}

.git-reset-btn.hard:hover {
  background: rgba(248, 81, 73, 0.15);
}

.git-commit-files {
  border-top: 1px solid var(--border);
  padding: 8px 12px 8px 32px;
  background: var(--surface);
}

.git-commit-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  margin: 2px 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'Fira Code', monospace;
  transition: background 0.12s;
}

.git-commit-file:hover {
  background: var(--surface2);
}

.git-commit-file.loading {
  opacity: 0.6;
  pointer-events: none;
}

.git-commit-file.loading::after {
  content: ' ⟳';
  animation: spin 1s linear infinite;
  display: inline-block;
}

.git-commit-file-icon {
  font-weight: bold;
  width: 14px;
  text-align: center;
}

.git-commit-file.added .git-commit-file-icon {
  color: var(--green);
}

.git-commit-file.modified .git-commit-file-icon {
  color: var(--yellow);
}

.git-commit-file.deleted .git-commit-file-icon {
  color: var(--red);
}

.git-commit-file-path {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* AI Tab Styles */
#ai-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 36px;
}

#ai-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.ai-message {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.ai-message.user {
  background: var(--surface2);
  color: var(--text);
  margin-left: 24px;
}

.ai-message.assistant {
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.2);
  color: var(--text);
  margin-right: 24px;
}

#ai-input-section {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

#ai-input {
  flex: 1;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  outline: none;
}

#ai-input:focus {
  border-color: var(--blue);
}

#ai-input::placeholder {
  color: var(--muted);
}

.btn-small {
  padding: 4px 8px;
  font-size: 12px;
  height: 24px;
  min-width: auto;
}

/* Diff Viewer Modal */
.diff-viewer-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.diff-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.diff-viewer-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.diff-viewer-icon {
  font-size: 18px;
  color: var(--yellow);
  font-weight: bold;
}

#diff-viewer-filename {
  font-size: 14px;
  font-weight: 600;
  font-family: 'Fira Code', monospace;
  color: var(--text);
}

.diff-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.diff-badge.new {
  background: rgba(63, 185, 80, 0.2);
  color: var(--green);
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.diff-badge.modified {
  background: rgba(210, 153, 34, 0.2);
  color: var(--yellow);
  border: 1px solid rgba(210, 153, 34, 0.3);
}

.diff-badge.deleted {
  background: rgba(248, 81, 73, 0.2);
  color: var(--red);
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.diff-badge.commit {
  background: rgba(88, 166, 255, 0.2);
  color: var(--blue);
  border: 1px solid rgba(88, 166, 255, 0.3);
}

#diff-editor-container {
  flex: 1;
  overflow: hidden;
}

/* Merge Conflict Resolution UI */
.merge-conflict-container {
  background: var(--bg);
  border-radius: 8px;
  width: 95vw;
  height: 90vh;
  max-width: 1600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.merge-conflict-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.merge-conflict-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}

.merge-conflict-icon {
  color: var(--yellow);
  font-size: 20px;
}

.merge-conflict-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(210, 153, 34, 0.2);
  color: var(--yellow);
}

.merge-conflict-actions-header {
  display: flex;
  gap: 8px;
}

.merge-conflict-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.merge-conflict-sidebar {
  width: 250px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.merge-conflict-files-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

#merge-conflict-files-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.merge-conflict-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
}

.merge-conflict-file-item:hover {
  background: var(--surface2);
}

.merge-conflict-file-item.active {
  background: var(--blue);
  color: #fff;
}

.merge-conflict-file-item.resolved {
  opacity: 0.6;
}

.merge-conflict-file-item.resolved::after {
  content: '✓';
  margin-left: auto;
  color: var(--green);
  font-weight: bold;
}

.merge-conflict-file-item.active.resolved::after {
  color: #fff;
}

.merge-conflict-file-icon {
  color: var(--yellow);
  font-size: 14px;
}

.merge-conflict-file-item.resolved .merge-conflict-file-icon {
  color: var(--green);
}

.merge-conflict-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.merge-conflict-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

#merge-conflict-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.merge-conflict-file-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#merge-conflict-filename {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  color: var(--blue);
}

.merge-conflict-file-actions {
  display: flex;
  gap: 8px;
}

.merge-action {
  font-size: 12px;
  padding: 6px 12px;
}

.merge-action.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.merge-conflict-editors {
  flex: 1;
  display: flex;
  gap: 1px;
  background: var(--border);
  overflow: hidden;
}

.merge-editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
}

.merge-editor-pane.merged {
  flex: 1.2;
}

.merge-editor-label {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.merge-editor-pane:first-child .merge-editor-label {
  color: var(--blue);
}

.merge-editor-pane:nth-child(2) .merge-editor-label {
  color: var(--green);
}

.merge-editor-pane.merged .merge-editor-label {
  color: var(--yellow);
}

.merge-editor {
  flex: 1;
  overflow: hidden;
}
