/* ============================================================
   Research IDE — VS Code Dark+ Theme (Authentic)
   ============================================================ */

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

:root {
  --vscode-editor-bg: #1e1e1e;
  --vscode-sidebar-bg: #252526;
  --vscode-activitybar-bg: #333333;
  --vscode-statusbar-bg: #007acc;
  --vscode-titlebar-bg: #3c3c3c;
  --vscode-tab-inactive-bg: #2d2d2d;
  --vscode-tab-active-bg: #1e1e1e;
  --vscode-border: #2a2d2e;
  --vscode-fg: #d4d4d4;
  --vscode-fg-muted: #858585;
  --vscode-accent: #007acc;
  --vscode-link: #3794ff;

  /* Aliases for backward compat */
  --titlebar-bg:   var(--vscode-titlebar-bg);
  --activitybar-bg: var(--vscode-activitybar-bg);
  --sidebar-bg:    var(--vscode-sidebar-bg);
  --editor-bg:     var(--vscode-editor-bg);
  --panel-bg:      var(--vscode-editor-bg);
  --tab-bg:        var(--vscode-tab-inactive-bg);
  --tab-active-bg: var(--vscode-tab-active-bg);
  --tab-inactive-bg: var(--vscode-tab-inactive-bg);
  --statusbar-bg:  var(--vscode-statusbar-bg);
  --border:        var(--vscode-border);
  --border-light:  #3c3c3c;
  --text:          var(--vscode-fg);
  --text-muted:    var(--vscode-fg-muted);
  --accent:        #569cd6;
  --accent-bright: var(--vscode-link);
  --string:        #ce9178;
  --keyword:       #c586c0;
  --number:        #b5cea8;
  --comment:       #6a9955;
  --function:      #dcdcaa;
  --tag-color:     #4ec9b0;
  --error:         #f85149;
  --warning:       #d29922;
  --hover-bg:      rgba(255,255,255,0.06);
  --list-active:   rgba(255,255,255,0.06);
  --focus-border:  var(--vscode-accent);
  --selection-bg:  #094771;

  --ui-font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --editor-font: 'Monaspace Argon', 'Consolas', 'Courier New', monospace;

  --activitybar-w: 48px;
  --sidebar-w:     250px;
  --statusbar-h:   22px;
  --titlebar-h:    30px;
  --tabbar-h:      35px;
  --breadcrumb-h:  22px;
  --gutter-w:      50px;
  --terminal-h:    250px;
  --panel-header-h: 35px;
}

/* ---------- VS Code Light+ Theme ---------- */
.light-theme {
  --vscode-editor-bg: #ffffff;
  --vscode-sidebar-bg: #f3f3f3;
  --vscode-activitybar-bg: #e8e8e8;
  --activity-active: #333333;
  --vscode-statusbar-bg: #007acc;
  --vscode-titlebar-bg: #dddddd;
  --vscode-tab-inactive-bg: #ececec;
  --vscode-tab-active-bg: #ffffff;
  --vscode-border: #e5e5e5;
  --vscode-fg: #333333;
  --vscode-fg-muted: #616161;
  --vscode-accent: #007acc;
  --vscode-link: #006ab1;

  --border-light: #d4d4d4;
  --accent: #0000ff;
  --accent-bright: #006ab1;
  --string: #a31515;
  --keyword: #af00db;
  --number: #098658;
  --comment: #008000;
  --function: #795e26;
  --tag-color: #267f99;
  --error: #d32f2f;
  --warning: #bf8803;
  --hover-bg: rgba(0,0,0,0.04);
  --list-active: rgba(0,0,0,0.06);
  --selection-bg: #add6ff;
}

/* Re-declare aliases so children inherit the light values */
.light-theme {
  --titlebar-bg:   var(--vscode-titlebar-bg);
  --activitybar-bg: var(--vscode-activitybar-bg);
  --sidebar-bg:    var(--vscode-sidebar-bg);
  --editor-bg:     var(--vscode-editor-bg);
  --panel-bg:      var(--vscode-editor-bg);
  --tab-bg:        var(--vscode-tab-inactive-bg);
  --tab-active-bg: var(--vscode-tab-active-bg);
  --tab-inactive-bg: var(--vscode-tab-inactive-bg);
  --statusbar-bg:  var(--vscode-statusbar-bg);
  --border:        var(--vscode-border);
  --border-light:  #d4d4d4;
  --text:          var(--vscode-fg);
  --text-muted:    var(--vscode-fg-muted);
}

