@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;700&display=swap");
:root {
  --font-mono: "Fira Code", "JetBrains Mono", Consolas, Monaco, "Ubuntu Mono", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --bg-base: #060913;
  --bg-sidebar: #0b0f19;
  --bg-editor: #060913;
  --bg-terminal: #0b0f19;
  --bg-tabs: #0b0f19;
  --bg-tab-active: #060913;
  --bg-tab-hover: rgba(255, 255, 255, 0.03);
  --bg-panel-header: #0b0f19;
  --bg-card: #0d1322;
  --bg-card-header: rgba(255, 255, 255, 0.02);
  --bg-input: rgba(0, 0, 0, 0.35);
  --bg-input-focus: rgba(0, 0, 0, 0.55);
  --bg-dropdown: #0b0f19;
  --bg-dropdown-hover: rgba(34, 211, 238, 0.08);
  --bg-button: #3b82f6;
  --bg-button-hover: #2563eb;
  --bg-button-active: #1d4ed8;
  --bg-header-button-hover: rgba(255, 255, 255, 0.08);
  --bg-tooltip: #111827;
  --bg-context-menu: rgba(11, 15, 25, 0.95);
  --bg-context-menu-hover: rgba(34, 211, 238, 0.12);
  --bg-scrollbar: transparent;
  --bg-scrollbar-thumb: rgba(255, 255, 255, 0.12);
  --bg-scrollbar-thumb-hover: rgba(255, 255, 255, 0.25);
  --bg-dragbar: rgba(255, 255, 255, 0.02);
  --bg-dragbar-hover: rgba(34, 211, 238, 0.25);
  --bg-user-message: rgba(59, 130, 246, 0.1);
  --bg-ai-message: rgba(255, 255, 255, 0.015);
  --bg-ai-code: #030712;
  --bg-ai-code-hover: rgba(255, 255, 255, 0.02);
  --bg-ai-log: rgba(255, 255, 255, 0.02);
  --bg-list-hover: rgba(255, 255, 255, 0.03);
  --bg-list-selected: rgba(34, 211, 238, 0.08);
  --bg-statusbar: #0b0f19;
  --bg-details-summary: transparent;
  --bg-details-summary-hover: rgba(255, 255, 255, 0.025);
  --bg-login-overlay: rgba(3, 7, 18, 0.88);
  --bg-login-box: #0b0f19;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-accent: #22d3ee;
  --text-accent-hover: #67e8f9;
  --text-folder: #cbd5e1;
  --text-file: #94a3b8;
  --text-database: #c084fc;
  --text-table: #60a5fa;
  --text-procedure: #34d399;
  --text-tab-active: #f3f4f6;
  --text-tab-inactive: #9ca3af;
  --text-tab-dirty: #fbbf24;
  --text-ai-user: #f3f4f6;
  --text-ai-response: #d1d5db;
  --text-ai-filename: #38bdf8;
  --text-ai-filename-hover: #7dd3fc;
  --text-ai-nochange: #6b7280;
  --text-ai-log: #9ca3af;
  --text-ai-log-code: #f3f4f6;
  --text-ai-log-success: #34d399;
  --text-ai-log-error: #f87171;
  --text-context-menu: #d1d5db;
  --text-context-menu-hover: #ffffff;
  --text-error: #f87171;
  --text-link: #38bdf8;
  --text-summary: #f3f4f6;
  --text-button: #ffffff;
  --text-login: #f3f4f6;
  --text-login-label: #9ca3af;
  --text-dropdown: #f3f4f6;
  --text-header-button: #9ca3af;
  --text-header-button-hover: #ffffff;
  --border-light: rgba(255, 255, 255, 0.05);
  --border-medium: rgba(255, 255, 255, 0.1);
  --border-dark: rgba(0, 0, 0, 0.5);
  --border-accent: #22d3ee;
  --border-focus: #22d3ee;
  --border-ai-user: rgba(34, 211, 238, 0.2);
  --border-ai-response: rgba(255, 255, 255, 0.04);
  --border-ai-code: rgba(255, 255, 255, 0.06);
  --border-ai-code-hover: rgba(34, 211, 238, 0.3);
  --border-ai-log: rgba(255, 255, 255, 0.06);
  --border-button: #3b82f6;
  --border-login-box: rgba(255, 255, 255, 0.08);
  --border-input: rgba(255, 255, 255, 0.08);
  --border-dropdown: rgba(255, 255, 255, 0.1);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  --shadow-overlay: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
  --transition-fast: 100ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-med: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --z-dragbar: 10;
  --z-panel-header: 20;
  --z-dropdown: 100;
  --z-context-menu: 1000;
  --z-modal-overlay: 10000;
  --z-toast-container: 99999;
}

html,
body {
  margin: 0;
  height: 100vh;
  width: 100vw;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Login Overlay (Glassmorphism) ===== */
#login-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bg-login-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#login-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* ===== Login Box ===== */
#login-box {
  background-color: var(--bg-login-box);
  padding: 32px 40px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-login-box);
  box-shadow: var(--shadow-overlay);
  width: 100%;
  max-width: 380px;
  box-sizing: border-box;
  color: var(--text-primary);
  /* Smooth bouncy entrance */
  transform: translateY(20px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#login-overlay.visible #login-box {
  transform: translateY(0) scale(1);
}

#login-box h2 {
  margin-top: 0;
  margin-bottom: 8px;
  color: var(--text-primary);
  text-align: center;
  font-size: 1.5em;
  font-weight: 600;
  letter-spacing: -0.5px;
}

/* ===== Alert Message ===== */
#login-message {
  margin-bottom: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9em;
  line-height: 1.4;
  min-height: 1.2em;
  transition: all 0.2s ease;
}

#login-message.error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 10px 12px;
  border-radius: var(--radius-md);
}

/* ===== Form Elements ===== */
#login-box form .form-group {
  margin-bottom: 20px;
}

#login-box form label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#login-box form input[type=text],
#login-box form input[type=password] {
  width: 100%;
  padding: 12px 14px;
  box-sizing: border-box;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1em;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

#login-box form input::placeholder {
  color: rgba(148, 163, 184, 0.4);
}

#login-box form input[type=text]:focus,
#login-box form input[type=password]:focus {
  outline: none;
  background-color: rgba(0, 0, 0, 0.5);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

#login-button {
  width: 100%;
  padding: 12px 16px;
  background-color: var(--bg-button);
  color: var(--text-button);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

#login-button:hover:not(:disabled) {
  background-color: var(--bg-button-hover);
}

#login-button:active:not(:disabled) {
  transform: scale(0.98);
}

#login-button:disabled {
  background-color: rgba(59, 130, 246, 0.5);
  color: rgba(255, 255, 255, 0.7);
  cursor: not-allowed;
}

/* ===== Editor & Shell Area ===== */
#editor-top-bar {
  display: flex;
  flex-shrink: 0;
  background: var(--bg-tabs);
  height: 30px;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

#editor-tabs {
  display: flex;
  flex-grow: 1;
  padding-left: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  /* Smooth Fade out edges to indicate scrollability */
  mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
  /* Hide scrollbar */
  scrollbar-width: none;
}
#editor-tabs::-webkit-scrollbar {
  display: none;
}

#editor-actions {
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

#editor-tabs button {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--text-tab-inactive);
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.04); /* Very subtle separator */
  outline: none;
  padding: 0 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  height: 30px;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  position: relative;
  border-top: 2px solid transparent;
  margin-top: -2px;
}

