/* ─── Base & Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', 'Monaco', 'Menlo', monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --activity-bar-width: 48px;
  --sidebar-width: 240px;
  --title-bar-height: 30px;
  --status-bar-height: 22px;
  --tab-bar-height: 35px;
  --minimap-width: 80px;
  --line-number-width: 48px;
  --editor-font-size: 14px;
  --editor-line-height: 1.5;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-editor);
  color: var(--fg-editor);
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

/* ─── Theme: Dark+ (default) ───────────────────────────────── */
[data-theme="dark-plus"] {
  --bg-title-bar: #323233;
  --fg-title-bar: #cccccc;
  --bg-activity-bar: #333333;
  --fg-activity-bar: #858585;
  --fg-activity-bar-active: #ffffff;
  --bg-activity-bar-active: #252526;
  --bg-sidebar: #252526;
  --fg-sidebar: #cccccc;
  --fg-sidebar-muted: #858585;
  --bg-editor: #1e1e1e;
  --fg-editor: #d4d4d4;
  --bg-tab-bar: #252526;
  --fg-tab: #969696;
  --fg-tab-active: #ffffff;
  --bg-tab-active: #1e1e1e;
  --border-tab: #1e1e1e;
  --bg-line-highlight: #2a2d2e;
  --fg-line-number: #858585;
  --fg-line-number-active: #c6c6c6;
  --bg-minimap: #1e1e1e;
  --fg-minimap: #4d4d4d;
  --bg-status-bar: #007acc;
  --fg-status-bar: #ffffff;
  --bg-terminal: #1e1e1e;
  --fg-terminal: #cccccc;
  --bg-palette: #252526;
  --fg-palette: #cccccc;
  --border-palette: #454545;
  --bg-palette-selected: #04395e;
  --cursor-color: #aeafad;
  --hl-keyword: #569cd6;
  --hl-string: #ce9178;
  --hl-comment: #6a9955;
  --hl-number: #b5cea8;
  --hl-function: #dcdcaa;
  --hl-class: #4ec9b0;
  --hl-variable: #9cdcfe;
  --hl-type: #4ec9b0;
  --hl-operator: #d4d4d4;
  --hl-punctuation: #d4d4d4;
  --hl-tag: #569cd6;
  --hl-attr: #9cdcfe;
  --hl-built_in: #4ec9b0;
  --hl-literal: #569cd6;
  --hl-meta: #9cdcfe;
  --hl-regexp: #d16969;
  --hl-title: #dcdcaa;
  --hl-params: #9cdcfe;
  --hl-property: #9cdcfe;
  --hl-attr-value: #ce9178;
  --hl-selector: #d7ba7d;
  --hl-default: #d4d4d4;
}

/* ─── Theme: Dracula ───────────────────────────────────────── */
[data-theme="dracula"] {
  --bg-title-bar: #21222c;
  --fg-title-bar: #f8f8f2;
  --bg-activity-bar: #21222c;
  --fg-activity-bar: #6272a4;
  --fg-activity-bar-active: #f8f8f2;
  --bg-activity-bar-active: #191a21;
  --bg-sidebar: #21222c;
  --fg-sidebar: #f8f8f2;
  --fg-sidebar-muted: #6272a4;
  --bg-editor: #282a36;
  --fg-editor: #f8f8f2;
  --bg-tab-bar: #21222c;
  --fg-tab: #6272a4;
  --fg-tab-active: #f8f8f2;
  --bg-tab-active: #282a36;
  --border-tab: #282a36;
  --bg-line-highlight: #313442;
  --fg-line-number: #6272a4;
  --fg-line-number-active: #f8f8f2;
  --bg-minimap: #282a36;
  --fg-minimap: #44475a;
  --bg-status-bar: #bd93f9;
  --fg-status-bar: #282a36;
  --bg-terminal: #282a36;
  --fg-terminal: #f8f8f2;
  --bg-palette: #21222c;
  --fg-palette: #f8f8f2;
  --border-palette: #44475a;
  --bg-palette-selected: #44475a;
  --cursor-color: #f8f8f2;
  --hl-keyword: #ff79c6;
  --hl-string: #f1fa8c;
  --hl-comment: #6272a4;
  --hl-number: #bd93f9;
  --hl-function: #50fa7b;
  --hl-class: #8be9fd;
  --hl-variable: #f8f8f2;
  --hl-type: #8be9fd;
  --hl-operator: #ff79c6;
  --hl-punctuation: #f8f8f2;
  --hl-tag: #ff79c6;
  --hl-attr: #50fa7b;
  --hl-built_in: #8be9fd;
  --hl-literal: #bd93f9;
  --hl-meta: #f8f8f2;
  --hl-regexp: #f1fa8c;
  --hl-title: #50fa7b;
  --hl-params: #ffb86c;
  --hl-property: #66d9ef;
  --hl-attr-value: #f1fa8c;
  --hl-selector: #ffb86c;
  --hl-default: #f8f8f2;
}

