/* ========== 左侧边栏 ========== */
.side-panel {
  position: fixed;
  left: 0;
  top: 56px;
  bottom: 0;
  width: 260px;
  background: #141428;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 50;
  transition: transform 300ms ease;
  overflow: hidden;
}

.panel-header {
  display: none;
  text-align: right;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.panel-close {
  font-size: 22px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}
.panel-close:hover {
  color: #fff;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.panel-tab {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.panel-tab:hover {
  color: rgba(255, 255, 255, 0.7);
}
.panel-tab.active {
  color: #fff;
  border-bottom-color: #2563eb;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 10px;
  display: none;
}
.panel-content::-webkit-scrollbar {
  display: none;
}
.panel-content.active {
  display: block;
}

.panel-action-btn {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 8px;
  color: #60a5fa;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}
.panel-action-btn:hover {
  background: rgba(37, 99, 235, 0.25);
}

/* 会话列表 */
.session-item {
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.15s;
}
.session-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.session-item.active {
  background: rgba(37, 99, 235, 0.1);
}
.session-item-title {
  font-size: 14px;
  color: #e0e0e0;
  margin-bottom: 4px;
}
.session-item-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
}

/* 笔记上下文 */
.notes-item {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
}

/* 历史记录列表 */
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  cursor: default;
  transition: background 0.15s;
}
.history-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.history-role {
  flex-shrink: 0;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  color: #fff;
  min-width: 28px;
  text-align: center;
}
.hr-user {
  background: #2563eb;
}
.hr-ai {
  background: #475569;
}
.history-preview {
  flex: 1;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-time {
  flex-shrink: 0;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.2);
}

/* 空状态 */
.empty-hint {
  text-align: center;
  color: rgba(255, 255, 255, 0.25);
  font-size: 13px;
  padding: 24px;
}

/* 设置 */
.setting-group {
  margin-bottom: 20px;
}
.setting-label {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 8px;
}
.setting-select {
  width: 100%;
  padding: 10px 12px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
}
.setting-select:focus {
  border-color: #2563eb;
}
.setting-info {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
  line-height: 1.8;
}

/* ========== Step 5-1 记忆目录树 ========== */

/* --- 树容器 --- */
.doc-tree {
  font-size: 13px;
  user-select: none;
}

.doc-tree-loading {
  color: rgba(255, 255, 255, 0.4);
  padding: 16px;
  text-align: center;
  font-size: 13px;
}

.doc-tree-error,
.doc-tree-empty {
  color: rgba(255, 255, 255, 0.4);
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
}

/* --- 文件夹 --- */
.doc-tree-folder {
  margin-bottom: 2px;
}

.doc-tree-folder-label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  color: rgba(255, 255, 255, 0.8);
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.doc-tree-folder-label:hover {
  background: rgba(255, 255, 255, 0.06);
}

.doc-tree-arrow {
  font-size: 10px;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.3);
  transition: transform 0.15s;
}

.doc-tree-children {
  padding-left: 20px;
}

/* --- 文件 --- */
.doc-tree-file {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px 5px 22px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.doc-tree-file:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
}

.doc-tree-file:active {
  background: rgba(255, 255, 255, 0.1);
}

/* --- 图标 --- */
.doc-tree-icon {
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1;
}

.doc-tree-name {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- 系统文件特殊样式 --- */
.doc-tree-system .doc-tree-name {
  color: #60a5fa;
}

.doc-tree-system.doc-tree-file .doc-tree-name::before {
  content: "🔒 ";
  font-size: 12px;
}

/* --- 拖拽相关 --- */
.doc-tree-dragging {
  opacity: 0.35;
  transition: opacity 0.15s;
}

.doc-tree-drop-target {
  background: rgba(76, 175, 80, 0.12) !important;
  border: 2px dashed #4caf50 !important;
  border-radius: 6px !important;
}

.doc-tree-content.doc-tree-drop-target {
  background: rgba(76, 175, 80, 0.06);
  border: 2px dashed #4caf50;
  border-radius: 8px;
  min-height: 40px;
}

/* --- 工具栏 --- */
.doc-tree-toolbar {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
}
.doc-tree-toolbar-btn {
  flex: 1;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  transition: background 0.15s;
  line-height: 1.4;
}
.doc-tree-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.doc-tree-toolbar-btn-right {
  margin-left: 0;
}
/* 密码箱同步风格按钮栏 */
.securebox-sync-bar {
  padding: 8px 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
}
.securebox-sync-btn {
  width: 100%;
  text-align: center;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #4ade80;
  transition:
    background 0.15s,
    opacity 0.15s;
  line-height: 1.4;
}
.securebox-sync-btn:hover {
  background: rgba(34, 197, 94, 0.25);
  color: #86efac;
}
.securebox-sync-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
[data-theme="light"] .securebox-sync-bar {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .securebox-sync-btn {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.25);
  color: #16a34a;
}
[data-theme="light"] .securebox-sync-btn:hover {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}
.doc-tree-content {
  padding: 0;
}

/* --- #doc-tree flex 撑满布局 + 根目录感应框 --- */
#doc-tree {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.doc-tree-content {
  flex: 1;
  min-height: 0;
}