#editor-tabs button:first-of-type {
  border-left: none;
}

#editor-tabs button:hover:not(.selected) {
  background: rgba(255, 255, 255, 0.04); /* Softer hover state */
  color: var(--text-primary);
}

#editor-tabs button.selected {
  background: var(--bg-editor);
  color: var(--text-tab-active);
  border-top: 2px solid var(--text-accent);
  border-right: 1px solid var(--border-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

#editor-tabs button.selected + button {
  border-left: none;
}

#editor-tabs button:focus-visible {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
  z-index: 1;
}

#editor-tabs .file-tab {
  padding-right: 12px;
}

#editor-tabs .tree-icon {
  margin-right: 6px;
  width: 14px;
  height: 14px;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}

#editor-tabs button.selected .tree-icon,
#editor-tabs button:hover .tree-icon {
  opacity: 1;
}

#editor-tabs .file-tab-label {
  pointer-events: none;
  transition: color var(--transition-fast);
}

#editor-tabs .file-tab.selected .file-tab-label {
  color: var(--text-tab-active);
}

#editor-tabs .tab-action-container {
  position: relative;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#editor-tabs .tab-close {
  position: absolute;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: var(--radius-sm);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.1s ease-in-out, visibility 0.1s ease-in-out, background-color 0.1s ease-in-out, color 0.1s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#editor-tabs .tab-dirty-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-tab-dirty);
  opacity: 0;
  transform: scale(0);
  transition: transform 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
}

/* Hover & Selected states for standard tabs */
#editor-tabs button:hover .tab-close,
#editor-tabs button.selected .tab-close {
  opacity: 0.8;
  visibility: visible;
}

#editor-tabs button .tab-close:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.15);
  opacity: 1;
}

#editor-tabs button .tab-close:active {
  transform: scale(0.95);
}

/* Dirty state overrides */
#editor-tabs button.dirty .tab-dirty-dot {
  opacity: 1;
  transform: scale(1);
}

#editor-tabs button.dirty .tab-close {
  opacity: 0;
  visibility: hidden;
}

/* When hovering a dirty tab, hide dot and show close */
#editor-tabs button.dirty:hover .tab-dirty-dot {
  opacity: 0;
  transform: scale(0);
}

#editor-tabs button.dirty:hover .tab-close {
  opacity: 0.8;
  visibility: visible;
}

#editor-container {
  flex-grow: 1;
  display: none;
  overflow: hidden;
  position: relative;
}

#editor-container.active {
  display: flex;
}

.editor-tab-pane {
  display: none;
  flex-grow: 1;
  overflow: hidden;
}

.editor-tab-pane.active {
  display: flex;
}

/* --- Empty State --- */
#editor-empty-state {
  display: none;
  flex-grow: 1;
  align-items: center;
  justify-content: center;
  background: var(--bg-editor);
  color: var(--text-secondary);
  user-select: none;
}
#editor-empty-state.active {
  display: flex;
}
#editor-empty-state .empty-state-content {
  max-width: 600px;
  width: 100%;
  padding: 40px 20px;
  text-align: center;
  opacity: 1; /* Keep content sharp */
}
#editor-empty-state .empty-state-content .watermark-container {
  margin-bottom: 24px;
}
#editor-empty-state .empty-state-content .watermark-container .watermark-icon {
  width: 64px;
  height: 64px;
  opacity: 0.15;
  color: var(--text-accent);
  animation: pulseGlow 4s infinite ease-in-out;
}
#editor-empty-state .empty-state-content h3 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  background: linear-gradient(135deg, #ffffff 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
#editor-empty-state .empty-state-content .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 32px 0;
}
#editor-empty-state .empty-state-content .quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 40px;
  text-align: left;
}
#editor-empty-state .empty-state-content .action-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all var(--transition-med);
  width: 100%;
  outline: none;
}
#editor-empty-state .empty-state-content .action-card .action-icon {
  font-size: 24px;
  opacity: 0.8;
  transition: transform var(--transition-fast);
}
#editor-empty-state .empty-state-content .action-card .action-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#editor-empty-state .empty-state-content .action-card .action-info .action-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}
#editor-empty-state .empty-state-content .action-card .action-info .action-shortcut {
  color: var(--text-accent);
  font-size: 11px;
  font-family: var(--font-mono);
  margin-top: 2px;
}
#editor-empty-state .empty-state-content .action-card .action-info .action-desc {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#editor-empty-state .empty-state-content .action-card:hover, #editor-empty-state .empty-state-content .action-card:focus-visible {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
#editor-empty-state .empty-state-content .action-card:hover .action-icon, #editor-empty-state .empty-state-content .action-card:focus-visible .action-icon {
  transform: scale(1.15);
}
#editor-empty-state .empty-state-content .shortcuts-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  border-top: 1px dashed var(--border-light);
  padding-top: 24px;
}
#editor-empty-state .empty-state-content .shortcuts-legend .shortcut-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
#editor-empty-state .empty-state-content .shortcuts-legend .shortcut-item .action-label {
  margin-right: 4px;
}
#editor-empty-state .empty-state-content .shortcuts-legend .shortcut-item kbd {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

@keyframes pulseGlow {
  0%, 100% {
    opacity: 0.15;
    filter: drop-shadow(0 0 0px transparent);
  }
  50% {
    opacity: 0.35;
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.4));
  }
}
/* CodeMirror Styling */
.CodeMirror {
  height: 100% !important;
  width: 100% !important;
  font-size: 13px;
  font-family: var(--font-mono);
  background: var(--bg-editor) !important;
  color: var(--text-primary);
  line-height: 1.5;
}

.CodeMirror-scrollbar-filler,
.CodeMirror-gutter-filler {
  background: var(--bg-editor) !important;
}

.CodeMirror-gutters {
  background: var(--bg-editor) !important;
  border-right: 1px solid var(--border-light);
}

.CodeMirror-linenumber {
  color: var(--text-secondary);
  padding: 0 8px 0 8px;
}

.CodeMirror-cursor {
  border-left: 1px solid var(--text-primary);
}

.cm-matchhighlight {
  background-color: rgba(100, 100, 100, 0.3);
}

.CodeMirror-selection,
.CodeMirror-focused .CodeMirror-selected {
  background: var(--bg-list-selected) !important;
}

/* ===== Monaco Editor Styles ===== */
.monaco-editor .margin {
  border-right: 1px solid var(--border-light);
}
.monaco-editor .line-numbers {
  color: var(--text-secondary);
  padding: 0 8px;
}
.monaco-editor .cursors-layer > .cursor {
  border-left: 1px solid var(--text-primary) !important;
}
.monaco-editor .focused .selected-text,
.monaco-editor .selected-text {
  background-color: var(--bg-list-selected) !important;
}
.monaco-editor .monaco-scrollable-element .slider {
  background: var(--bg-scrollbar-thumb) !important;
}
.monaco-editor .monaco-scrollable-element .slider:hover {
  background: var(--bg-scrollbar-thumb-hover) !important;
}
.monaco-editor .monaco-scrollable-element .scrollbar {
  background: var(--bg-scrollbar) !important;
}
.monaco-editor.diff-editor .line-insert {
  background-color: rgba(var(--text-ai-log-success), 0.15);
  border-left: 3px solid rgba(var(--text-ai-log-success), 0.6);
}
.monaco-editor.diff-editor .line-delete {
  background-color: rgba(var(--text-ai-log-error), 0.15);
  border-left: 3px solid rgba(var(--text-ai-log-error), 0.6);
}