/* ─── Theme: Monokai ───────────────────────────────────────── */
[data-theme="monokai"] {
  --bg-title-bar: #272822;
  --fg-title-bar: #f8f8f2;
  --bg-activity-bar: #272822;
  --fg-activity-bar: #75715e;
  --fg-activity-bar-active: #f8f8f2;
  --bg-activity-bar-active: #1e1f1c;
  --bg-sidebar: #272822;
  --fg-sidebar: #f8f8f2;
  --fg-sidebar-muted: #75715e;
  --bg-editor: #272822;
  --fg-editor: #f8f8f2;
  --bg-tab-bar: #1e1f1c;
  --fg-tab: #75715e;
  --fg-tab-active: #f8f8f2;
  --bg-tab-active: #272822;
  --border-tab: #272822;
  --bg-line-highlight: #3e3d32;
  --fg-line-number: #75715e;
  --fg-line-number-active: #f8f8f2;
  --bg-minimap: #272822;
  --fg-minimap: #49483e;
  --bg-status-bar: #a6e22e;
  --fg-status-bar: #272822;
  --bg-terminal: #272822;
  --fg-terminal: #f8f8f2;
  --bg-palette: #272822;
  --fg-palette: #f8f8f2;
  --border-palette: #49483e;
  --bg-palette-selected: #49483e;
  --cursor-color: #f8f8f2;
  --hl-keyword: #f92672;
  --hl-string: #e6db74;
  --hl-comment: #75715e;
  --hl-number: #ae81ff;
  --hl-function: #a6e22e;
  --hl-class: #66d9ef;
  --hl-variable: #f8f8f2;
  --hl-type: #66d9ef;
  --hl-operator: #f92672;
  --hl-punctuation: #f8f8f2;
  --hl-tag: #f92672;
  --hl-attr: #a6e22e;
  --hl-built_in: #66d9ef;
  --hl-literal: #ae81ff;
  --hl-meta: #f8f8f2;
  --hl-regexp: #e6db74;
  --hl-title: #a6e22e;
  --hl-params: #fd971f;
  --hl-property: #a6e22e;
  --hl-attr-value: #e6db74;
  --hl-selector: #a6e22e;
  --hl-default: #f8f8f2;
}

