/* ============================================
   Nexus IDE — Components
   通用组件：welcome / modal / cmdk / dropdown /
   context-menu / toast / drop-zone / form / btn /
   file-tree / settings 面板 / 各类 sidebar 面板
   ============================================ */

/* ============================================
   按钮
   ============================================ */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 120ms ease;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.btn-primary {
  background: var(--ide-accent);
  color: #08080c;
  border-color: transparent;
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--ide-accent-soft);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-secondary {
  background: var(--ide-bg-soft);
  color: var(--ide-text-primary);
  border-color: var(--ide-border);
}
.btn-secondary:hover {
  background: var(--ide-bg-base);
  border-color: var(--ide-border-strong);
}
.btn-ghost {
  background: transparent;
  color: var(--ide-text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  color: var(--ide-text-primary);
  background: var(--ide-bg-soft);
}

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 11px; }

/* ============================================
   KBD
   ============================================ */
.kbd {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--ide-bg-soft);
  border: 1px solid var(--ide-border);
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: var(--ide-text-tertiary);
  line-height: 1;
}

/* ============================================
   表单
   ============================================ */
.form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ide-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row .form-group { margin-bottom: 14px; }
.form-check label {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ide-text-primary);
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--ide-accent);
  cursor: pointer;
}

.form-input,
.form-input-suffix input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  background: var(--ide-bg-soft);
  border: 1px solid var(--ide-border);
  border-radius: 6px;
  color: var(--ide-text-primary);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color 120ms ease, background 120ms ease;
}
.form-input:focus,
.form-input-suffix input:focus {
  border-color: var(--ide-accent);
  background: var(--ide-bg-base);
}
.form-input::placeholder,
.form-input-suffix input::placeholder {
  color: var(--ide-text-muted);
}

.form-input-suffix {
  position: relative;
  display: flex;
  align-items: center;
}
.form-input-suffix .form-input,
.form-input-suffix input {
  padding-right: 36px;
}
.form-suffix-btn {
  position: absolute;
  right: 4px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--ide-text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 120ms ease;
}
.form-suffix-btn:hover {
  background: var(--ide-bg-base);
  color: var(--ide-text-primary);
}
.form-suffix-btn svg { width: 14px; height: 14px; }

textarea.form-input {
  min-height: 60px;
  padding: 8px 10px;
  line-height: 1.5;
  resize: vertical;
  font-family: inherit;
}
select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--ide-border);
}
.form-actions .btn-primary,
.form-actions .btn-secondary { min-width: 90px; }

.form-hint {
  font-size: 11px;
  color: var(--ide-text-tertiary);
  margin-top: 4px;
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--ide-bg-soft);
  border: 1px solid var(--ide-border);
  color: var(--ide-text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all 120ms ease;
}
.chip:hover {
  background: var(--ide-bg-base);
  border-color: var(--ide-accent-border);
  color: var(--ide-text-primary);
}
.chip.is-active {
  background: var(--ide-accent-soft);
  border-color: var(--ide-accent-border);
  color: var(--ide-accent);
}

/* ============================================
   模态框
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 200ms ease;
}
.modal-overlay.is-open { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal {
  background: var(--ide-bg-elevated);
  border: 1px solid var(--ide-border-strong);
  border-radius: 12px;
  width: 100%;
  max-width: 780px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: fadeUp 240ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--ide-border);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ide-text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}
.modal-close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--ide-text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 120ms ease;
}
.modal-close:hover {
  background: var(--ide-bg-soft);
  color: var(--ide-text-primary);
}
.modal-close svg { width: 14px; height: 14px; }

.modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.modal-side {
  width: 160px;
  background: var(--ide-bg-soft);
  border-right: 1px solid var(--ide-border);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.modal-side-item {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 5px;
  color: var(--ide-text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 120ms ease;
}
.modal-side-item:hover {
  background: var(--ide-bg-elevated);
  color: var(--ide-text-primary);
}
.modal-side-item.is-active {
  background: var(--ide-bg-elevated);
  color: var(--ide-text-primary);
  font-weight: 600;
}
.modal-side-item.is-active::before {
  content: "";
  position: absolute;
}

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

.modal-panel { display: none; }
.modal-panel.is-active { display: block; animation: fadeUp 200ms ease; }
.modal-panel h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ide-text-primary);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.modal-panel p.settings-hint,
.modal-panel .settings-hint {
  font-size: 12px;
  color: var(--ide-text-tertiary);
  margin: 0 0 16px;
}

/* ============================================
   Settings 面板 - Provider / Theme / Color
   ============================================ */