.light-theme *::-webkit-scrollbar-thumb { background: #c1c1c1; border: 2px solid transparent; background-clip: content-box; }
.light-theme * { scrollbar-color: #c1c1c1 transparent; }

html { font-size: 14px; }

body {
  background: var(--editor-bg);
  color: var(--text);
  font-family: var(--editor-font);
  font-feature-settings: 'calt' 1;
  line-height: 1.5;
  min-height: 100vh;
  overflow: hidden;
}

a { color: var(--vscode-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Custom Scrollbars ---------- */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #424242; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: #424242 transparent; }

/* ---------- VS Code Layout Shell ---------- */
.vscode-shell {
  display: grid;
  grid-template-rows: var(--titlebar-h) 1fr var(--terminal-current-h, 0px) var(--statusbar-h);
  grid-template-columns: var(--activitybar-w) var(--sidebar-w) 1fr var(--chatpanel-w, 0px);
  grid-template-areas:
    "titlebar  titlebar  titlebar  titlebar"
    "activity  sidebar   editor    chatpanel"
    "activity  sidebar   terminal  chatpanel"
    "statusbar statusbar statusbar statusbar";
  height: 100vh;
  width: 100vw;
}

.vscode-shell.sidebar-collapsed {
  grid-template-columns: var(--activitybar-w) 0px 1fr var(--chatpanel-w, 0px);
}

/* When terminal is closed, the CSS variable is 0px */

/* ---------- Title Bar ---------- */
.titlebar {
  grid-area: titlebar;
  background: var(--titlebar-bg);
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
  user-select: none;
  z-index: 1000;
}

.titlebar-dots {
  display: flex;
  gap: 8px;
  margin-right: 16px;
}

.titlebar-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.titlebar-dot.red { background: #ff5f57; }
.titlebar-dot.yellow { background: #febc2e; }
.titlebar-dot.green { background: #28c840; }

.titlebar-text {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--ui-font);
  cursor: pointer;
  -webkit-app-region: no-drag;
}

.titlebar-text:hover {
  color: var(--text);
}

/* ---------- Activity Bar ---------- */
.activitybar {
  grid-area: activity;
  background: var(--activitybar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
  border-right: 1px solid var(--border);
  z-index: 100;
}

.activity-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  color: var(--text-muted);
  font-size: 1.3rem;
  transition: color 0.15s;
  border: none;
  background: none;
}

.activity-icon:hover { color: var(--text); }

.activity-icon.active {
  color: var(--activity-active, #fff);
}

.activity-icon.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--activity-active, #fff);
}

.activity-icon svg {
  width: 24px;
  height: 24px;
}

.activity-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--statusbar-bg);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ui-font);
}

/* ---------- Sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 90;
  position: relative;
}

.vscode-shell.sidebar-collapsed .sidebar {
  display: none;
}

.sidebar-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 200;
  background: transparent;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle:active {
  background: var(--vscode-accent);
}

.sidebar-title {
  padding: 0 20px;
  height: 35px;
  display: flex;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 400;
  flex-shrink: 0;
  font-family: var(--ui-font);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
}

/* Tree sections */
.tree-section {
  border-top: none;
}

.tree-section-header {
  display: flex;
  align-items: center;
  padding: 0 8px 0 10px;
  height: 22px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  font-family: var(--ui-font);
}

.tree-section-header:hover {
  background: var(--hover-bg);
}

.tree-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  font-size: 8px;
  color: var(--text);
  transition: transform 0.15s;
  flex-shrink: 0;
  margin-right: 4px;
}

.tree-chevron.open {
  transform: rotate(90deg);
}

.tree-section-body {
  display: none;
}

.tree-section-body.open {
  display: block;
}

.tree-item {
  display: flex;
  align-items: center;
  height: 22px;
  padding: 0 8px 0 26px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--ui-font);
  color: var(--text);
  transition: background 0.1s;
  text-decoration: none;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-item:hover {
  background: var(--hover-bg);
  text-decoration: none;
}

.tree-item.active {
  background: var(--list-active);
}

.tree-item-icon {
  flex-shrink: 0;
  font-size: 13px;
  width: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tree-item-icon svg {
  width: 16px;
  height: 16px;
}

.tree-item-icon.file svg { color: var(--accent); }
.tree-item-icon.file-md svg { color: var(--vscode-link); }
.tree-item-icon.file-pdf svg { color: #e06c75; }
.tree-item-icon.folder svg { color: #dcb67a; }
.tree-item-icon.file-link svg { color: var(--vscode-link); }
.tree-item-icon.file-mail svg { color: var(--tag-color); }
.tree-item-icon.file-chart svg { color: var(--tag-color); }
.tree-item-icon.file-txt svg { color: var(--text-muted); }

.tree-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.tree-sub-item {
  padding-left: 34px;
}

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

/* Tab bar */
.tabbar {
  display: flex;
  align-items: stretch;
  background: var(--tab-inactive-bg);
  height: var(--tabbar-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.tab {
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--tab-inactive-bg);
  border-right: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
  position: relative;
  text-decoration: none;
  transition: background 0.1s;
  user-select: none;
  font-family: var(--ui-font);
  border-top: 1px solid transparent;
}

.tab:hover {
  background: var(--tab-active-bg);
  text-decoration: none;
}

.tab.active {
  background: var(--tab-active-bg);
  color: var(--text);
  border-top: 1px solid var(--vscode-accent);
  border-bottom: 1px solid var(--tab-active-bg);
  margin-bottom: -1px;
}

.tab-icon {
  display: inline-flex;
  align-items: center;
}

.tab-icon svg {
  width: 14px;
  height: 14px;
}

.tab-close {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0;
  cursor: pointer;
  padding: 2px;
  border-radius: 2px;
  background: none;
  border: none;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.tab:hover .tab-close,
.tab.active .tab-close {
  opacity: 1;
}

.tab-close:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

/* Breadcrumb */
.breadcrumb {
  height: var(--breadcrumb-h);
  padding: 0 16px 0 calc(var(--gutter-w) + 16px);
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--editor-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 4px;
  font-family: var(--ui-font);
}

.breadcrumb-sep { color: var(--text-muted); margin: 0 2px; }

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--text);
}

/* Editor content with gutter */
.editor-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  position: relative;
}

.editor-gutter {
  width: var(--gutter-w);
  flex-shrink: 0;
  background: var(--editor-bg);
  text-align: right;
  padding: 16px 12px 16px 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  user-select: none;
}

.editor-body {
  flex: 1;
  padding: 16px 24px 60px 16px;
  min-width: 0;
  line-height: 1.65;
}

/* ---------- Image Viewer (VS Code style) ---------- */
.image-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #141414;
  overflow: auto;
  padding: 40px;
}

.image-viewer-container {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-container img {
  max-width: min(400px, 80%);
  max-height: 60vh;
  object-fit: contain;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  border-radius: 2px;
}

.image-viewer-info {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--editor-font);
}

.file-img svg { color: #a074c4; }

/* ---------- Welcome Screen ---------- */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
}

.welcome-title {
  font-family: var(--editor-font);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  opacity: 0.3;
}

.welcome-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
  opacity: 0.5;
}

.welcome-actions {
  width: 280px;
}

.welcome-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-family: var(--ui-font);
}

.welcome-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  margin: 2px 0;
  cursor: pointer;
  color: var(--vscode-link);
  font-size: 13px;
  font-family: var(--editor-font);
  border-radius: 2px;
}