/* ─── Theme: Solarized Dark ────────────────────────────────── */
[data-theme="solarized-dark"] {
  --bg-title-bar: #002b36;
  --fg-title-bar: #839496;
  --bg-activity-bar: #002b36;
  --fg-activity-bar: #586e75;
  --fg-activity-bar-active: #93a1a1;
  --bg-activity-bar-active: #073642;
  --bg-sidebar: #073642;
  --fg-sidebar: #93a1a1;
  --fg-sidebar-muted: #586e75;
  --bg-editor: #002b36;
  --fg-editor: #839496;
  --bg-tab-bar: #073642;
  --fg-tab: #586e75;
  --fg-tab-active: #93a1a1;
  --bg-tab-active: #002b36;
  --border-tab: #002b36;
  --bg-line-highlight: #073642;
  --fg-line-number: #586e75;
  --fg-line-number-active: #93a1a1;
  --bg-minimap: #002b36;
  --fg-minimap: #073642;
  --bg-status-bar: #268bd2;
  --fg-status-bar: #fdf6e3;
  --bg-terminal: #002b36;
  --fg-terminal: #839496;
  --bg-palette: #073642;
  --fg-palette: #93a1a1;
  --border-palette: #586e75;
  --bg-palette-selected: #094352;
  --cursor-color: #93a1a1;
  --hl-keyword: #859900;
  --hl-string: #2aa198;
  --hl-comment: #586e75;
  --hl-number: #d33682;
  --hl-function: #b58900;
  --hl-class: #cb4b16;
  --hl-variable: #839496;
  --hl-type: #cb4b16;
  --hl-operator: #93a1a1;
  --hl-punctuation: #93a1a1;
  --hl-tag: #268bd2;
  --hl-attr: #b58900;
  --hl-built_in: #cb4b16;
  --hl-literal: #859900;
  --hl-meta: #839496;
  --hl-regexp: #2aa198;
  --hl-title: #b58900;
  --hl-params: #93a1a1;
  --hl-property: #839496;
  --hl-attr-value: #2aa198;
  --hl-selector: #b58900;
  --hl-default: #839496;
}

/* ─── Theme: GitHub Light ──────────────────────────────────── */
[data-theme="github-light"] {
  --bg-title-bar: #f3f3f3;
  --fg-title-bar: #333333;
  --bg-activity-bar: #f3f3f3;
  --fg-activity-bar: #6e7681;
  --fg-activity-bar-active: #1f2328;
  --bg-activity-bar-active: #ffffff;
  --bg-sidebar: #f6f8fa;
  --fg-sidebar: #1f2328;
  --fg-sidebar-muted: #656d76;
  --bg-editor: #ffffff;
  --fg-editor: #24292f;
  --bg-tab-bar: #f6f8fa;
  --fg-tab: #656d76;
  --fg-tab-active: #1f2328;
  --bg-tab-active: #ffffff;
  --border-tab: #ffffff;
  --bg-line-highlight: #f6f8fa;
  --fg-line-number: #8c959f;
  --fg-line-number-active: #1f2328;
  --bg-minimap: #ffffff;
  --fg-minimap: #d0d7de;
  --bg-status-bar: #1f883d;
  --fg-status-bar: #ffffff;
  --bg-terminal: #ffffff;
  --fg-terminal: #24292f;
  --bg-palette: #ffffff;
  --fg-palette: #1f2328;
  --border-palette: #d0d7de;
  --bg-palette-selected: #ddf4ff;
  --cursor-color: #24292f;
  --hl-keyword: #cf222e;
  --hl-string: #0a3069;
  --hl-comment: #6e7781;
  --hl-number: #0550ae;
  --hl-function: #8250df;
  --hl-class: #953800;
  --hl-variable: #953800;
  --hl-type: #953800;
  --hl-operator: #24292f;
  --hl-punctuation: #24292f;
  --hl-tag: #116329;
  --hl-attr: #0550ae;
  --hl-built_in: #0550ae;
  --hl-literal: #0550ae;
  --hl-meta: #24292f;
  --hl-regexp: #0a3069;
  --hl-title: #8250df;
  --hl-params: #24292f;
  --hl-property: #0550ae;
  --hl-attr-value: #0a3069;
  --hl-selector: #116329;
  --hl-default: #24292f;
}