.provider-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.provider-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  background: var(--ide-bg-soft);
  border: 1px solid var(--ide-border);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: all 120ms ease;
  color: var(--ide-text-primary);
  font-family: inherit;
  position: relative;
}
.provider-card:hover {
  background: var(--ide-bg-base);
  border-color: var(--ide-border-strong);
}
.provider-card.is-active {
  background: var(--ide-accent-soft);
  border-color: var(--ide-accent-border);
}
.provider-card.is-active::before {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 10px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ide-accent);
  color: #08080c;
  font-size: 11px;
  font-weight: 700;
}
.provider-card-icon {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 2px;
}
.provider-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ide-text-primary);
}
.provider-card-desc {
  font-size: 11px;
  color: var(--ide-text-tertiary);
  line-height: 1.4;
}

.theme-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px;
  background: var(--ide-bg-soft);
  border: 1px solid var(--ide-border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--ide-text-primary);
  font-size: 12px;
  font-weight: 500;
  transition: all 120ms ease;
}
.theme-card:hover {
  background: var(--ide-bg-base);
  border-color: var(--ide-border-strong);
}
.theme-card.is-active {
  border-color: var(--ide-accent);
  background: var(--ide-accent-soft);
}
.theme-card-preview {
  height: 60px;
  border-radius: 5px;
  border: 1px solid var(--ide-border);
}
.theme-preview-dark {
  background:
    linear-gradient(180deg, #1a1a26 0%, #0b0b10 100%);
  position: relative;
}
.theme-preview-dark::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0; width: 12px;
  background: #13131c;
  border-right: 1px solid #222;
}
.theme-preview-light {
  background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
  position: relative;
}
.theme-preview-light::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0; width: 12px;
  background: #f0f0f5;
  border-right: 1px solid #ddd;
}
.theme-card span { text-align: center; }

.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c, var(--ide-accent));
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 120ms ease;
  position: relative;
  box-shadow: 0 0 0 1px var(--ide-border);
}
.color-dot:hover {
  transform: scale(1.1);
}
.color-dot.is-active {
  border-color: var(--c);
  box-shadow: 0 0 0 2px var(--ide-bg-elevated), 0 0 0 4px var(--c);
}

/* ============================================
   Shortcut list
   ============================================ */
.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--ide-text-secondary);
  transition: background 120ms ease;
}
.shortcut-row:hover { background: var(--ide-bg-soft); }
.shortcut-row kbd {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--ide-bg-soft);
  border: 1px solid var(--ide-border);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--ide-text-secondary);
}

/* ============================================
   命令面板 (cmdk)
   ============================================ */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding: 100px 20px 20px;
  animation: fadeIn 150ms ease;
}
.cmdk-overlay.is-open { display: flex; }

.cmdk {
  width: 100%;
  max-width: 580px;
  background: var(--ide-bg-elevated);
  border: 1px solid var(--ide-border-strong);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  max-height: 480px;
  overflow: hidden;
  animation: fadeUp 200ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}

.cmdk-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 50px;
  border-bottom: 1px solid var(--ide-border);
  flex-shrink: 0;
}
.cmdk-search svg {
  width: 16px;
  height: 16px;
  color: var(--ide-text-tertiary);
  flex-shrink: 0;
}
.cmdk-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ide-text-primary);
  font-size: 14px;
  font-family: inherit;
}
.cmdk-search input::placeholder { color: var(--ide-text-muted); }
.cmdk-search .esc {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--ide-bg-soft);
  border: 1px solid var(--ide-border);
  color: var(--ide-text-tertiary);
  font-family: var(--font-mono, monospace);
}