.editor-tab-pane,
.editor-tab-pane > .monaco-diff-editor,
.editor-tab-pane > .monaco-editor {
  height: 100%;
  width: 100%;
}

/* ===== Sidebar Accordions (Files & DB) ===== */
#sidebar details {
  border-bottom: 1px solid var(--border-light);
}

#sidebar details:last-of-type {
  border-bottom: none;
}

#sidebar summary {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 30px;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.015);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  list-style: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  transition: background-color var(--transition-fast), color var(--transition-fast);
  position: relative;
  user-select: none;
  line-height: 30px;
}

#sidebar summary:hover {
  background-color: rgba(255, 255, 255, 0.035);
  color: var(--text-primary);
}

#sidebar summary::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  background-color: currentColor;
  mask-image: url("/frontend/svg/chevron-right.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  transition: transform var(--transition-med);
  flex-shrink: 0;
  opacity: 0.65;
}

#sidebar details[open] > summary::before {
  transform: rotate(90deg);
}

#sidebar summary::-webkit-details-marker {
  display: none;
}

#sidebar summary:focus {
  outline: none;
}

.sidebar-header-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1;
  padding: 3px 5px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.sidebar-header-button:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.08);
}

/* ===== GitLab-Style Search Bar ===== */
.sidebar-search-container {
  position: relative;
  margin: 5px 6px 6px 6px;
  display: flex;
  align-items: center;
}
.sidebar-search-container .sidebar-search-icon {
  position: absolute;
  left: 8px;
  width: 12px;
  height: 12px;
  color: #64748b;
  pointer-events: none;
  background-color: currentColor;
}
.sidebar-search-container .sidebar-search-input {
  width: 100%;
  height: 25px;
  padding: 2px 24px 2px 26px;
  background-color: #050811;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  transition: all var(--transition-fast);
}
.sidebar-search-container .sidebar-search-input::placeholder {
  color: #64748b;
}
.sidebar-search-container .sidebar-search-input:focus {
  outline: none;
  background-color: #070c18;
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}
.sidebar-search-container .sidebar-search-input:focus + .sidebar-search-icon {
  color: var(--text-accent);
}
.sidebar-search-container .search-clear-btn {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  transition: color var(--transition-fast);
}
.sidebar-search-container .search-clear-btn:hover {
  color: var(--text-primary);
}

#file-explorer-content,
#history-explorer-content {
  padding: 2px 4px 6px 4px;
}

/* ===== GitLab-Style Clean File Tree ===== */
.tree-container {
  /* GitLab Minimal Chevron */
}
.tree-container ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tree-container li {
  margin: 1px 0;
}
.tree-container .tree-row {
  display: flex;
  align-items: center;
  padding: 2px 6px;
  min-height: 22px;
  padding-left: calc(4px + var(--level) * 12px);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  color: #94a3b8;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  position: relative;
  font-size: 12px;
  line-height: 1.35;
  /* Crisp Indent Guide Line */
  background-image: repeating-linear-gradient(to right, rgba(255, 255, 255, 0.04) 0px, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 12px);
  background-position: 8px 0;
  background-size: calc(var(--level) * 12px) 100%;
  background-repeat: no-repeat;
}
.tree-container .tree-row:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: #f8fafc;
}
.tree-container .tree-row:hover .tree-chevron {
  opacity: 0.8;
}
.tree-container .tree-row:hover .tree-icon {
  opacity: 1;
}
.tree-container .tree-row.active {
  background-color: rgba(56, 189, 248, 0.1);
  color: #f8fafc;
}
.tree-container .tree-row.active .tree-chevron {
  opacity: 0.9;
}
.tree-container .tree-row.active .tree-icon {
  opacity: 1;
}
.tree-container .tree-row.active .tree-label-truncate {
  font-weight: 500;
  color: #ffffff;
}
.tree-container .tree-chevron {
  width: 10px;
  height: 10px;
  margin-right: 4px;
  background-color: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.tree-container .tree-icon {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  background-color: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity var(--transition-fast);
}
.tree-container .tree-label-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
  font-size: 12px;
  letter-spacing: 0.1px;
}

/* --- GitLab-Themed Refined Glyph Icons --- */
.icon-chevron-right {
  mask-image: url("/frontend/svg/chevron-right.svg");
}

.icon-chevron-down {
  mask-image: url("/frontend/svg/chevron-down.svg");
}

/* Outline Slate Folders */
.icon-folder {
  mask-image: url("/frontend/svg/folder.svg");
  background-color: #cbd5e1 !important;
}

.icon-folder-open {
  mask-image: url("/frontend/svg/folder-open.svg");
  background-color: #cbd5e1 !important;
}

/* Clean Language Glyphs */
.icon-file {
  mask-image: url("/frontend/svg/file.svg");
  background-color: #94a3b8 !important;
}

.icon-go {
  mask-image: url("/frontend/svg/file-go.svg");
  background-color: #00add8 !important;
}

.icon-js {
  mask-image: url("/frontend/svg/file-js.svg");
  background-color: #f7df1e !important;
}

.icon-ts {
  mask-image: url("/frontend/svg/file-ts.svg");
  background-color: #3178c6 !important;
}

.icon-py {
  mask-image: url("/frontend/svg/file-py.svg");
  background-color: #3776ab !important;
}

.icon-rs {
  mask-image: url("/frontend/svg/file-rs.svg");
  background-color: #e5532c !important;
}

.icon-php {
  mask-image: url("/frontend/svg/file-php.svg");
  background-color: #8892be !important;
}

.icon-sql {
  mask-image: url("/frontend/svg/file-sql.svg");
  background-color: #00a3cc !important;
}

.icon-html {
  mask-image: url("/frontend/svg/file-html.svg");
  background-color: #e34f26 !important;
}

.icon-css {
  mask-image: url("/frontend/svg/file-css.svg");
  background-color: #2965f1 !important;
}

.icon-json {
  mask-image: url("/frontend/svg/file-json.svg");
  background-color: #cbcb41 !important;
}

.icon-md {
  mask-image: url("/frontend/svg/file-md.svg");
  background-color: #38bdf8 !important;
}

.icon-sh {
  mask-image: url("/frontend/svg/file-sh.svg");
  background-color: #fc6d26 !important;
}

.icon-docker {
  mask-image: url("/frontend/svg/file-docker.svg");
  background-color: #2496ed !important;
}

.icon-image {
  mask-image: url("/frontend/svg/file-image.svg");
  background-color: #a855f7 !important;
}

.icon-zip {
  mask-image: url("/frontend/svg/file-zip.svg");
  background-color: #e11d48 !important;
}

.icon-settings {
  mask-image: url("/frontend/svg/settings.svg");
  background-color: #94a3b8 !important;
}

.icon-history {
  mask-image: url("/frontend/svg/history.svg");
  background-color: #94a3b8 !important;
}

.icon-database {
  mask-image: url("/frontend/svg/database.svg");
  background-color: #f59e0b !important;
}

.icon-table {
  mask-image: url("/frontend/svg/table.svg");
  background-color: #38bdf8 !important;
}

.icon-view {
  mask-image: url("/frontend/svg/view.svg");
  background-color: #a855f7 !important;
}