/* ─── Theme: Synthwave ─────────────────────────────────────── */
[data-theme="synthwave"] {
  --bg-title-bar: #1a1033;
  --fg-title-bar: #f92aad;
  --bg-activity-bar: #1a1033;
  --fg-activity-bar: #848bbd;
  --fg-activity-bar-active: #f92aad;
  --bg-activity-bar-active: #241b3d;
  --bg-sidebar: #241b3d;
  --fg-sidebar: #e0e0e0;
  --fg-sidebar-muted: #848bbd;
  --bg-editor: #2b213a;
  --fg-editor: #e0e0e0;
  --bg-tab-bar: #1a1033;
  --fg-tab: #848bbd;
  --fg-tab-active: #f92aad;
  --bg-tab-active: #2b213a;
  --border-tab: #2b213a;
  --bg-line-highlight: #34294f;
  --fg-line-number: #848bbd;
  --fg-line-number-active: #f92aad;
  --bg-minimap: #2b213a;
  --fg-minimap: #34294f;
  --bg-status-bar: #f92aad;
  --fg-status-bar: #1a1033;
  --bg-terminal: #2b213a;
  --fg-terminal: #e0e0e0;
  --bg-palette: #241b3d;
  --fg-palette: #e0e0e0;
  --border-palette: #495495;
  --bg-palette-selected: #34294f;
  --cursor-color: #f92aad;
  --hl-keyword: #f92aad;
  --hl-string: #ff8b39;
  --hl-comment: #848bbd;
  --hl-number: #b893ce;
  --hl-function: #36f9f6;
  --hl-class: #72f1b8;
  --hl-variable: #e0e0e0;
  --hl-type: #72f1b8;
  --hl-operator: #f92aad;
  --hl-punctuation: #e0e0e0;
  --hl-tag: #f92aad;
  --hl-attr: #36f9f6;
  --hl-built_in: #72f1b8;
  --hl-literal: #b893ce;
  --hl-meta: #e0e0e0;
  --hl-regexp: #ff8b39;
  --hl-title: #36f9f6;
  --hl-params: #ff8b39;
  --hl-property: #36f9f6;
  --hl-attr-value: #ff8b39;
  --hl-selector: #36f9f6;
  --hl-default: #e0e0e0;
}

/* ─── Syntax highlighting via theme variables ──────────────── */
.hljs { color: var(--hl-default); background: transparent; }
.hljs-keyword, .hljs-selector-tag { color: var(--hl-keyword); }
.hljs-string, .hljs-addition { color: var(--hl-string); }
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-number, .hljs-literal { color: var(--hl-number); }
.hljs-title, .hljs-title.function_, .hljs-title.class_ { color: var(--hl-function); }
.hljs-class .hljs-title, .hljs-type { color: var(--hl-class); }
.hljs-variable, .hljs-template-variable { color: var(--hl-variable); }
.hljs-built_in, .hljs-builtin-name { color: var(--hl-built_in); }
.hljs-operator { color: var(--hl-operator); }
.hljs-punctuation { color: var(--hl-punctuation); }
.hljs-tag { color: var(--hl-tag); }
.hljs-name { color: var(--hl-tag); }
.hljs-attr { color: var(--hl-attr); }
.hljs-attribute { color: var(--hl-attr); }
.hljs-meta { color: var(--hl-meta); }
.hljs-regexp { color: var(--hl-regexp); }
.hljs-params { color: var(--hl-params); }
.hljs-property { color: var(--hl-property); }
.hljs-selector-class, .hljs-selector-id { color: var(--hl-selector); }
.hljs-subst { color: var(--hl-default); }
.hljs-section { color: var(--hl-function); font-weight: bold; }
.hljs-symbol { color: var(--hl-variable); }
.hljs-deletion { color: var(--hl-regexp); }

/* ─── App Layout ───────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* Title Bar */
.title-bar {
  display: flex;
  align-items: center;
  height: var(--title-bar-height);
  background: var(--bg-title-bar);
  color: var(--fg-title-bar);
  padding: 0 8px;
  flex-shrink: 0;
  user-select: none;
  -webkit-app-region: drag;
}

.title-bar-traffic {
  display: flex;
  gap: 8px;
  width: 70px;
  flex-shrink: 0;
}