.welcome-link:hover {
  background: var(--hover-bg);
}

.welcome-link-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.welcome-link-icon svg {
  width: 16px;
  height: 16px;
}

.welcome-link-shortcut {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--tab-inactive-bg);
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* ---------- Line Highlight (Feature 3) ---------- */
.content-line {
  display: flex;
  align-items: baseline;
  min-height: 22px;
  transition: background 0.05s;
}

.content-line .line-number {
  width: var(--gutter-w);
  flex-shrink: 0;
  text-align: right;
  padding-right: 12px;
  font-size: 13px;
  color: var(--text-muted);
  user-select: none;
  line-height: 1.65;
}

.content-line .line-content {
  flex: 1;
  min-width: 0;
  line-height: 1.65;
}

.content-line.line-active {
  background: rgba(255,255,255,0.04);
}

.content-line.line-active .line-number {
  color: #c6c6c6;
}

/* ---------- Terminal Panel (Feature 2) ---------- */
.terminal-panel {
  grid-area: terminal;
  display: flex;
  flex-direction: column;
  background: var(--editor-bg);
  border-top: 1px solid var(--border);
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.terminal-resize-handle {
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 7px;
  cursor: row-resize;
  z-index: 10;
}

.terminal-resize-handle:hover,
.terminal-resize-handle:active {
  background: var(--vscode-accent);
}

.vscode-shell.terminal-open .terminal-panel {
  height: 100%;
}

.terminal-panel-header {
  height: var(--panel-header-h);
  display: flex;
  align-items: center;
  background: var(--editor-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0 8px;
  gap: 0;
  user-select: none;
}

.terminal-panel-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
}

.terminal-panel-tab {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: var(--panel-header-h);
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--ui-font);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  gap: 4px;
}