/* --- 底部操作栏（+ 新建文件夹 / 上传文件 / 新建文件） --- */
.doc-tree-bottombar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 28px;
  padding: 6px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 2px;
}
.doc-tree-add-folder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 300;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.15s;
  line-height: 1;
  user-select: none;
  position: relative;
}
.doc-tree-add-folder:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}
/* 按钮之间的分隔线 */
.doc-tree-add-folder + .doc-tree-add-folder {
  margin-left: 0;
}
/* 子文件夹底部按钮栏：与根目录 bottombar 风格一致，间距28px = 一个按钮宽度 */
.doc-tree-btn-bar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 6px 8px;
}
.doc-tree-trash-btn {
  font-size: 15px;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.15s;
  line-height: 1;
}
.doc-tree-trash-btn:hover {
  opacity: 0.9;
}

/* --- 整理/恢复按钮 --- */
.doc-tree-arrange-btn {
  font-size: 12px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
  line-height: 1;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.6);
  user-select: none;
}
.doc-tree-arrange-btn:hover {
  opacity: 0.9;
  color: #fff;
}

/* --- 文件夹内 + 新建文档按钮 --- */
.doc-tree-add-file {
  padding: 3px 8px 3px 24px;
  font-size: 16px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: color 0.15s;
  line-height: 1.4;
  user-select: none;
}
.doc-tree-add-file:hover {
  color: rgba(255, 255, 255, 0.8);
}

/* --- [sort] 排序按钮 --- */
/* 默认隐藏，整理模式下悬停该项才显示 */
.doc-tree-sort-overlay {
  display: none;
  flex-shrink: 0;
  margin-left: auto;
  flex-direction: row-reverse;
  align-items: center;
  gap: 3px;
  padding-left: 6px;
}
.doc-tree-sort-btn {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  font-family: "Segoe UI Symbol", "Arial Unicode MS", "Microsoft YaHei", sans-serif;
}
.doc-tree-sort-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}
/* 整理模式：鼠标悬停时显示排序按钮 */
.doc-tree-arrange-mode .doc-tree-sort-overlay {
  display: none !important;
}
.doc-tree-arrange-mode .doc-tree-folder-label:hover .doc-tree-sort-overlay,
.doc-tree-arrange-mode .doc-tree-file:hover .doc-tree-sort-overlay {
  display: flex !important;
}

/* --- 对话框（新建/重命名） --- */
.doc-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.doc-dialog {
  background: #1e1e32;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.doc-dialog-header {
  padding: 16px 20px 0;
  font-size: 16px;
  font-weight: 600;
  color: #e0e0e0;
}
.doc-dialog-body {
  padding: 16px 20px;
}
.doc-dialog-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.doc-dialog-input:focus {
  border-color: #60a5fa;
}

/* --- 行内重命名输入框（右键触发） --- */
.doc-tree-rename-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #60a5fa;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 13px;
  padding: 1px 6px;
  width: 100%;
  min-width: 60px;
  outline: none;
  box-sizing: border-box;
}

/* --- 右键上下文菜单 --- */
.doc-tree-context-menu {
  position: fixed;
  background: #1e1e3a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 150px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  user-select: none;
}

.doc-tree-context-item {
  padding: 8px 16px;
  font-size: 13px;
  color: #e0e0e0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.doc-tree-context-item:hover {
  background: rgba(96, 165, 250, 0.15);
}

.doc-tree-context-item:active {
  background: rgba(96, 165, 250, 0.25);
}

.doc-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 20px 16px;
}
.doc-dialog-btn {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.doc-dialog-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}
.doc-dialog-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
}
.doc-dialog-confirm {
  background: #2563eb;
  color: #fff;
}
.doc-dialog-confirm:hover {
  background: #1d4ed8;
}