.icon-procedure {
  mask-image: url("/frontend/svg/procedure.svg");
  background-color: #10b981 !important;
}

/* ===== AI Terminal ===== */
#terminal-output {
  flex-grow: 1;
  padding: 6px 10px;
  box-sizing: border-box;
  background: var(--bg-terminal);
  color: var(--text-primary);
  font-family: var(--font-mono);
  overflow-y: auto;
  font-size: 11.5px;
  line-height: 1.35;
}

.chat-history-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 4px;
}

.ai-context-tray {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px 8px;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  /* Custom ultra-thin horizontal scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--bg-scrollbar-thumb) transparent;
}
.ai-context-tray::-webkit-scrollbar {
  height: 4px;
}
.ai-context-tray::-webkit-scrollbar-track {
  background: transparent;
}
.ai-context-tray::-webkit-scrollbar-thumb {
  background: var(--bg-scrollbar-thumb);
  border-radius: 4px;
}
.ai-context-tray::-webkit-scrollbar-thumb:hover {
  background: var(--bg-scrollbar-thumb-hover);
}
.ai-context-tray:empty {
  display: none;
}

.context-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
  border-radius: var(--radius-xl);
  padding: 2px 6px;
  font-size: 10px;
  font-family: var(--font-sans);
  white-space: nowrap;
  user-select: none;
  transition: all var(--transition-fast);
}
.context-pill .tree-icon {
  width: 12px;
  height: 12px;
  margin-right: 4px;
  opacity: 0.9;
}
.context-pill .pill-label {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.context-pill .context-pill-action {
  margin-left: 4px;
  cursor: pointer;
  opacity: 0.6;
  font-weight: bold;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transition: all var(--transition-fast);
}
.context-pill .context-pill-action:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.2);
  color: var(--text-error);
}
.context-pill.excluded {
  background: transparent;
  border-color: var(--border-light);
  color: var(--text-muted);
}
.context-pill.excluded .pill-label {
  text-decoration: line-through;
  opacity: 0.6;
}
.context-pill.excluded .tree-icon {
  opacity: 0.4;
  filter: grayscale(100%);
}
.context-pill.excluded .context-pill-action {
  transform: rotate(45deg);
  font-size: 14px;
}
.context-pill.excluded .context-pill-action:hover {
  background: rgba(34, 197, 94, 0.2);
  color: var(--text-ai-log-success);
}

#prompt-input-section {
  padding: 8px;
  background-color: var(--bg-terminal);
  flex-shrink: 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.prompt-box-wrapper {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-med);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.prompt-box-wrapper:focus-within {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md), 0 0 0 2px rgba(59, 130, 246, 0.2);
}

#promptInput {
  flex-grow: 1;
  height: auto;
  min-height: 36px;
  max-height: 200px;
  border: none;
  border-radius: 0;
  resize: none;
  outline: none;
  box-sizing: border-box;
  font-size: 12px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.4;
  margin: 0;
  overflow-y: auto;
  box-shadow: none;
}
#promptInput::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.prompt-box-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.ai-session-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.ai-session-bar .session-action-btn {
  height: 24px;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.ai-session-bar .session-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.ai-select {
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  height: 24px;
  padding: 0 24px 0 8px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" fill="%2394a3b8" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 8px center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.ai-select:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}
.ai-select:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  background-color: rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
}
.ai-select option, .ai-select optgroup {
  background: var(--bg-dropdown);
  color: var(--text-primary);
  font-weight: normal;
}
.ai-select optgroup {
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
}

.prompt-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.prompt-tools .ai-footer-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 3px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.prompt-tools .ai-footer-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}
.prompt-tools .ai-footer-btn .panel-icon {
  width: 12px;
  height: 12px;
}
.prompt-tools .ai-footer-scout {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  transition: color var(--transition-fast);
  user-select: none;
}
.prompt-tools .ai-footer-scout:hover {
  color: var(--text-primary);
}
.prompt-tools .ai-footer-scout input[type=checkbox] {
  display: none;
}
.prompt-tools .ai-footer-scout .toggle-track {
  position: relative;
  width: 22px;
  height: 12px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  transition: background-color 0.2s, border-color 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-sizing: border-box;
}
.prompt-tools .ai-footer-scout .toggle-track::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 8px;
  height: 8px;
  background-color: #94a3b8;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.prompt-tools .ai-footer-scout input[type=checkbox]:checked + .toggle-track {
  background-color: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
}
.prompt-tools .ai-footer-scout input[type=checkbox]:checked + .toggle-track::after {
  transform: translateX(10px);
  background-color: #3b82f6;
}

#sendPromptButton {
  height: 24px;
  width: 24px;
  padding: 0;
  background-color: var(--bg-button);
  color: var(--text-button);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(59, 130, 246, 0.3);
}
#sendPromptButton .panel-icon {
  width: 12px;
  height: 12px;
  transform: translateX(-1px);
}
#sendPromptButton:hover:not(:disabled) {
  background-color: var(--bg-button-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}
#sendPromptButton:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}
#sendPromptButton:disabled {
  background-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
  box-shadow: none;
  cursor: not-allowed;
}

.chat-message-row {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.terminal-user-message {
  padding: 9px 13px;
  margin: 8px 0 8px auto;
  border-radius: var(--radius-lg);
  border-bottom-right-radius: 3px;
  font-size: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bg-user-message);
  color: var(--text-primary);
  border: 1px solid var(--border-ai-user);
  line-height: 1.45;
  max-width: 85%;
  width: fit-content;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.terminal-ai-interaction {
  margin: 8px 0;
  padding: 14px;
  background: var(--bg-ai-message);
  border: 1px solid var(--border-ai-response);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}

.ai-main-response-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

hr.ai-section-separator {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 6px 0;
}

.ai-tool-statuses-container {
  margin-bottom: 4px;
}
.ai-tool-statuses-container:empty {
  display: none;
}

.terminal-ai-tool-status {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 2px 6px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  background-color: rgba(var(--bg-sidebar), 0.5);
  border: 1px solid var(--border-light);
}
.terminal-ai-tool-status:last-child {
  margin-bottom: 0;
}
.terminal-ai-tool-status strong {
  color: var(--text-primary);
}
.terminal-ai-tool-status .tool-status-icon {
  margin-right: 4px;
}
.terminal-ai-tool-status .tool-status-success {
  color: var(--text-ai-log-success);
  font-weight: bold;
}
.terminal-ai-tool-status .tool-status-error {
  color: var(--text-ai-log-error);
  font-weight: bold;
}

.ai-file-changes-container {
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 6px;
  padding: 8px;
  margin-top: 8px;
}
.ai-file-changes-container .changes-header {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.ai-file-changes-container .changes-header .panel-icon {
  color: var(--text-accent);
}
.ai-file-changes-container ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-file-changes-container li {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 4px 8px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.ai-file-changes-container li:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}
.ai-file-changes-container .ai-reload-file-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.ai-file-changes-container .ai-reload-file-btn .panel-icon {
  width: 10px;
  height: 10px;
}
.ai-file-changes-container .ai-reload-file-btn:hover {
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.4);
  border-color: rgba(59, 130, 246, 0.6);
}
.ai-file-changes-container .ai-reload-file-btn:active {
  background: rgba(59, 130, 246, 0.6);
}

.ai-clickable-file {
  color: var(--text-link);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-clickable-file:hover {
  color: var(--text-accent-hover);
  text-decoration: underline;
}

.ai-filepath-display {
  color: var(--text-secondary);
  font-style: italic;
  cursor: pointer;
}
.ai-filepath-display:hover {
  color: var(--text-primary);
}

.ai-placeholder i {
  color: var(--text-secondary);
}

.ai-metadata-container .ai-token-usage-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.ai-metadata-container .ai-token-usage-container .usage-badge {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
  font-size: 9px;
  font-family: var(--font-mono);
}
.ai-metadata-container .ai-token-usage-container .usage-badge .usage-label {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  padding: 1px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ai-metadata-container .ai-token-usage-container .usage-badge .usage-value {
  color: #cbd5e1;
  padding: 1px 4px;
  font-weight: 600;
}
.ai-metadata-container .ai-token-usage-container .usage-badge.total {
  border-color: rgba(59, 130, 246, 0.3);
}
.ai-metadata-container .ai-token-usage-container .usage-badge.total .usage-label {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}
.ai-metadata-container .ai-token-usage-container .usage-badge.total .usage-value {
  color: #bfdbfe;
}

.ai-explanation {
  margin-bottom: 8px;
  background: transparent;
  color: #94a3b8;
  border: none;
  padding: 0;
  border-radius: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.35;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.2px;
}
.ai-explanation h1, .ai-explanation h2, .ai-explanation h3, .ai-explanation h4 {
  color: #e2e8f0;
  margin: 12px 0 6px 0;
  font-weight: 600;
  line-height: 1.3;
}
.ai-explanation h1 {
  font-size: 1.25em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 4px;
}
.ai-explanation h2 {
  font-size: 1.15em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 4px;
}
.ai-explanation h3 {
  font-size: 1.05em;
  color: #cbd5e1;
}
.ai-explanation h4 {
  font-size: 0.95em;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 10px;
}
.ai-explanation p {
  margin-bottom: 6px;
}
.ai-explanation strong {
  color: #cbd5e1;
  font-weight: 600;
}
.ai-explanation em {
  font-style: italic;
  color: #64748b;
}
.ai-explanation hr.ai-hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin: 12px 0;
}
.ai-explanation .ai-ul-item, .ai-explanation .ai-ol-item {
  display: flex;
  margin-top: 4px;
  margin-bottom: 4px;
  padding-left: 4px;
}
.ai-explanation .ai-ul-item .bullet, .ai-explanation .ai-ul-item .number, .ai-explanation .ai-ol-item .bullet, .ai-explanation .ai-ol-item .number {
  color: #3b82f6;
  font-weight: 600;
  margin-right: 8px;
  flex-shrink: 0;
}
.ai-explanation .ai-ul-item .content, .ai-explanation .ai-ol-item .content {
  flex-grow: 1;
}
.ai-explanation code.inline-code {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #7dd3fc;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.ai-explanation a.ai-link {
  color: #60a5fa;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}
.ai-explanation a.ai-link:hover {
  border-bottom-color: #60a5fa;
}
.ai-explanation blockquote {
  margin: 4px 0;
  padding: 4px 8px;
  border-left: 3px solid #3b82f6;
  background: rgba(59, 130, 246, 0.06);
  color: #64748b;
  border-radius: 0 4px 4px 0;
  font-style: italic;
}
.ai-explanation .ai-conversational-code {
  display: grid;
  grid-template-rows: auto 1fr;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  margin: 6px 0;
  overflow: hidden;
}
.ai-explanation .ai-conversational-code .code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.ai-explanation .ai-conversational-code .code-header .lang-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
}
.ai-explanation .ai-conversational-code .code-header .code-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-explanation .ai-conversational-code .code-header .code-actions .ai-insert-code-btn, .ai-explanation .ai-conversational-code .code-header .code-actions .ai-copy-code-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 3px;
  transition: background 0.2s, color 0.2s;
}
.ai-explanation .ai-conversational-code .code-header .code-actions .ai-insert-code-btn .panel-icon, .ai-explanation .ai-conversational-code .code-header .code-actions .ai-copy-code-btn .panel-icon {
  width: 10px;
  height: 10px;
  background-color: currentColor;
}
.ai-explanation .ai-conversational-code .code-header .code-actions .ai-insert-code-btn:hover, .ai-explanation .ai-conversational-code .code-header .code-actions .ai-copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}
.ai-explanation .ai-conversational-code pre[class*=language-] {
  margin: 0 !important;
  padding: 8px 12px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 11.5px;
  background: transparent !important;
  min-width: 0;
}
.ai-explanation .ai-conversational-code pre[class*=language-] code {
  font-family: var(--font-mono);
  text-shadow: none;
}

.ai-no-change-block {
  padding: 6px 10px;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #94a3b8;
  font-style: italic;
  margin: 8px 0;
}

.ai-code-block {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  margin: 12px 0;
  background-color: #030712;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.ai-code-block:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
.ai-code-block .ai-code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.02);
  padding: 4px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.ai-code-block .ai-code-block-header .file-info {
  font-family: var(--font-mono);
  color: var(--text-ai-filename);
  font-size: 11px;
  font-weight: 500;
}
.ai-code-block .ai-code-block-header .file-info .language {
  color: var(--text-secondary);
  margin-left: 6px;
}
.ai-code-block .ai-code-block-header .code-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-code-block .ai-code-block-header .code-actions .ai-insert-code-btn, .ai-code-block .ai-code-block-header .code-actions .ai-copy-code-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 3px;
  transition: background 0.2s, color 0.2s;
}
.ai-code-block .ai-code-block-header .code-actions .ai-insert-code-btn .panel-icon, .ai-code-block .ai-code-block-header .code-actions .ai-copy-code-btn .panel-icon {
  width: 10px;
  height: 10px;
  background-color: currentColor;
}
.ai-code-block .ai-code-block-header .code-actions .ai-insert-code-btn:hover, .ai-code-block .ai-code-block-header .code-actions .ai-copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}
.ai-code-block .ai-code-block-header .code-actions .ai-insert-code-btn.copied, .ai-code-block .ai-code-block-header .code-actions .ai-copy-code-btn.copied {
  color: var(--text-ai-log-success);
}
.ai-code-block pre[class*=language-] {
  margin: 0;
  padding: 8px 12px;
  max-height: 300px;
  overflow: auto;
  font-size: 11.5px;
}

.ai-thought-process {
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.15);
  border-left: 3px solid var(--border-medium);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0;
  overflow: hidden;
}
.ai-thought-process summary {
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.9em;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  user-select: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.ai-thought-process summary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}
.ai-thought-process .thought-content {
  padding: 6px 8px;
  font-size: 0.9em;
  color: var(--text-secondary);
  font-style: italic;
  white-space: pre-wrap;
  word-wrap: break-word;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-patch-block {
  border-color: rgba(96, 165, 250, 0.2); /* Soft blue border highlight */
  background-color: rgba(3, 7, 18, 0.4);
}
.ai-patch-block:hover {
  border-color: rgba(96, 165, 250, 0.35);
}
.ai-patch-block .ai-code-block-header {
  background-color: rgba(96, 165, 250, 0.03);
  border-bottom-color: rgba(96, 165, 250, 0.1);
}