.terminal-panel-tab:hover { color: var(--text); }

.terminal-panel-tab.active {
  color: var(--text);
  border-bottom-color: var(--vscode-accent);
}

.terminal-panel-tab .tab-badge {
  font-size: 9px;
  background: var(--warning);
  color: #000;
  border-radius: 8px;
  padding: 0 5px;
  min-width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ui-font);
  font-weight: 600;
}

.terminal-panel-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.terminal-panel-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.terminal-panel-action-btn:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.terminal-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: var(--editor-font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.terminal-panel-body .terminal-welcome {
  color: var(--comment);
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.terminal-panel-body .terminal-connected {
  color: var(--tag-color);
  margin-bottom: 4px;
}

.terminal-panel-body .terminal-line {
  display: flex;
  align-items: flex-start;
  margin-bottom: 2px;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-panel-body .terminal-line .terminal-prompt {
  color: #6a9955;
  margin-right: 8px;
  flex-shrink: 0;
  user-select: none;
}

.terminal-panel-body .terminal-line .terminal-text {
  flex: 1;
  min-width: 0;
}

.terminal-panel-body .terminal-line.assistant-line {
  color: var(--text);
  padding-left: 0;
  margin-bottom: 4px;
}

.terminal-panel-body .terminal-line.error-line {
  color: var(--error);
}

.terminal-panel-body .terminal-line .terminal-spinner {
  color: var(--text-muted);
  animation: terminal-blink 1s step-end infinite;
}

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

.terminal-input-row {
  display: flex;
  align-items: center;
}

.terminal-input-row .terminal-prompt {
  color: #6a9955;
  margin-right: 8px;
  flex-shrink: 0;
}

.terminal-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--editor-font);
  font-size: 13px;
  padding: 0;
  caret-color: var(--text);
}

.terminal-input-row input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Problems tab content */
.terminal-problems {
  padding: 4px 0;
}

.terminal-problem-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  font-size: 12px;
  font-family: var(--ui-font);
}

.terminal-problem-icon {
  color: var(--warning);
  flex-shrink: 0;
}

.terminal-problem-text {
  color: var(--text);
  flex: 1;
}

.terminal-problem-source {
  color: var(--text-muted);
  font-size: 11px;
}

/* Output tab content */
.terminal-output-empty {
  color: var(--text-muted);
  font-family: var(--ui-font);
  font-size: 12px;
  padding: 8px 0;
}

.output-log {
  font-family: var(--editor-font);
  font-size: 12px;
  line-height: 1.6;
}

.output-log-line {
  display: flex;
  gap: 8px;
  padding: 1px 0;
  white-space: nowrap;
}

.output-log-ts {
  color: var(--text-muted);
  flex-shrink: 0;
}

.output-log-type {
  flex-shrink: 0;
  min-width: 72px;
}

.output-log-detail {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Command Palette (Feature 1) ---------- */
.command-palette-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.4);
  z-index: 5000;
  display: flex;
  justify-content: center;
  padding-top: 80px;
}

.command-palette {
  width: 640px;
  max-width: calc(100vw - 40px);
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  max-height: 360px;
  overflow: hidden;
  align-self: flex-start;
}

.command-palette-input {
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.command-palette-input input {
  flex: 1;
  height: 36px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--editor-font);
  font-size: 14px;
}

.command-palette-input input::placeholder {
  color: var(--text-muted);
}

.command-palette-results {
  flex: 1;
  overflow-y: auto;
  max-height: 300px;
}

.command-palette-row {
  display: flex;
  align-items: center;
  height: 22px;
  padding: 4px 12px;
  cursor: pointer;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}

.command-palette-row:hover,
.command-palette-row.selected {
  background: var(--selection-bg);
}