/* --- 面板底部回收站（位于 side-panel 最下方） --- */
.doc-tree-trash-section {
  display: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  max-height: 300px;
  overflow-y: auto;
  background: #141428;
  flex-shrink: 0;
}
.doc-tree-trash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  background: #141428;
  z-index: 1;
}
.doc-tree-trash-header .doc-tree-trash-close {
  background: none;
  border: none;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.doc-tree-trash-header .doc-tree-trash-close:hover {
  color: #fff;
}
/* 内嵌回收站中列表项使用紧凑间距 */
.doc-tree-trash-section .doc-trash-list {
  padding: 4px 0;
  max-height: none;
  overflow-y: visible;
}
.doc-tree-trash-section .doc-trash-item {
  padding: 6px 12px;
}
.doc-tree-trash-section .doc-trash-loading,
.doc-tree-trash-section .doc-trash-empty {
  padding: 16px 12px;
  font-size: 13px;
}

/* --- 面板底部操作栏（位于 side-panel 最下方，固定在页面底部） --- */
.doc-tree-panel-bottom-bar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #141428;
  flex-shrink: 0;
}
.doc-tree-panel-bottom-bar .doc-tree-trash-btn {
  flex: 1;
  text-align: center;
  font-size: 16px;
}
.doc-tree-panel-bottom-bar .doc-tree-arrange-btn {
  flex: 1;
  text-align: center;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
  line-height: 1;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.6);
  user-select: none;
}
.doc-tree-panel-bottom-bar .doc-tree-arrange-btn:hover {
  opacity: 0.9;
  color: #fff;
}
.doc-tree-trash-section .doc-trash-empty-folder {
  padding: 4px 12px 4px 32px;
  font-size: 11px;
}
.doc-tree-trash-section .doc-trash-item-name {
  font-size: 13px;
  min-width: 60px;
}
.doc-tree-trash-section .doc-trash-item-path {
  font-size: 11px;
}
.doc-tree-trash-section .doc-trash-restore-btn,
.doc-tree-trash-section .doc-trash-restore-all-btn {
  padding: 2px 8px;
  font-size: 11px;
}
.doc-tree-trash-section .doc-trash-item-icon {
  font-size: 12px;
}
.doc-tree-trash-section .doc-trash-tree-toggle {
  font-size: 9px;
  width: 14px;
}