.timeline-pane, .signatures-pane {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  overflow-y: auto;
}

.signatures-pane .btn-primary {
  background: var(--bg-button);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.signatures-pane .btn-primary:hover:not(:disabled) {
  background: var(--bg-button-hover);
  transform: translateY(-0.5px);
}
.signatures-pane .btn-primary:active:not(:disabled) {
  transform: translateY(0);
}
.signatures-pane .btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.signatures-pane .btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.signatures-pane .btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
}
.signatures-pane .btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.knowledge-loading-state, .knowledge-empty-state {
  color: var(--text-secondary);
  font-style: italic;
  padding: 16px;
  text-align: center;
  font-size: 13px;
}

.timeline-container {
  padding: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.timeline-container::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 11px;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.timeline-card {
  position: relative;
  padding-left: 24px;
  margin-bottom: 10px;
}
.timeline-card:last-child {
  margin-bottom: 0;
}
.timeline-card .timeline-dot {
  position: absolute;
  left: 8px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-base);
  border: 1.5px solid var(--text-accent);
  box-shadow: 0 0 4px rgba(34, 211, 238, 0.3);
  z-index: 2;
  transition: all var(--transition-fast);
}
.timeline-card:hover .timeline-dot {
  transform: scale(1.2);
  background: var(--text-accent);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}