.cmdk-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.cmdk-section {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ide-text-tertiary);
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ide-text-primary);
  transition: background 80ms ease;
}
.cmdk-item:hover,
.cmdk-item.is-active {
  background: var(--ide-accent-soft);
  color: var(--ide-text-primary);
}
.cmdk-item-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
  color: var(--ide-text-secondary);
}
.cmdk-item-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.cmdk-item-shortcut {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--ide-bg-soft);
  border: 1px solid var(--ide-border);
  color: var(--ide-text-tertiary);
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
}
.cmdk-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ide-text-tertiary);
  font-size: 12px;
}

/* ============================================
   下拉 (Dropdown)
   ============================================ */
.dropdown {
  position: fixed;
  top: 50px;
  right: 10px;
  width: 240px;
  background: var(--ide-bg-elevated);
  border: 1px solid var(--ide-border-strong);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  padding: 6px;
  z-index: 150;
  display: none;
  animation: fadeUp 160ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}
.dropdown.is-open { display: block; }

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 6px;
}
.dropdown-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ide-accent), #22d3ee);
  color: #08080c;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ide-text-primary);
}
.dropdown-email {
  font-size: 11px;
  color: var(--ide-text-tertiary);
  margin-top: 1px;
}

.dropdown-divider {
  height: 1px;
  background: var(--ide-border);
  margin: 4px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--ide-text-primary);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 100ms ease;
  font-family: inherit;
}
.dropdown-item:hover { background: var(--ide-bg-soft); }
.dropdown-item svg { width: 14px; height: 14px; color: var(--ide-text-tertiary); }
.dropdown-item.dropdown-danger { color: var(--ide-danger); }
.dropdown-item.dropdown-danger:hover { background: rgba(248, 113, 113, 0.1); }

/* ============================================
   右键菜单 (Context Menu)
   ============================================ */
.context-menu {
  position: fixed;
  z-index: 250;
  min-width: 180px;
  background: var(--ide-bg-elevated);
  border: 1px solid var(--ide-border-strong);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  padding: 4px;
  display: none;
  animation: fadeUp 140ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}
.context-menu.is-open { display: block; }
.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--ide-text-primary);
  cursor: pointer;
  transition: background 80ms ease;
}
.ctx-item:hover { background: var(--ide-accent-soft); }
.ctx-item.ctx-danger { color: var(--ide-danger); }
.ctx-item.ctx-danger:hover { background: rgba(248, 113, 113, 0.12); }
.ctx-divider {
  height: 1px;
  background: var(--ide-border);
  margin: 4px 0;
}

/* ============================================
   Toast
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--ide-bg-elevated);
  border: 1px solid var(--ide-border-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ide-text-primary);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  animation: slideUp 240ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
  pointer-events: auto;
  min-width: 200px;
  max-width: 480px;
}
.toast-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.toast-success { border-color: rgba(52, 211, 153, 0.4); }
.toast-success .toast-icon { background: var(--ide-success); color: #08080c; }
.toast-error { border-color: rgba(248, 113, 113, 0.4); }
.toast-error .toast-icon { background: var(--ide-danger); color: #08080c; }
.toast-warn { border-color: rgba(251, 191, 36, 0.4); }
.toast-warn .toast-icon { background: var(--ide-warning); color: #08080c; }
.toast-info .toast-icon { background: var(--ide-accent); color: #08080c; }
.toast.is-leaving { animation: slideDown 200ms ease forwards; }
@keyframes slideDown {
  to { opacity: 0; transform: translateY(20px); }
}

/* ============================================
   拖拽覆盖层
   ============================================ */