.command-palette-row-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.command-palette-row-icon svg {
  width: 16px;
  height: 16px;
}

.command-palette-row-name {
  flex-shrink: 0;
  font-size: 13px;
  white-space: nowrap;
}

.command-palette-row-name .match-char {
  font-weight: 700;
  color: var(--vscode-link);
}

.command-palette-row-path {
  flex: 1;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.command-palette-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--ui-font);
}

/* ---------- Status Bar ---------- */
.statusbar {
  grid-area: statusbar;
  background: var(--statusbar-bg);
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  color: #fff;
  z-index: 1000;
  justify-content: space-between;
  user-select: none;
  height: var(--statusbar-h);
  font-family: var(--ui-font);
}

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

.statusbar-item {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: default;
  padding: 0 4px;
  height: 100%;
}

.statusbar-item:hover {
  background: rgba(255,255,255,0.12);
}

.statusbar-item.clickable {
  cursor: pointer;
}

/* ---------- Editor-Styled Content (Home) ---------- */

/* Markdown-like headers */
.md-h1 {
  font-family: var(--editor-font);
  font-size: 1.6rem;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 4px;
}

.md-h1 .hash { color: var(--accent); margin-right: 8px; }

.md-h2 {
  font-family: var(--editor-font);
  font-size: 1.1rem;
  color: var(--accent);
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.md-h2 .hash { color: var(--accent); opacity: 0.5; margin-right: 6px; }

.md-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.md-paragraph {
  font-family: var(--editor-font);
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-muted);
  margin-bottom: 16px;
  max-width: 72ch;
}

/* Metrics (telemetry panel) */
.metrics-row {
  display: flex;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 24px;
  overflow: hidden;
}

.metric {
  flex: 1;
  background: var(--sidebar-bg);
  padding: 14px 16px;
  text-align: center;
}

.metric-value {
  font-family: var(--editor-font);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--number);
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-family: var(--editor-font);
  font-size: 0.7rem;
  color: var(--comment);
  margin-top: 4px;
}

/* Research areas as tree */
.research-list { margin-bottom: 24px; }

.research-item {
  border-left: 1px solid var(--border);
  margin-left: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

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

.research-item-header {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  gap: 8px;
  font-size: 13px;
  user-select: none;
}

.research-item-header .chevron {
  color: var(--text-muted);
  font-size: 8px;
  width: 12px;
  transition: transform 0.15s;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.research-item-header .chevron.open { transform: rotate(90deg); }
.research-item-header .folder-icon { color: #dcb67a; margin-right: 2px; }
.research-item-header .title { color: var(--text); }

.research-item-header .tag {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--tag-color);
  background: rgba(78,201,176,0.1);
  padding: 1px 8px;
  border-radius: 2px;
  border: 1px solid rgba(78,201,176,0.2);
}

.research-item-desc {
  padding: 4px 8px 10px 30px;
  font-family: var(--editor-font);
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: none;
}

.research-item-desc.open { display: block; }

/* Featured publications */
.pub-teaser { margin-bottom: 24px; }

.pub-teaser-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 4px 0;
  border-left: 1px solid var(--border);
  padding-left: 8px;
  margin-left: 8px;
  transition: background 0.1s;
}

.pub-teaser-item:hover { background: var(--hover-bg); }

.pub-teaser-year {
  font-size: 13px;
  color: var(--number);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.pub-teaser-venue {
  font-size: 12px;
  color: var(--string);
  flex-shrink: 0;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pub-teaser-title {
  font-family: var(--editor-font);
  font-size: 0.9rem;
  color: var(--text);
  flex: 1 1 0;
  min-width: 200px;
}

.pub-teaser-more {
  text-align: right;
  margin-top: 8px;
  font-size: 13px;
}

/* ---------- Publications Page Styles ---------- */

/* Search bar - command palette style */
.search-bar-container {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--editor-bg);
  padding: 12px 0;
  margin-bottom: 12px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--sidebar-bg);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  padding: 0 12px;
  max-width: 600px;
  margin: 0 auto;
}

.search-bar .search-icon-prefix {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  margin-right: 8px;
  flex-shrink: 0;
}

.search-bar .search-icon-prefix svg {
  width: 14px;
  height: 14px;
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--editor-font);
  font-size: 13px;
  padding: 8px 0;
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar .result-count {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 12px;
  font-variant-numeric: tabular-nums;
}

/* Tag filters */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 0 var(--gutter-w);
  padding-left: 0;
}