.timeline-card-inner {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: all var(--transition-med);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.timeline-card-inner:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.timeline-title-group .timeline-turn {
  font-weight: 700;
  color: var(--text-accent);
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.timeline-title-group .timeline-time {
  color: var(--text-muted);
  font-size: 10px;
}

.revert-btn {
  background: rgba(239, 68, 68, 0.06);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.15);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.revert-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ffffff;
}
.revert-btn:active {
  transform: scale(0.97);
}

.timeline-summary {
  font-size: 11.5px;
  color: #cbd5e1;
  font-weight: 400;
  line-height: 1.35;
}

.timeline-files {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 2px;
  font-size: 10px;
  color: var(--text-muted);
}
.timeline-files .context-pill {
  cursor: pointer;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 10px;
  transition: all var(--transition-fast);
}
.timeline-files .context-pill .tree-icon {
  width: 10px;
  height: 10px;
  margin-right: 4px;
  background-color: currentColor;
}
.timeline-files .context-pill:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: #ffffff;
}

.signatures-pane {
  padding: 10px 12px;
  overflow: hidden;
}

.signatures-search-bar {
  margin-bottom: 8px;
  flex-shrink: 0;
}
.signatures-search-bar input {
  width: 100%;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 11.5px;
  transition: all var(--transition-fast);
}
.signatures-search-bar input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.signatures-table-container {
  flex-grow: 1;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.005);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
}

.signatures-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 11.5px;
}
.signatures-table th {
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 2;
}
.signatures-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  color: #cbd5e1;
  vertical-align: middle;
}
.signatures-table tr {
  transition: background-color 0.15s ease;
}
.signatures-table tr:hover {
  background-color: rgba(255, 255, 255, 0.015);
}
.signatures-table .file-path-cell {
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.signatures-table .summary-cell {
  line-height: 1.35;
  color: var(--text-secondary);
}
.signatures-table .time-cell {
  color: var(--text-muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 8.5px;
  font-weight: 700;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}
.status-badge.status-synced {
  background: rgba(34, 197, 94, 0.06);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.15);
}
.status-badge.status-modified {
  background: rgba(245, 158, 11, 0.06);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.15);
}
.status-badge.status-missing {
  background: rgba(239, 68, 68, 0.06);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.15);
}

/* ===== Context Menu ===== */
#context-menu {
  z-index: var(--z-context-menu);
  display: none;
  position: absolute;
  min-width: 180px;
  background: var(--bg-context-menu);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-context-menu);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  transform-origin: top left;
  animation: menuScaleIn 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes menuScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
#context-menu button {
  width: 100%;
  background: none;
  color: inherit;
  border: none;
  outline: none;
  padding: 8px 10px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

#context-menu button:last-of-type {
  margin-bottom: 0;
}

#context-menu button:hover,
#context-menu button:focus-visible {
  background: var(--bg-context-menu-hover);
  color: var(--text-context-menu-hover);
}

#context-menu button:focus-visible {
  outline: none;
}

#app-container.projects-dashboard {
  display: none;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
}
#app-container.projects-dashboard.visible {
  display: flex;
}

.dashboard-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 50px;
  padding: 0 24px;
  background-color: rgba(var(--bg-sidebar), 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.dashboard-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
}
.dashboard-header .brand .brand-icon {
  width: 28px;
  height: 28px;
  color: var(--text-accent);
  filter: drop-shadow(0 0 8px rgba(var(--text-accent), 0.4));
}
.dashboard-header .brand h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.dashboard-header .search-wrapper {
  justify-self: center;
  width: 100%;
  max-width: 480px;
  min-width: 300px;
}
.dashboard-header .search-container {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}
.dashboard-header .search-container .search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}
.dashboard-header .search-container input {
  width: 100%;
  padding: 8px 45px 8px 40px;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition-med);
}
.dashboard-header .search-container input::placeholder {
  color: var(--text-muted);
}
.dashboard-header .search-container input:focus {
  outline: none;
  background-color: rgba(0, 0, 0, 0.4);
  border-color: rgba(var(--text-accent), 0.5);
  box-shadow: 0 0 0 3px rgba(var(--text-accent), 0.15);
}
.dashboard-header .search-container input:focus ~ .search-icon {
  color: var(--text-accent);
}
.dashboard-header .search-container .search-shortcut {
  position: absolute;
  right: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  pointer-events: none;
}
.dashboard-header .user-actions {
  justify-self: end;
  display: flex;
  align-items: center;
}
.dashboard-header .user-actions .logout-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.dashboard-header .user-actions .logout-btn .mask-icon {
  width: 18px;
  height: 18px;
}
.dashboard-header .user-actions .logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--text-error);
  border-color: rgba(239, 68, 68, 0.2);
}

.dashboard-content {
  flex-grow: 1;
  padding: 40px;
  overflow-y: auto;
  scrollbar-color: var(--bg-scrollbar-thumb) transparent;
  scrollbar-width: thin;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.project-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-med);
  position: relative;
  overflow: hidden;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-focus);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  background-color: var(--bg-tab-hover);
}
.project-card:hover .card-icon {
  color: var(--text-accent-hover);
  transform: scale(1.05);
}
.project-card .card-icon {
  width: 32px;
  height: 32px;
  color: var(--text-accent);
  margin-bottom: 16px;
  transition: all var(--transition-fast);
}
.project-card .card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-card .card-path {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.8;
}

.create-card {
  background-color: transparent;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}
.create-card:hover {
  background-color: rgba(59, 130, 246, 0.05);
  border-color: var(--border-focus);
  border-style: solid;
}
.create-card:hover .create-icon {
  background-color: var(--bg-button);
  color: #fff;
}
.create-card .create-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
  margin-bottom: 16px;
  transition: all var(--transition-fast);
}
.create-card .create-icon .mask-icon {
  width: 24px;
  height: 24px;
}
.create-card .card-title {
  color: var(--text-secondary);
}

.loading-state, .empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-style: italic;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(5, 8, 16, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-out;
}
.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}
.modal-overlay.visible .modal-box {
  transform: scale(1) translateY(0);
}

.modal-box {
  background-color: #0a0e17;
  border: none;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: scale(0.95) translateY(10px);
  transition: all 0.2s ease-out;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}