.drop-zone {
  position: fixed;
  inset: 0;
  background: rgba(167, 139, 250, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 3px dashed var(--ide-accent);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.drop-zone.is-active { display: flex; }
.drop-zone::after {
  content: "松开鼠标导入文件";
  padding: 16px 24px;
  background: var(--ide-bg-elevated);
  border: 1px solid var(--ide-accent);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ide-text-primary);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ============================================
   欢迎页
   ============================================ */
.welcome {
  position: fixed;
  inset: 0;
  background: var(--ide-bg-base);
  z-index: 500;
  overflow-y: auto;
  display: block;
  animation: fadeIn 300ms ease;
}
.welcome.is-dismissed,
.welcome[style*="display: none"] {
  display: none !important;
  pointer-events: none !important;
}

.welcome-card {
  max-width: 980px;
  margin: 0 auto;
  padding: 60px 30px 50px;
}

.welcome-hero {
  text-align: center;
  margin-bottom: 50px;
}
.welcome-mark {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--ide-accent), #22d3ee);
  color: #08080c;
  font-weight: 800;
  font-size: 36px;
  font-family: var(--font-display, system-ui);
  box-shadow: 0 12px 48px rgba(167, 139, 250, 0.4);
}
.welcome-hero h1 {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ide-text-primary);
  margin: 0 0 8px;
}
.welcome-name {
  background: linear-gradient(135deg, var(--ide-accent), #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome-tagline {
  font-size: 15px;
  color: var(--ide-text-tertiary);
  margin: 0;
}

.welcome-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 40px;
}
.welcome-cell {
  padding: 18px 20px;
  background: var(--ide-bg-elevated);
  border: 1px solid var(--ide-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 200ms ease;
}
.welcome-cell:hover {
  border-color: var(--ide-border-strong);
  transform: translateY(-2px);
}
.welcome-cell-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: white;
}
.welcome-cell-icon svg { width: 18px; height: 18px; }
.welcome-cell h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ide-text-primary);
  margin: 0;
}
.welcome-cell p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--ide-text-tertiary);
  margin: 0;
}

.welcome-shortcuts {
  margin-bottom: 30px;
  padding: 18px 20px;
  background: var(--ide-bg-elevated);
  border: 1px solid var(--ide-border);
  border-radius: 12px;
}
.welcome-shortcuts-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ide-text-tertiary);
  margin-bottom: 10px;
}
.welcome-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 16px;
  font-size: 12px;
  color: var(--ide-text-secondary);
}
.welcome-shortcuts-grid > div {
  display: flex;
  align-items: center;
  gap: 6px;
}
.welcome-shortcuts-grid .kbd {
  font-size: 10px;
  height: 16px;
  padding: 0 4px;
}

.welcome-cta {
  text-align: center;
  margin-top: 30px;
}
.welcome-cta .btn-primary {
  height: 40px;
  padding: 0 32px;
  font-size: 14px;
  border-radius: 8px;
}

@media (max-width: 720px) {
  .welcome-card { padding: 40px 18px 30px; }
  .welcome-hero h1 { font-size: 28px; }
  .welcome-grid { grid-template-columns: 1fr; }
  .welcome-shortcuts-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   文件树
   ============================================ */
.tree-section {
  padding: 8px 0 4px;
}
.tree-section-header {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ide-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  user-select: none;
}
.tree-section-header:hover { color: var(--ide-text-secondary); }
.tree-section-header .chevron {
  display: inline-block;
  width: 12px;
  height: 12px;
  font-size: 9px;
  transition: transform 150ms ease;
  text-align: center;
  line-height: 12px;
}
.tree-section-header.is-collapsed .chevron { transform: rotate(-90deg); }

.tree-folder,
.tree-item {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding-right: 10px;
  font-size: 13px;
  color: var(--ide-text-secondary);
  cursor: pointer;
  position: relative;
  user-select: none;
  border-radius: 3px;
  margin: 1px 4px;
  transition: background 80ms ease;
}
.tree-folder:hover,
.tree-item:hover {
  background: var(--ide-bg-soft);
  color: var(--ide-text-primary);
}
.tree-item.is-active {
  background: var(--ide-accent-soft);
  color: var(--ide-text-primary);
}
.tree-item.is-active::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--ide-accent);
  border-radius: 0 2px 2px 0;
}

.tree-chevron {
  display: inline-block;
  width: 14px;
  text-align: center;
  font-size: 9px;
  color: var(--ide-text-tertiary);
  flex-shrink: 0;
  transition: transform 150ms ease;
}
.tree-chevron.is-open { transform: rotate(90deg); }
.tree-folder.is-collapsed > .tree-chevron { transform: rotate(0); }
.tree-folder.is-collapsed > .tree-children,
.tree-folder.is-collapsed .tree-children { display: none; }