.tag-btn {
  font-family: var(--ui-font);
  font-size: 11px;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.tag-btn:hover {
  border-color: var(--tag-color);
  color: var(--tag-color);
}

.tag-btn.active {
  background: rgba(78,201,176,0.1);
  border-color: var(--tag-color);
  color: var(--tag-color);
}

.tag-btn-more {
  font-style: italic;
  color: var(--text-muted);
  border-style: dashed;
}

/* Publication list header */
.pub-list-header {
  display: flex;
  align-items: center;
  padding: 4px 12px 4px 0;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  font-family: var(--ui-font);
}

.pub-list-header .col-ln { width: var(--gutter-w); text-align: right; padding-right: 12px; }
.pub-list-header .col-year { width: 50px; }
.pub-list-header .col-title { flex: 1; min-width: 0; }
/* venue now inline under title */
/* tags column removed */

/* Publication rows */
.pub-row {
  transition: background 0.1s;
  position: relative;
}

.pub-row:hover { background: var(--hover-bg); }
.pub-row:focus { outline: 1px solid var(--vscode-accent); outline-offset: -1px; }
.pub-row:focus:not(:focus-visible) { outline: none; }

.pub-row.line-active { background: var(--hover-bg); }
.pub-row.line-active .pub-ln { color: var(--text); }

.pub-row-main {
  display: flex;
  align-items: baseline;
  padding: 5px 12px 5px 0;
  cursor: pointer;
  gap: 8px;
}

.pub-ln {
  width: var(--gutter-w);
  text-align: right;
  padding-right: 12px;
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
  user-select: none;
}

.pub-year {
  font-size: 13px;
  color: var(--number);
  width: 50px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.pub-title-col {
  flex: 1;
  min-width: 0;
}

.pub-title {
  font-family: var(--editor-font);
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 1px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}

.pub-authors {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pub-venue {
  font-size: 12px;
  color: var(--string);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 180px;
  flex-shrink: 0;
}

.pub-tag {
  font-family: var(--ui-font);
  font-size: 10px;
  padding: 1px 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 2px;
}

.pub-row:hover .pub-tag {
  color: var(--tag-color);
  background: rgba(78,201,176,0.06);
}

/* Expanded row - code fold style (legacy, replaced by peek widget) */
.pub-expanded {
  display: none;
  padding: 8px 12px 16px calc(var(--gutter-w) + 58px);
  background: rgba(37,37,38,0.5);
  border-left: 1px solid var(--border-light);
  margin-left: calc(var(--gutter-w) + 10px);
}

.pub-expanded.open { display: block; }

/* ---------- Peek Definition Widget ---------- */
.peek-widget {
  border-top: 2px solid #3794ff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  margin: 0 4px 4px 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 150ms ease-out;
}

.peek-widget.peek-open {
  max-height: 500px;
  transition: max-height 150ms ease-in;
}

.peek-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  padding: 0 8px 0 10px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  user-select: none;
}

.peek-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.peek-header-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.peek-header-icon svg {
  width: 14px;
  height: 14px;
}

.peek-header-filename {
  font-family: var(--ui-font);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.peek-header-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.peek-header-close:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.peek-content {
  background: var(--editor-bg);
  padding: 12px 16px;
  max-height: 220px;
  overflow-y: auto;
  border-left: 2px solid var(--vscode-link);
}

.peek-tldr {
  margin-bottom: 10px;
}

.peek-comment {
  font-family: var(--editor-font);
  font-size: 12px;
  color: var(--comment);
  margin-bottom: 4px;
}

.peek-tldr-text {
  font-family: var(--editor-font);
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 650px;
}

.peek-metadata {
  margin-bottom: 8px;
}

.peek-meta-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--editor-font);
  font-size: 12px;
  line-height: 1.8;
}

.peek-meta-key {
  color: #c586c0;
  flex-shrink: 0;
}

.peek-meta-val-string {
  color: #ce9178;
}

.peek-meta-val-number {
  color: #b5cea8;
}

.peek-meta-val-tag {
  color: #4ec9b0;
}

.peek-meta-val-link {
  color: #3794ff;
  text-decoration: none;
}

.peek-meta-val-link:hover {
  text-decoration: underline;
}

.peek-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.peek-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pub-abstract {
  font-family: var(--editor-font);
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 10px;
  max-width: 650px;
}

.pub-abstract .label {
  font-family: var(--editor-font);
  font-size: 12px;
  color: var(--comment);
  margin-bottom: 4px;
}

.pub-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.pub-action-btn {
  font-family: var(--ui-font);
  font-size: 12px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--sidebar-bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pub-action-btn:hover {
  border-color: var(--vscode-accent);
  color: var(--vscode-link);
  text-decoration: none;
}

.pub-action-btn.chat-btn {
  border-color: #6a9955;
  color: #6a9955;
}

.pub-action-btn.chat-btn:hover {
  background: rgba(106,153,85,0.1);
}

/* ---------- Loading ---------- */
.loading {
  font-family: var(--editor-font);
  font-size: 13px;
  color: var(--text-muted);
  padding: 40px 16px;
}

/* ---------- Footer ---------- */
.page-footer {
  margin-top: 32px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Chat Panel (right sidebar) ---------- */
.chat-panel {
  grid-area: chatpanel;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

.chat-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 200;
}

.chat-resize-handle:hover,
.chat-resize-handle:active {
  background: var(--vscode-accent);
}

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

.chat-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ui-font);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
}

.chat-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
}