.traffic-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.traffic-light.close { background: #ff5f57; }
.traffic-light.minimize { background: #febc2e; }
.traffic-light.maximize { background: #28c840; }

.title-bar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
}

.title-bar-icon { opacity: 0.7; display: flex; }

.title-bar-actions {
  width: 70px;
  display: flex;
  justify-content: flex-end;
  -webkit-app-region: no-drag;
}

.title-btn {
  padding: 4px;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.title-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }

/* Workbench */
.workbench {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Activity Bar */
.activity-bar {
  width: var(--activity-bar-width);
  background: var(--bg-activity-bar);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
  flex-shrink: 0;
}

.activity-item {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-activity-bar);
  position: relative;
  transition: color 0.15s;
}

.activity-item:hover { color: var(--fg-activity-bar-active); }

.activity-item.active {
  color: var(--fg-activity-bar-active);
}

.activity-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--fg-activity-bar-active);
}

.activity-spacer { flex: 1; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--fg-sidebar);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 10px 20px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--fg-sidebar-muted);
}

.sidebar-folder {
  padding: 4px 8px 4px 4px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.folder-chevron { font-size: 10px; color: var(--fg-sidebar-muted); }

.file-tree {
  list-style: none;
  padding: 0;
}

.file-tree li {
  padding: 3px 8px 3px 20px;
  font-size: 13px;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-tree li.active {
  background: var(--bg-line-highlight);
}

.file-tree li:hover:not(.active) {
  background: rgba(255,255,255,0.04);
}

.file-icon { font-size: 14px; flex-shrink: 0; opacity: 0.8; }

/* Editor Area */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-editor);
  min-width: 0;
}

.tab-bar {
  display: flex;
  height: var(--tab-bar-height);
  background: var(--bg-tab-bar);
  flex-shrink: 0;
  overflow: hidden;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 100%;
  background: var(--bg-tab-bar);
  color: var(--fg-tab);
  font-size: 13px;
  border-right: 1px solid rgba(255,255,255,0.05);
  min-width: 120px;
  max-width: 200px;
  cursor: default;
}

.tab.active {
  background: var(--bg-tab-active);
  color: var(--fg-tab-active);
  border-top: 1px solid var(--border-tab);
}

.tab-icon { font-size: 14px; }

.tab-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-close {
  opacity: 0;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 3px;
}

.tab:hover .tab-close { opacity: 0.6; }
.tab-close:hover { opacity: 1 !important; background: rgba(255,255,255,0.1); }

/* Editor Container */
.editor-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  outline: none;
  cursor: text;
}

.editor-container:focus { outline: none; }

.line-numbers {
  width: var(--line-number-width);
  padding: 8px 8px 8px 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--editor-font-size);
  line-height: var(--editor-line-height);
  color: var(--fg-line-number);
  background: var(--bg-editor);
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
  white-space: pre;
}

.line-numbers .active {
  color: var(--fg-line-number-active);
}

.editor-content {
  flex: 1;
  overflow: auto;
  position: relative;
  min-width: 0;
}

.editor-pre {
  margin: 0;
  padding: 8px 16px 8px 8px;
  font-family: var(--font-mono);
  font-size: var(--editor-font-size);
  line-height: var(--editor-line-height);
  color: var(--fg-editor);
  white-space: pre;
  tab-size: 4;
  min-height: 100%;
  position: relative;
}

.editor-pre code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Current line highlight */
.line-highlight-overlay {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  background: var(--bg-line-highlight);
  pointer-events: none;
  z-index: 0;
  transition: top 0.05s ease-out;
}

.editor-pre { z-index: 1; position: relative; }

/* Cursor */
.cursor {
  display: inline-block;
  width: 2px;
  height: calc(var(--editor-font-size) * var(--editor-line-height));
  background: var(--cursor-color);
  vertical-align: text-bottom;
  margin-left: -1px;
  animation: blink 1s step-end infinite;
}

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

/* Minimap */
.minimap {
  width: var(--minimap-width);
  background: var(--bg-minimap);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border-left: 1px solid rgba(255,255,255,0.05);
}

.minimap-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  font-family: var(--font-mono);
  font-size: 2px;
  line-height: 3px;
  color: var(--fg-minimap);
  white-space: pre;
  padding: 4px 2px;
  opacity: 0.6;
  pointer-events: none;
  word-break: break-all;
}