.tree-icon {
  width: 16px;
  text-align: center;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}
.tree-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.tree-actions {
  display: none;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.tree-item:hover .tree-actions,
.tree-folder:hover .tree-actions { display: flex; }
.tree-modified {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ide-accent);
  display: inline-block;
  flex-shrink: 0;
}
.tree-children {
  position: relative;
  padding-left: 0;
}
.tree-file-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

/* ============================================
   Sidebar 面板 - Search / Git / Debug / Extensions
   ============================================ */
.search-empty,
.search-result-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--ide-text-muted);
  font-size: 12px;
}
.search-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.search-result {
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.search-result:hover { background: var(--ide-bg-soft); }
.search-result-file {
  color: var(--ide-text-tertiary);
  font-size: 10px;
  margin-top: 2px;
  font-family: var(--font-mono, monospace);
}

.git-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.git-actions .btn-primary,
.git-actions .btn-secondary { height: 26px; padding: 0 10px; font-size: 11px; }
.git-status {
  font-size: 12px;
  color: var(--ide-text-secondary);
}
.git-file {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.git-file:hover { background: var(--ide-bg-soft); }
.git-file-status {
  width: 14px;
  text-align: center;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  flex-shrink: 0;
}
.git-file-status.modified { color: var(--ide-warning); }
.git-file-status.added { color: var(--ide-success); }
.git-file-status.deleted { color: var(--ide-danger); }
.git-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ide-text-tertiary);
  margin: 12px 0 6px;
}
.git-commit-hash {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--ide-accent);
}
.git-commit-msg {
  font-size: 12px;
  color: var(--ide-text-primary);
  margin-top: 2px;
}

.debug-configs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.debug-config {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--ide-bg-soft);
  border: 1px solid var(--ide-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 120ms ease;
}
.debug-config:hover {
  background: var(--ide-bg-base);
  border-color: var(--ide-accent-border);
}
.debug-config-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--ide-accent-soft);
  color: var(--ide-accent);
  display: grid;
  place-items: center;
  font-size: 11px;
  flex-shrink: 0;
}
.debug-config-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ide-text-primary);
}
.debug-config-desc {
  font-size: 11px;
  color: var(--ide-text-tertiary);
  margin-top: 1px;
}
.debug-output {
  margin-top: 12px;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  padding: 8px 10px;
  background: var(--ide-bg-base);
  border-radius: 6px;
  border: 1px solid var(--ide-border);
  max-height: 200px;
  overflow: auto;
}
.debug-output-empty {
  color: var(--ide-text-tertiary);
  text-align: center;
  padding: 12px;
  font-size: 12px;
}

.ext-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  transition: background 120ms ease;
}
.ext-item:hover { background: var(--ide-bg-soft); }
.ext-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ide-accent-soft);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.ext-info {
  flex: 1;
  min-width: 0;
}
.ext-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ide-text-primary);
}
.ext-desc {
  font-size: 11px;
  color: var(--ide-text-tertiary);
  margin-top: 1px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ext-author {
  font-size: 10px;
  color: var(--ide-text-muted);
  margin-top: 2px;
}
.ext-install-btn {
  height: 24px;
  padding: 0 10px;
  border-radius: 4px;
  background: var(--ide-accent);
  color: #08080c;
  font-size: 11px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: filter 120ms ease;
  flex-shrink: 0;
}
.ext-install-btn:hover { filter: brightness(1.1); }
.ext-install-btn.is-installed {
  background: var(--ide-bg-soft);
  color: var(--ide-text-secondary);
}

/* ============================================
   Settings panel showWhen 控制
   ============================================ */
[data-show-when] { display: none; }
body[data-ai-provider="openai"] [data-show-when="not-local"],
body[data-ai-provider="anthropic"] [data-show-when="not-local"],
body[data-ai-provider="custom"] [data-show-when="not-local"] { display: flex; }
body[data-ai-provider="local"] [data-show-when="not-local"] { display: none; }

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--ide-border-strong);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   动画
   ============================================ */
[data-anim="fade-in"] { animation: fadeIn 200ms ease; }
[data-anim="fade-up"] { animation: fadeUp 200ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)); }