.modal-header .close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.modal-header .close-btn .mask-icon {
  width: 20px;
  height: 20px;
}
.modal-header .close-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}
.modal-body .form-group {
  margin-bottom: 20px;
}
.modal-body .form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}
.modal-body .form-group input {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}
.modal-body .form-group input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 30px;
}
.modal-actions button {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}
.modal-actions .btn-secondary {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.modal-actions .btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}
.modal-actions .btn-primary {
  background-color: var(--bg-button);
  color: var(--text-button);
}
.modal-actions .btn-primary:hover {
  background-color: var(--bg-button-hover);
}
.modal-actions .btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.error-message {
  background-color: rgba(var(--text-error), 0.1);
  border: 1px solid rgba(var(--text-error), 0.3);
  color: var(--text-error);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: none;
}

@media (max-width: 768px) {
  .dashboard-header {
    display: flex;
    padding: 15px 20px;
    flex-direction: column;
    height: auto;
    gap: 15px;
  }
  .dashboard-header .brand {
    width: 100%;
    justify-content: space-between;
  }
  .dashboard-header .search-wrapper {
    width: 100%;
    min-width: unset;
  }
  .dashboard-header .user-actions {
    position: absolute;
    top: 10px;
    right: 20px;
  }
  .dashboard-content {
    padding: 20px;
  }
}
/* ===== App container (initially hidden until logged in) ===== */
#app-container {
  display: none;
  flex: 1 1 auto;
  width: 100%;
  /* height: 100%; */
  flex-direction: row;
  overflow: hidden;
}

#app-container.visible {
  display: flex;
}

/* ===== Layout Containers ===== */
aside#sidebar {
  box-sizing: border-box;
  flex: 0 0 250px;
  background: var(--bg-sidebar);
  overflow-y: auto;
  height: 100%;
  border-right: 1px solid var(--border-light);
  padding: 0;
  min-width: 160px;
  max-width: 60%;
  position: relative;
  z-index: 1;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}

aside#sidebar:focus {
  outline: none;
}

#sidebar-dragbar {
  flex: 0 0 5px;
  width: 5px;
  background: var(--bg-dragbar);
  border-left: 1px solid var(--border-dark);
  border-right: 1px solid var(--border-dark);
  cursor: ew-resize;
  height: 100%;
  z-index: var(--z-dragbar);
  transition: background var(--transition-fast);
  user-select: none;
  position: relative;
}
#sidebar-dragbar::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 1px;
  transition: background-color var(--transition-fast), height var(--transition-fast);
}
#sidebar-dragbar:hover::after, #sidebar-dragbar.resizing::after {
  background-color: var(--text-accent);
  height: 48px;
}

#sidebar-dragbar:hover,
#sidebar-dragbar.resizing {
  background: var(--bg-dragbar-hover);
}

#main-container {
  flex: 1 1 0%;
  display: flex;
  flex-direction: row;
  min-width: 0;
  height: 100%;
}

#editor-wrapper {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: var(--bg-editor);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

#main-editor-area {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

/* --- Bottom Panel Splitter --- */
#bottom-panel-dragbar {
  flex: 0 0 4px;
  width: 100%;
  background: var(--bg-dragbar);
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
  cursor: ns-resize;
  z-index: var(--z-dragbar);
  transition: background var(--transition-fast);
  position: relative;
}
#bottom-panel-dragbar::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 2px;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 1px;
  transition: background-color var(--transition-fast), width var(--transition-fast);
}
#bottom-panel-dragbar:hover::after, #bottom-panel-dragbar.resizing::after {
  background-color: var(--text-accent);
  width: 48px;
}
#bottom-panel-dragbar:hover, #bottom-panel-dragbar.resizing {
  background: var(--bg-dragbar-hover);
}

/* --- Bottom Panel --- */
#bottom-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-terminal);
  border-top: 1px solid var(--border-light);
  z-index: 5;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
  transition: flex-basis var(--transition-med), height var(--transition-med);
}
#bottom-panel.collapsed {
  flex-basis: auto !important;
  height: 30px;
}
#bottom-panel.is-dragging {
  transition: none !important;
}

/* Replaced by unified .panel-header */
#bottom-tabs {
  display: flex;
  height: 100%;
}

.bottom-tab {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  outline: none;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  height: 100%;
  transition: all var(--transition-fast);
  border-top: 2px solid transparent;
  position: relative;
}
.bottom-tab .tree-icon {
  margin-right: 6px;
  width: 13px;
  height: 13px;
  opacity: 0.65;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}
.bottom-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.035);
}
.bottom-tab:hover .tree-icon {
  opacity: 0.9;
}
.bottom-tab.selected {
  color: var(--text-accent);
  border-top: 2px solid var(--text-accent);
  background: rgba(255, 255, 255, 0.02);
}
.bottom-tab.selected .tree-icon {
  opacity: 1;
  color: var(--text-accent);
}

#bottom-panel-actions {
  display: flex;
  gap: 4px;
}

/* ===== Unified Panel Header ===== */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 30px;
  background: var(--bg-panel-header);
  border-bottom: 1px solid var(--border-light);
  padding: 0 12px;
  user-select: none;
  flex-shrink: 0;
}
.panel-header .panel-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}
.panel-header .panel-header-title .panel-icon {
  color: var(--text-accent);
}
.panel-header .panel-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 4px currentColor;
}

.panel-btn-text {
  background: var(--bg-button);
  color: var(--text-button);
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.panel-btn-text:hover {
  background: var(--bg-button-hover);
}

.panel-action-btn {
  background: transparent;
  border: none;
  color: var(--text-header-button);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.panel-action-btn:hover {
  background: var(--bg-header-button-hover);
  color: var(--text-header-button-hover);
}
.panel-action-btn:active {
  background: rgba(255, 255, 255, 0.15);
}

/* Global Mask Icon Base */
.mask-icon, .panel-icon {
  background-color: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  display: inline-block;
}

/* Panel Icon Masks */
.panel-icon {
  width: 14px;
  height: 14px;
}

.icon-terminal {
  mask-image: url("/frontend/svg/terminal.svg");
}

.icon-chat {
  mask-image: url("/frontend/svg/chat.svg");
}

.icon-maximize {
  mask-image: url("/frontend/svg/maximize.svg");
}

.icon-restore {
  mask-image: url("/frontend/svg/restore.svg");
}

.icon-close {
  mask-image: url("/frontend/svg/close.svg");
}

.icon-chevron-up {
  mask-image: url("/frontend/svg/chevron-up.svg");
}

.icon-scissors {
  mask-image: url("/frontend/svg/scissors.svg");
}

.icon-trash {
  mask-image: url("/frontend/svg/trash.svg");
}

.icon-refresh {
  mask-image: url("/frontend/svg/refresh.svg");
}

.icon-send {
  mask-image: url("/frontend/svg/send.svg");
}

.icon-copy {
  mask-image: url("/frontend/svg/copy.svg");
}

.icon-layers {
  mask-image: url("/frontend/svg/layers.svg");
}

.icon-log-out {
  mask-image: url("/frontend/svg/log-out.svg");
}

.icon-plus {
  mask-image: url("/frontend/svg/plus.svg");
}

.icon-search {
  mask-image: url("/frontend/svg/search.svg");
}

#bottom-panel-content {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: var(--bg-editor);
}

.bottom-content-pane {
  display: none;
  width: 100%;
  height: 100%;
}
.bottom-content-pane.active {
  display: block;
}
.bottom-content-pane iframe {
  width: 100%;
  height: 100%;
  border: none;
}

body.resizing-bottom {
  cursor: ns-resize;
  user-select: none;
}

#terminal-dragbar {
  flex: 0 0 5px;
  width: 5px;
  background: var(--bg-dragbar);
  border-left: 1px solid var(--border-dark);
  border-right: 1px solid var(--border-dark);
  cursor: ew-resize;
  height: 100%;
  z-index: var(--z-dragbar);
  transition: background var(--transition-fast);
  user-select: none;
  position: relative;
}
#terminal-dragbar::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 1px;
  transition: background-color var(--transition-fast), height var(--transition-fast);
}
#terminal-dragbar:hover::after, #terminal-dragbar.resizing::after {
  background-color: var(--text-accent);
  height: 48px;
}