.minimap-viewport {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(121, 121, 121, 0.2);
  border: 1px solid rgba(121, 121, 121, 0.3);
  pointer-events: none;
  min-height: 20px;
}

.mobile-hint {
  display: none;
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0.8;
  z-index: 10;
}

/* Terminal Panel */
.terminal-panel {
  height: 180px;
  background: var(--bg-terminal);
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.terminal-panel.hidden { display: none; }

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-sidebar-muted);
  background: var(--bg-tab-bar);
}

.terminal-close {
  font-size: 16px;
  opacity: 0.6;
  padding: 0 4px;
}

.terminal-close:hover { opacity: 1; }

.terminal-body {
  flex: 1;
  overflow: auto;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-terminal);
  white-space: pre-wrap;
}

.terminal-line-success { color: #4ec9b0; }
.terminal-line-info { color: var(--fg-terminal); }
.terminal-line-dim { color: var(--fg-sidebar-muted); }

/* Status Bar */
.status-bar {
  height: var(--status-bar-height);
  background: var(--bg-status-bar);
  color: var(--fg-status-bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 12px;
  flex-shrink: 0;
  user-select: none;
}

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

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: default;
  white-space: nowrap;
}

.status-branch svg { flex-shrink: 0; }

.status-attribution a {
  opacity: 0.85;
  transition: opacity 0.15s;
}

.status-attribution a:hover {
  opacity: 1;
  text-decoration: none;
}

/* Command Palette */
.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 80px;
  z-index: 1000;
}

.palette-overlay.hidden { display: none; }

.palette {
  width: 520px;
  max-width: 90vw;
  max-height: calc(100vh - 100px);
  background: var(--bg-palette);
  border: 1px solid var(--border-palette);
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.palette-input-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-palette);
}

.palette-prompt {
  color: var(--fg-sidebar-muted);
  margin-right: 8px;
  font-size: 16px;
}

.palette-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--fg-palette);
  font-family: var(--font-ui);
  font-size: 14px;
  outline: none;
}

.palette-list {
  list-style: none;
  margin: 0;
  padding: 4px 0 6px;
  overflow-y: auto;
  flex: 0 1 auto;
}

.palette-list li {
  padding: 5px 12px;
  font-size: 13px;
  color: var(--fg-palette);
  cursor: default;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}

.palette-list li[data-id] {
  cursor: pointer;
}

.palette-list li.palette-header {
  padding: 8px 12px 3px;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-sidebar-muted);
  cursor: default;
  pointer-events: none;
  background: transparent !important;
  min-height: auto;
}

.palette-list li.palette-header:first-child {
  margin-top: 0;
}

.palette-list li.palette-header:hover {
  background: transparent;
}

.palette-list li[data-id]:hover,
.palette-list li.selected {
  background: var(--bg-palette-selected);
}

.palette-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.palette-check {
  color: var(--fg-sidebar-muted);
  font-size: 12px;
  line-height: 1;
}

.palette-kbd {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--fg-sidebar-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-palette);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
}

.status-auto {
  opacity: 0;
  transition: opacity 0.2s;
}

.status-auto.active {
  opacity: 1;
  font-weight: 600;
}

/* Fullscreen */
:fullscreen .title-bar-traffic { display: none; }

/* Mobile */
@media (max-width: 768px) {
  .sidebar,
  .minimap,
  .activity-bar .activity-item:not(.active):not(#btn-settings) {
    display: none;
  }

  .activity-bar { width: 0; overflow: hidden; }
  .sidebar { width: 0; }

  .mobile-hint { display: block; }

  .status-left .status-item:not(.status-branch) { display: none; }
  .status-right .status-item:not(#status-position):not(#status-language) { display: none; }

  :root {
    --line-number-width: 36px;
    --editor-font-size: 12px;
  }
}

@media (max-width: 480px) {
  .title-bar-traffic { display: none; }
  .status-attribution { display: none; }
}