/* --- 回收站面板 --- */
.doc-trash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.doc-trash-panel {
  background: #1e1e32;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  width: 520px;
  max-width: 90vw;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.doc-trash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #e0e0e0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.doc-trash-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: normal;
}
.doc-trash-close {
  background: none;
  border: none;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 0 4px;
}
.doc-trash-close:hover {
  color: #fff;
}
.doc-trash-list {
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
}
.doc-trash-loading,
.doc-trash-empty {
  text-align: center;
  padding: 32px 16px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
}
.doc-trash-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s;
}
.doc-trash-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.doc-trash-item-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.doc-trash-item-name {
  font-size: 14px;
  color: #e0e0e0;
  min-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-trash-item-path {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-trash-item-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}
.doc-trash-restore-btn {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #60a5fa;
  transition: background 0.15s;
  flex-shrink: 0;
}
.doc-trash-restore-btn:hover {
  background: rgba(37, 99, 235, 0.25);
}

/* --- 回收站层级树 --- */
.doc-trash-tree-toggle {
  font-size: 10px;
  width: 16px;
  text-align: center;
  cursor: pointer;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.4);
  transition:
    transform 0.15s,
    color 0.15s;
  user-select: none;
}
.doc-trash-tree-toggle:hover {
  color: rgba(255, 255, 255, 0.8);
}
.doc-trash-tree-toggle.expanded {
  transform: rotate(90deg);
}
.doc-trash-tree-children {
  overflow: hidden;
}
.doc-trash-item.dir-row {
  cursor: pointer;
}
.doc-trash-item.dir-row:hover {
  background: rgba(255, 255, 255, 0.06);
}
.doc-trash-restore-all-btn {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #34d399;
  transition: background 0.15s;
  flex-shrink: 0;
  margin-left: 4px;
}
.doc-trash-restore-all-btn:hover {
  background: rgba(16, 185, 129, 0.25);
}
.doc-trash-empty-folder {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.25);
  padding: 6px 20px 6px 44px;
  font-style: italic;
}
[data-theme="light"] .doc-trash-tree-toggle {
  color: rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .doc-trash-tree-toggle:hover {
  color: rgba(0, 0, 0, 0.6);
}
[data-theme="light"] .doc-trash-item.dir-row:hover {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .doc-trash-restore-all-btn {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
}
[data-theme="light"] .doc-trash-restore-all-btn:hover {
  background: rgba(16, 185, 129, 0.15);
}
[data-theme="light"] .doc-trash-empty-folder {
  color: rgba(0, 0, 0, 0.25);
}

/* --- 亮色主题 --- */
[data-theme="light"] .doc-tree-folder-label {
  color: rgba(0, 0, 0, 0.8);
}
[data-theme="light"] .doc-tree-folder-label:hover {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .doc-tree-arrow {
  color: rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .doc-tree-file {
  color: rgba(0, 0, 0, 0.55);
}
[data-theme="light"] .doc-tree-file:hover {
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.8);
}
[data-theme="light"] .doc-tree-system .doc-tree-name {
  color: #2563eb;
}
[data-theme="light"] .doc-tree-loading,
[data-theme="light"] .doc-tree-error,
[data-theme="light"] .doc-tree-empty {
  color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .doc-tree-drop-target {
  background: rgba(76, 175, 80, 0.15) !important;
  border-color: #43a047 !important;
}
[data-theme="light"] .doc-tree-content.doc-tree-drop-target {
  background: rgba(76, 175, 80, 0.08);
  border-color: #43a047;
}
[data-theme="light"] .doc-preview-header {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.15);
}
[data-theme="light"] .doc-preview-title {
  color: #2563eb;
}
[data-theme="light"] .doc-preview-close {
  color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .doc-preview-close:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .doc-preview-content {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.8);
}
[data-theme="light"] .doc-preview-content h1,
[data-theme="light"] .doc-preview-content h2,
[data-theme="light"] .doc-preview-content h3,
[data-theme="light"] .doc-preview-content h4 {
  color: #1a1a2e;
}
[data-theme="light"] .doc-preview-content blockquote {
  color: rgba(0, 0, 0, 0.5);
}
[data-theme="light"] .doc-preview-content th,
[data-theme="light"] .doc-preview-content td {
  border-color: rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .doc-preview-content th {
  background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .doc-tree-toolbar {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .doc-tree-toolbar-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.6);
}
[data-theme="light"] .doc-tree-toolbar-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.8);
}
[data-theme="light"] .doc-tree-panel-bottom-bar {
  background: #f5f5f7;
  border-top-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .doc-tree-bottombar {
  border-top-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .doc-tree-panel-bottom-bar .doc-tree-arrange-btn {
  border-color: rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.55);
}
[data-theme="light"] .doc-tree-panel-bottom-bar .doc-tree-arrange-btn:hover {
  color: rgba(0, 0, 0, 0.85);
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .doc-tree-add-folder {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .doc-tree-add-folder:hover {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.8);
  border-color: rgba(0, 0, 0, 0.2);
}
[data-theme="light"] .doc-tree-trash-btn {
  opacity: 0.35;
}
[data-theme="light"] .doc-tree-trash-btn:hover {
  opacity: 0.8;
}
[data-theme="light"] .doc-tree-add-file {
  color: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .doc-tree-add-file:hover {
  color: rgba(0, 0, 0, 0.7);
}
[data-theme="light"] .doc-dialog {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .doc-dialog-header {
  color: rgba(0, 0, 0, 0.85);
}
[data-theme="light"] .doc-dialog-input {
  background: #f5f5f5;
  border-color: rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.85);
}
[data-theme="light"] .doc-dialog-cancel {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.6);
}
[data-theme="light"] .doc-dialog-cancel:hover {
  background: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .doc-trash-panel {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .doc-trash-header {
  color: rgba(0, 0, 0, 0.85);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .doc-trash-hint {
  color: rgba(0, 0, 0, 0.35);
}
[data-theme="light"] .doc-trash-close {
  color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .doc-trash-close:hover {
  color: #000;
}
[data-theme="light"] .doc-trash-loading,
[data-theme="light"] .doc-trash-empty {
  color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .doc-trash-item {
  border-bottom-color: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .doc-trash-item:hover {
  background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .doc-trash-item-name {
  color: rgba(0, 0, 0, 0.8);
}
[data-theme="light"] .doc-trash-item-path {
  color: rgba(0, 0, 0, 0.35);
}
[data-theme="light"] .doc-trash-item-time {
  color: rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .doc-trash-restore-btn {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.2);
  color: #2563eb;
}
[data-theme="light"] .doc-trash-restore-btn:hover {
  background: rgba(37, 99, 235, 0.15);
}
[data-theme="light"] .doc-tree-trash-section {
  background: #fff;
  border-top-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .doc-tree-trash-header {
  background: #fff;
  color: rgba(0, 0, 0, 0.85);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .doc-tree-trash-header .doc-tree-trash-close {
  color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .doc-tree-trash-header .doc-tree-trash-close:hover {
  color: #000;
}

/* --- 移动端适配 --- */
@media (max-width: 768px) {
  .doc-tree {
    font-size: 14px;
  }
  .doc-tree-folder-label {
    padding: 8px 6px;
  }
  .doc-tree-file {
    padding: 7px 6px 7px 20px;
  }
  .doc-tree-children {
    padding-left: 16px;
  }
  .doc-preview-header {
    padding: 6px 10px;
  }
  .doc-preview-content {
    padding: 12px;
    font-size: 13px;
    max-height: 50vh;
  }
}

/* --- 文件仓库文件样式 --- */
.doc-tree-warehouse-file {
  cursor: pointer;
}
.doc-tree-warehouse-file:hover {
  background: rgba(255, 255, 255, 0.06);
}
.doc-tree-warehouse-file .doc-tree-name {
  margin-right: 4px;
}
/* 文件仓库上传按钮 */
.doc-tree-warehouse-upload {
  padding: 3px 8px 3px 24px;
  font-size: 15px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.25);
  user-select: none;
}
.doc-tree-warehouse-upload:hover {
  color: rgba(255, 255, 255, 0.8);
}

/* 亮色主题适配 */
[data-theme="light"] .doc-tree-file-meta {
  color: rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .doc-tree-warehouse-upload {
  color: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .doc-tree-warehouse-upload:hover {
  color: rgba(0, 0, 0, 0.7);
}

/* ============================================================
   保险箱（秘密文件夹）样式
   ============================================================ */

/* 目录树工具栏中的保险箱按钮状态 */
.doc-tree-toolbar-btn[data-action="toggle-vault"] {
  transition:
    background 0.2s,
    color 0.2s;
}
.doc-tree-toolbar-btn[data-action="toggle-vault"]:hover {
  background: rgba(139, 92, 246, 0.3) !important;
}

/* 目录树工具栏中的密码箱按钮状态 */
.doc-tree-toolbar-btn[data-action="toggle-securebox"]:hover {
  background: rgba(34, 197, 94, 0.3) !important;
  color: #22c55e;
}
/* 保险箱弹窗 */
.vault-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.vault-dialog {
  background: #1e293b;
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 12px;
  padding: 24px;
  max-width: 380px;
  width: 90%;
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.vault-dialog-wide {
  max-width: 600px;
}

.vault-dialog h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.vault-dialog-input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #0f172a;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.vault-dialog-input:focus {
  border-color: #8b5cf6;
}

/* ============================================================
   右键上下文菜单（doc-tree-context-menu）
   ============================================================ */

.doc-tree-context-menu {
  position: fixed;
  z-index: 99999;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 180px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  user-select: none;
}

.doc-tree-context-menu .menu-item {
  padding: 8px 16px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.doc-tree-context-menu .menu-item:hover {
  background: rgba(139, 92, 246, 0.25);
  color: #fff;
}

.doc-tree-context-menu .menu-item.danger {
  color: #ef4444;
}

.doc-tree-context-menu .menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.doc-tree-context-menu .menu-divider {
  height: 1px;
  margin: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
}

/* 域选择对话框样式（复用 vault-dialog-overlay / vault-dialog） */

.domain-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.domain-option {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  box-sizing: border-box;
}

.domain-option:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
  color: #fff;
}

/* Light theme */
[data-theme="light"] .doc-tree-context-menu {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .doc-tree-context-menu .menu-item {
  color: rgba(0, 0, 0, 0.8);
}

[data-theme="light"] .doc-tree-context-menu .menu-item:hover {
  background: rgba(99, 102, 241, 0.1);
  color: #000;
}

[data-theme="light"] .doc-tree-context-menu .menu-item.danger {
  color: #dc2626;
}

[data-theme="light"] .doc-tree-context-menu .menu-item.danger:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

[data-theme="light"] .doc-tree-context-menu .menu-divider {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .domain-option {
  background: #f1f5f9;
  border-color: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.8);
}

[data-theme="light"] .domain-option:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #000;
}
.vault-dialog-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.vault-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.vault-dialog-actions .btn-secondary,
.vault-dialog-actions .btn-primary {
  width: auto;
  padding: 8px 20px;
  margin-top: 0;
  font-size: 0.9rem;
}