.chat-panel-close:hover {
  color: var(--text);
}

.chat-panel-context {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-family: var(--ui-font);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--editor-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--ui-font);
  font-size: 13px;
  flex: 1;
}

.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}

.chat-suggestion {
  background: var(--editor-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.chat-suggestion:hover {
  background: var(--hover-bg);
  border-color: var(--vscode-accent);
}

.chat-msg {
  display: flex;
  gap: 8px;
  font-family: var(--ui-font);
  font-size: 13px;
  line-height: 1.5;
}

.chat-msg-avatar {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--hover-bg);
  color: var(--text-muted);
}

.chat-msg-user {
  flex-direction: row-reverse;
}

.chat-msg-user .chat-msg-content {
  text-align: right;
}

.chat-msg-user .chat-msg-avatar {
  background: var(--vscode-accent);
  color: #fff;
}

.chat-msg-content {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-error {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--error, #f85149);
  font-size: 12px;
  font-family: var(--ui-font);
}

.chat-msg-status {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--ui-font);
  text-align: center;
}

.chat-typing {
  color: var(--text-muted);
  font-style: italic;
}

.chat-panel-input {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--sidebar-bg);
  flex-shrink: 0;
}

.chat-panel-input input {
  flex: 1;
  background: var(--editor-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
}

.chat-panel-input input:focus {
  border-color: var(--vscode-accent);
}

.chat-send-btn {
  background: none;
  border: none;
  color: var(--vscode-accent);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  opacity: 0.7;
}

.chat-send-btn:hover:not(:disabled) {
  opacity: 1;
}

.chat-send-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ---------- Paper View ---------- */
.paper-view {
  display: flex;
  flex: 1;
  min-height: 0;
}

.paper-gutter {
  width: var(--gutter-w);
  flex-shrink: 0;
  padding: 16px 12px 60px 0;
  text-align: right;
  user-select: none;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.65;
}

.paper-gutter-line {
  height: 1.65em;
}

.paper-body {
  flex: 1;
  padding: 16px 24px 60px 16px;
  min-width: 0;
  max-width: 80ch;
}

.paper-header {
  margin-bottom: 24px;
}

.paper-header-title {
  font-family: var(--editor-font);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.paper-header-venue {
  font-size: 13px;
  color: var(--string);
  margin-bottom: 4px;
}

.paper-header-authors {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.paper-header-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.paper-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 12px;
  font-family: var(--ui-font);
  color: var(--text);
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.paper-action-btn:hover {
  background: var(--hover-bg);
  border-color: var(--vscode-accent);
  text-decoration: none;
}

.paper-action-btn.active {
  background: var(--hover-bg);
  border-color: var(--vscode-accent);
}

.bibtex-peek {
  margin-top: 10px;
  border: 1px solid var(--vscode-accent);
  border-radius: 2px;
  overflow: hidden;
}

.bibtex-peek-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
}

.bibtex-peek-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ui-font);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bibtex-peek-actions {
  display: flex;
  gap: 4px;
}

.bibtex-peek-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--ui-font);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 2px;
}

.bibtex-peek-btn:hover {
  color: var(--text);
  background: var(--hover-bg);
}