#terminal-dragbar:hover,
#terminal-dragbar.resizing {
  background: var(--bg-dragbar-hover);
}

#terminal-wrapper {
  /* width: 400px; */
  flex: 0 0 400px;
  background: var(--bg-terminal);
  border-left: 1px solid var(--border-dark);
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 90vw;
  min-width: 200px;
  box-sizing: border-box;
  transition: flex-basis var(--transition-fast);
  position: relative;
  z-index: 1;
}

body.resizing-sidebar,
body.resizing-terminal {
  cursor: ew-resize;
  user-select: none;
}

/* ===== Toast Notifications ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 99999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #1e293b;
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  max-width: 400px;
  border-left: 4px solid #3b82f6;
  animation: slideInRight 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-error {
  border-left-color: #ef4444;
}

.toast-success {
  border-left-color: #22c55e;
}

.toast-icon {
  font-size: 16px;
}

.toast-error .toast-icon {
  color: #ef4444;
}

.toast-success .toast-icon {
  color: #22c55e;
}

.toast-message {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

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

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
/* ===== Global UI Modal ===== */
#global-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(5, 8, 16, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
}

#global-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

#global-modal-box {
  background-color: #0a0e17;
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 400px;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#global-modal-overlay.visible #global-modal-box {
  transform: translateY(0) scale(1);
}

#global-modal-box h2 {
  margin: 0 0 12px 0;
  font-size: 1.2em;
  font-weight: 600;
}

#global-modal-box p {
  margin: 0 0 20px 0;
  color: var(--text-secondary);
  font-size: 0.95em;
  line-height: 1.5;
}

#global-modal-box input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 20px;
  box-sizing: border-box;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

#global-modal-box input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions button {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.modal-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-actions .btn-primary {
  background: var(--bg-button);
  color: var(--text-button);
}

.modal-actions .btn-primary:hover {
  background: var(--bg-button-hover);
}

/* ===== Spotlight Quick Open (Ctrl+P) ===== */
#quick-open-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  z-index: var(--z-modal-overlay);
  opacity: 1;
  transition: opacity var(--transition-med);
}

#quick-open-box {
  background-color: var(--bg-login-box);
  border: 1px solid var(--border-login-box);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-overlay);
  width: 100%;
  max-width: 550px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: menuScaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.quick-open-input-wrapper {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}
.quick-open-input-wrapper .icon-search {
  color: var(--text-secondary);
  width: 16px;
  height: 16px;
  background-color: currentColor;
}
.quick-open-input-wrapper input {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  padding: 0;
}
.quick-open-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.quick-open-results {
  list-style: none;
  padding: 6px;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
}
.quick-open-results li {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  gap: 12px;
  transition: background var(--transition-fast);
}
.quick-open-results li .tree-icon {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}
.quick-open-results li .file-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.quick-open-results li .file-details .file-name {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}
.quick-open-results li .file-details .file-path {
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-open-results li.selected {
  background-color: var(--bg-tab-hover);
}
.quick-open-results li.selected .tree-icon {
  color: var(--text-accent);
}
.quick-open-results li.selected .file-details .file-name {
  color: var(--text-accent);
}

.quick-open-no-results {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}

.quick-open-footer {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-light);
  font-size: 10px;
  color: var(--text-muted);
}
.quick-open-footer kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  font-family: var(--font-mono);
}

/* ===== Scrollbars ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: var(--bg-scrollbar);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-scrollbar-thumb);
  border-radius: 4px;
  border: 2px solid var(--bg-scrollbar);
}

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

::-webkit-scrollbar-corner {
  background: var(--bg-scrollbar);
}

html,
body,
aside#sidebar,
#editor-wrapper,
#terminal-wrapper,
#promptInput,
.CodeMirror,
ul,
#terminal-output,
#editor-tabs,
#file-explorer-content,
#db-explorer-content {
  scrollbar-color: var(--bg-scrollbar-thumb) var(--bg-scrollbar);
  scrollbar-width: thin;
}

/* ===== Responsive Design ===== */
@media (max-width: 900px) {
  body {
    /* No change needed here */
    height: auto;
    min-height: 100vh;
    overflow: auto;
    font-size: 14px;
  }
  #app-container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  aside#sidebar {
    width: 100%;
    flex: 0 0 auto;
    height: 200px;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border-dark);
    order: 0;
    max-width: none;
    min-width: 0;
  }
  #sidebar-dragbar {
    display: none !important;
  }
  #main-container {
    flex-direction: column;
    height: auto;
    flex-grow: 1;
    order: 1;
    width: 100%;
  }
  #editor-wrapper {
    height: auto;
    flex: 1 1 55%;
    min-height: 250px;
    order: 0;
    width: 100%;
  }
  #terminal-wrapper {
    width: 100%;
    flex: 1 1 45%;
    min-height: 200px;
    height: auto;
    max-height: none;
    border-left: none;
    border-top: 1px solid var(--border-light);
    box-shadow: none;
    position: relative;
    order: 1;
    flex-basis: auto;
    max-width: none;
    min-width: 0;
  }
  #terminal-dragbar {
    display: none !important;
  }
  #editor-tabs {
    position: relative;
    top: auto;
    z-index: auto;
    height: 40px;
  }
  #editor-tabs button {
    height: 40px;
    line-height: 40px;
    padding: 0 15px;
  }
  #editor-tabs .file-tab {
    padding-right: 35px;
  }
  #editor-tabs .tab-close {
    right: 10px;
    font-size: 16px;
    opacity: 0.8;
    visibility: visible;
  }
  .editor-tab-pane,
  #editor-container,
  #shell-container {
    height: calc(100% - 40px);
  }
  #prompt-input-container {
    padding: 6px 8px;
    gap: 6px;
  }
  #promptInput {
    min-height: 40px;
    max-height: 150px;
  }
  #aiContextMode {
    height: 40px;
    font-size: 11px;
    padding-right: 20px;
    background-size: 8px 8px;
    background-position: right 6px center;
  }
  #sendPromptButton {
    height: 40px;
    width: 40px;
  }
  .terminal-ai-message,
  .terminal-user-message {
    font-size: 14px;
  }
  .ai-filecode-block {
    font-size: 13px;
  }
  #login-box {
    max-width: 90%;
    padding: 20px;
  }
  .sidebar-header-button {
    font-size: 16px;
    padding: 5px;
  }
  #sidebar summary {
    padding-right: 35px;
  }
}

/*# sourceMappingURL=main.css.map */