.bibtex-peek-content {
  padding: 10px 12px;
  background: var(--editor-bg);
  font-family: var(--editor-font);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  overflow-x: auto;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
  border-left: 2px solid var(--vscode-accent);
}

.bibtex-peek-content code {
  font-family: inherit;
  background: none;
  padding: 0;
}

.paper-header-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.paper-markdown {
  font-family: var(--editor-font);
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text);
}

.paper-markdown h1 { font-size: 1.3rem; color: var(--text); margin: 28px 0 12px; font-weight: 700; }
.paper-markdown h2 { font-size: 1.1rem; color: var(--accent); margin: 24px 0 10px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.paper-markdown h3 { font-size: 1rem; color: var(--accent); margin: 20px 0 8px; }
.paper-markdown p { margin: 0 0 12px; }
.paper-markdown ul, .paper-markdown ol { margin: 0 0 12px; padding-left: 24px; }
.paper-markdown li { margin-bottom: 4px; }
.paper-markdown blockquote { border-left: 3px solid var(--accent); padding: 4px 12px; margin: 8px 0; color: var(--text-muted); }
.paper-markdown code { font-family: var(--editor-font); background: var(--sidebar-bg); padding: 1px 4px; border-radius: 2px; font-size: 0.9em; }
.paper-markdown pre { background: var(--sidebar-bg); padding: 12px; border-radius: 2px; overflow-x: auto; margin: 8px 0 16px; }
.paper-markdown pre code { background: none; padding: 0; }
.paper-markdown table { border-collapse: collapse; margin: 8px 0 16px; width: 100%; }
.paper-markdown th, .paper-markdown td { border: 1px solid var(--border); padding: 6px 10px; font-size: 13px; text-align: left; }
.paper-markdown th { background: var(--sidebar-bg); font-weight: 600; }
.paper-markdown img { max-width: 100%; border-radius: 2px; margin: 8px 0; }
.paper-markdown a { color: var(--vscode-link); }
.paper-markdown hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.skeleton-line {
  height: 14px;
  background: var(--hover-bg);
  border-radius: 2px;
  margin: 4px 0;
}

.paper-view-loading {
  opacity: 0.5;
}

/* ---------- Mobile Hamburger ---------- */
.hamburger {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
  width: 40px;
  height: var(--titlebar-h);
  background: var(--titlebar-bg);
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  z-index: 1500;
}

.mobile-overlay.open { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .vscode-shell {
    grid-template-columns: 0 0 1fr;
    grid-template-areas:
      "titlebar  titlebar  titlebar"
      "editor    editor    editor"
      "terminal  terminal  terminal"
      "statusbar statusbar statusbar";
  }

  .activitybar { display: none; }
  .sidebar { display: none; }

  .hamburger { display: flex; }

  /* Mobile sidebar overlay */
  .vscode-shell.mobile-sidebar-open .sidebar {
    display: flex;
    position: fixed;
    top: var(--titlebar-h);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--titlebar-h) - var(--statusbar-h));
    z-index: 1600;
  }

  .vscode-shell.mobile-sidebar-open .activitybar {
    display: flex;
    position: fixed;
    top: var(--titlebar-h);
    left: 0;
    width: 48px;
    height: calc(100vh - var(--titlebar-h) - var(--statusbar-h));
    z-index: 1700;
  }

  .vscode-shell.mobile-sidebar-open .sidebar {
    left: 48px;
  }

  .breadcrumb { padding-left: 16px; }

  .editor-gutter { display: none; }

  .editor-body { padding: 16px; }

  .pub-venue, .pub-tags { display: none; }
  .pub-list-header .col-venue,
  .pub-list-header .col-tags,
  .pub-list-header .col-ln { display: none; }
  .pub-ln { display: none; }

  .pub-expanded {
    margin-left: 0;
    padding-left: 16px;
  }

  .peek-widget {
    margin: 0;
  }

  .peek-content {
    padding: 10px 12px;
  }

  .peek-meta-row {
    flex-wrap: wrap;
  }

  .search-bar { max-width: 100%; }

  .metrics-row { flex-direction: column; }

  .titlebar-dots { display: none; }

  .content-line .line-number { display: none; }
}

@media (max-width: 600px) {
  .md-h1 { font-size: 1.2rem; }
  .metric-value { font-size: 1.2rem; }
}
