/* ============================================================
   PagePen 样式 —— 浅色、清晰分栏、蓝色选中态，避免多余装饰
   ============================================================ */

:root {
  --bg: #ffffff;
  --col-bg: #fafafa;
  --border: rgba(0, 0, 0, 0.1);
  --border-light: rgba(0, 0, 0, 0.05);
  --text: #1f2328;
  --text-muted: #6b7280;
  --accent: #0066cc;
  --accent-strong: #0052a3;
  --accent-soft: rgba(0, 102, 204, 0.12);
  --danger: #d93025;
  --danger-soft: rgba(217, 48, 37, 0.1);
  --ok: #1e8e3e;
  --warn: #b06000;
  --warn-soft: rgba(176, 96, 0, 0.12);
  --hover: rgba(0, 0, 0, 0.05);
  --topbar-h: 50px;
  --col-w: 200px;
  --bottomnav-h: 56px;
  --radius: 6px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: "Droid Sans Mono", "Cascadia Mono", "SF Mono", Consolas,
    "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

#app, .auth-view { height: 100dvh; }

.app { display: flex; flex-direction: column; }

[hidden] { display: none !important; }

button { font-family: inherit; }

/* ---------------- 通用控件 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(0.5px); }
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { background: #b3261e; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
.icon-btn-sm { width: 28px; height: 28px; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn-sm svg { width: 15px; height: 15px; }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.icon-btn.dirty { color: var(--warn); }

input[type="text"], input[type="password"] {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #d0d7de;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
label { cursor: pointer; }

.form-error {
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
}

/* ---------------- 登录 / 改密 ---------------- */

.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--col-bg);
  overflow: auto;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.auth-brand h1 { font-size: 20px; margin: 0; }
.auth-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form h2 { margin: 0; font-size: 17px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted); }
.auth-notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.6;
}
.auth-hint { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.auth-hint code {
  background: var(--hover);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ---------------- 顶栏 ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar-h);
  padding: 0 10px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.brand-name { font-weight: 600; font-size: 15px; }

.logo { width: 22px; height: 22px; fill: var(--accent); }
.logo rect { fill: var(--accent); }
.logo path { stroke: #fff; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.logo-lg { width: 40px; height: 40px; }

.topbar-spacer { flex: 1; }

.file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 46vw;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: var(--col-bg);
  border: 1px solid var(--border-light);
  font-size: 13px;
}
.file-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.save-status { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.save-status.dirty { color: var(--warn); }
.save-status.saving { color: var(--accent); }
.save-status.error { color: var(--danger); }
.save-status.ok { color: var(--ok); }

/* ---------------- 主区域三栏 ---------------- */

.main { flex: 1; display: flex; min-height: 0; }

.col {
  background: var(--col-bg);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.col-files { width: var(--col-w); border-right: 1px solid var(--border-light); flex-shrink: 0; }
.col-sites { width: var(--col-w); border-right: 1px solid var(--border); flex-shrink: 0; }

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  height: 40px;
  padding: 0 6px 0 12px;
  flex-shrink: 0;
}
.col-title { font-size: 13px; font-weight: 600; color: var(--text); }
.col-actions { display: flex; gap: 2px; }
.col-empty { padding: 24px 12px; text-align: center; color: var(--text-muted); font-size: 12.5px; }

/* 面包屑 */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 0 8px 6px;
  font-size: 12px;
  flex-shrink: 0;
}
.crumb {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumb:hover { background: var(--hover); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.crumb-sep { color: rgba(0, 0, 0, 0.25); font-size: 11px; }

/* 文件列表 */
.file-list { flex: 1; padding: 0 6px 12px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 30px;
  padding: 0 8px;
  margin: 1px 0;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
}
.file-item:hover { background: var(--hover); }
.file-item.selected { background: var(--accent); color: #fff; }
.file-item.selected .file-ext { filter: brightness(1.35); }
.file-item .item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item .item-actions { display: none; gap: 2px; flex-shrink: 0; }
.file-item:hover .item-actions, .file-item.selected .item-actions { display: flex; }
.item-actions .icon-btn { width: 24px; height: 24px; }
.item-actions .icon-btn svg { width: 13px; height: 13px; }
.file-item.selected .item-actions .icon-btn { color: rgba(255, 255, 255, 0.85); }
.file-item.selected .item-actions .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.18); }

.file-ext {
  flex-shrink: 0;
  min-width: 30px;
  height: 16px;
  padding: 0 3px;
  border-radius: 3px;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  letter-spacing: 0.2px;
  font-family: var(--font-mono);
  color: #fff;
  background: #9aa0a6;
}
.file-ext.dir { background: transparent; min-width: 0; height: 18px; padding: 0; }
.file-ext.dir svg { width: 17px; height: 17px; display: block; color: var(--accent); }
.file-item.selected .file-ext.dir svg { color: #fff; }

.parent-item { color: var(--text-muted); font-size: 13px; }

/* 网站列表（第一列） */
.site-list { flex: 1; padding: 0 6px 12px; display: flex; flex-direction: column; gap: 1px; }

.site-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 4px 8px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
}
.site-item:hover { background: var(--hover); }
.site-item.selected { background: var(--accent); color: #fff; }
.site-item .icon-btn { opacity: 0; flex-shrink: 0; }
.site-item:hover .icon-btn, .site-item.selected .icon-btn { opacity: 1; }
.site-item.selected .icon-btn { color: rgba(255, 255, 255, 0.85); }
.site-item.selected .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.18); }

.site-item-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
}
.site-item-dot.on { background: var(--ok); }
.site-item.selected .site-item-dot.on { background: #7ee2a8; }

.site-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.site-item-name {
  font-size: 13.5px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-item-domain {
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-muted);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-item.selected .site-item-domain { color: rgba(255, 255, 255, 0.75); }

/* 最近打开（移动端横滑 chip 条） */
.recent-strip {
  display: none;
  gap: 6px;
  padding: 0 10px 8px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.recent-strip::-webkit-scrollbar { display: none; }
.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.recent-chip.selected { background: var(--accent); border-color: transparent; color: #fff; }

/* ---------------- 编辑器列 ---------------- */

.col-editor {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  position: relative;
}

.editor-host { flex: 1; min-height: 0; position: relative; }

.editor-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 20px;
  background: var(--bg);
  z-index: 5;
}
.editor-empty p { margin: 0; }
.editor-empty-sub { font-size: 12px; line-height: 1.8; color: rgba(0, 0, 0, 0.4); }

.external-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
  border-bottom: 1px solid rgba(176, 96, 0, 0.2);
  flex-shrink: 0;
}

/* 移动端符号辅助栏 */
.accessory-bar {
  display: none;
  gap: 4px;
  padding: 5px 8px;
  overflow-x: auto;
  background: var(--col-bg);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  scrollbar-width: none;
}
.accessory-bar::-webkit-scrollbar { display: none; }
.acc-btn {
  min-width: 38px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}
.acc-btn:active { background: var(--hover); }
.acc-toggle { margin-left: auto; }

/* ---------------- 设置菜单 ---------------- */

.settings-menu {
  position: absolute;
  top: calc(var(--topbar-h) - 4px);
  right: 8px;
  width: 264px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 60;
}
.settings-section { padding: 4px 6px 8px; border-bottom: 1px solid var(--border-light); }
.settings-section:last-child { border-bottom: none; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 4px;
  font-size: 13.5px;
}
.settings-row .settings-label { color: var(--text); }
.settings-row .settings-value { color: var(--text-muted); font-size: 12.5px; }
.settings-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.settings-item:hover { background: var(--hover); }
.settings-item.danger { color: var(--danger); }
.settings-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.settings-title { font-size: 11px; color: var(--text-muted); padding: 6px 6px 2px; letter-spacing: 0.5px; }

.font-size-group { display: flex; align-items: center; gap: 6px; }
.font-size-value { min-width: 38px; text-align: center; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }

.switch {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  border: none;
  background: #d0d7de;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); }

/* ---------------- 底部导航（移动端） ---------------- */

.bottomnav {
  display: none;
  height: var(--bottomnav-h);
  background: #fff;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  min-height: 44px;
  position: relative;
}
.bottomnav-btn svg { width: 21px; height: 21px; }
.bottomnav-btn.active { color: var(--accent); }
.bottomnav-btn .nav-dirty {
  position: absolute;
  top: 8px;
  right: calc(50% - 18px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

/* ---------------- Toast ---------------- */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 380px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #1f2328;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.18s ease-out;
  pointer-events: auto;
  word-break: break-all;
}
.toast.leaving { animation: toast-out 0.18s ease-in forwards; }
.toast svg { width: 15px; height: 15px; flex-shrink: 0; }
.toast.ok svg { color: #7ee2a8; }
.toast.error { background: #8c1d18; }
.toast.error svg { color: #ffb4ab; }
.toast.info svg { color: #9ec5ff; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------------- 模态框 ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 400;
  animation: fade-in 0.12s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(440px, 100%);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  animation: modal-in 0.15s ease-out;
  overflow: hidden;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 10px;
  font-size: 15px;
  font-weight: 600;
}
.modal-body {
  padding: 0 16px 14px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  overflow-y: auto;
  word-break: break-all;
}
.modal-body .modal-path {
  display: block;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--col-bg);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}
.modal-body input[type="text"], .modal-body input[type="password"] { margin-top: 8px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
  flex-wrap: wrap;
}
.modal-footer .btn { min-width: 76px; }

/* ---------------- 响应式：<1024px 单栏 + 底部导航 ---------------- */

@media (max-width: 1023px) {
  .col-sites, .col-files {
    width: 100%;
    border-right: none;
  }
  .bottomnav { display: flex; }
  .recent-strip { display: flex; }
  .accessory-bar.is-mobile { display: flex; }

  body[data-panel="sites"] #col-files,
  body[data-panel="sites"] #col-editor { display: none; }
  body[data-panel="files"] #col-sites,
  body[data-panel="files"] #col-editor { display: none; }
  body[data-panel="code"] #col-sites,
  body[data-panel="code"] #col-files { display: none; }

  .site-item { min-height: 48px; }
  .site-item .icon-btn { opacity: 1; width: 34px; height: 34px; }
  .site-item .icon-btn svg { width: 16px; height: 16px; }

  .file-item { height: 44px; font-size: 14.5px; }
  .file-item .item-actions { display: flex; }
  .item-actions .icon-btn { width: 34px; height: 34px; }
  .item-actions .icon-btn svg { width: 16px; height: 16px; }

  .file-chip { max-width: 52vw; }
  .toasts { left: 12px; right: 12px; bottom: calc(var(--bottomnav-h) + 12px); }
  .toast { max-width: none; }

  .settings-menu { width: min(300px, calc(100vw - 20px)); }
}

@media (min-width: 1024px) {
  #col-sites, #col-editor, #col-files { display: flex !important; }
}

/* 滚动条（桌面） */
@media (pointer: fine) {
  .col::-webkit-scrollbar, .modal-body::-webkit-scrollbar { width: 9px; }
  .col::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
  }
  .col::-webkit-scrollbar-thumb:hover { background-color: rgba(0, 0, 0, 0.32); }
}


/* 右键快捷菜单 */
.context-menu {
  position: fixed; z-index: 1000; min-width: 190px; max-width: min(280px, calc(100vw - 16px));
  padding: 6px; background: #fff; border: 1px solid rgba(0,0,0,.12); border-radius: 10px;
  box-shadow: 0 10px 32px rgba(0,0,0,.18); animation: menu-in .1s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-3px) scale(.99); } to { opacity: 1; transform: none; } }
.context-menu-item { width: 100%; min-height: 36px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.context-menu-item:hover:not(:disabled), .context-menu-item:focus-visible { background: var(--accent-soft); outline: none; }
.context-menu-item:disabled { color: #a0a4aa; cursor: not-allowed; }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: var(--danger-soft); }
.context-menu-icon { width: 17px; height: 17px; display: inline-flex; flex: 0 0 17px; }
.context-menu-icon svg { width: 17px; height: 17px; }
.context-menu-item small { margin-left: auto; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.context-menu-separator { height: 1px; margin: 5px 4px; background: var(--border-light); }

/* 所有弹窗统一内边距，避免表单控件和文字贴边 */
.modal-header { padding: 16px 20px 12px; }
.modal-body { padding: 4px 20px 18px; line-height: 1.7; }
.modal-footer { padding: 12px 20px 18px; }
.modal-body > p:first-child { margin-top: 0; }
.modal-body label { display: block; }
.modal-body input[type="text"], .modal-body input[type="password"] { margin-top: 8px; }
@media (max-width: 480px) {
  .modal-backdrop { padding: 14px; }
  .modal { border-radius: 14px; }
  .modal-header { padding: 15px 17px 10px; }
  .modal-body { padding: 4px 17px 16px; }
  .modal-footer { padding: 10px 17px 16px; }
  .context-menu { min-width: 180px; }
}

/* ---------------- 多选与批量操作 ---------------- */

.multi-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 8px 6px;
  padding: 8px;
  border-radius: 8px;
  background: var(--accent-soft);
  flex-shrink: 0;
}
.multi-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.multi-count { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.multi-exit {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
}
.multi-exit:hover { background: var(--hover); color: var(--text); }
.multi-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.multi-actions .btn { height: 28px; padding: 0 4px; font-size: 12.5px; min-width: 0; }
.multi-actions .btn:disabled { opacity: .45; cursor: default; }

.multi-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(0, 0, 0, 0.28);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #fff;
}
.multi-check.on { background: var(--accent); border-color: var(--accent); }
.multi-check svg { width: 11px; height: 11px; }

.file-item.picked { background: var(--accent-soft); }
.file-item.picked:hover { background: rgba(0, 102, 204, 0.18); }
.file-item.in-multi { cursor: pointer; }

/* ---------------- 目标目录选择器 ---------------- */

.modal.modal-wide { width: min(520px, 100%); }
.modal-hint {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  word-break: break-all;
}
.dir-picker-path { margin-top: 0; }
.dir-picker {
  margin-top: 10px;
  max-height: min(46vh, 320px);
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 4px;
  background: #fff;
}
.dir-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.dir-picker-item:hover:not(:disabled) { background: var(--hover); }
.dir-picker-item.is-blocked { color: #a0a4aa; cursor: not-allowed; }
.dir-picker-item small { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.dir-picker-icon { display: inline-flex; width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; }
.dir-picker-icon svg { width: 17px; height: 17px; }
.dir-picker-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 批量操作结果列表 */
.result-list {
  margin: 10px 0 0;
  padding: 8px 8px 8px 24px;
  max-height: min(38vh, 260px);
  overflow-y: auto;
  background: var(--col-bg);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.7;
  word-break: break-all;
}
.result-list li { margin: 2px 0; }

/* 菜单超高时可滚动，避免超出视口 */
.context-menu { overflow-y: auto; overscroll-behavior: contain; }

@media (max-width: 480px) {
  .multi-bar { margin: 0 6px 6px; }
  .multi-actions .btn { height: 32px; padding: 0 8px; }
  .dir-picker { max-height: 40vh; }
  .dir-picker-item { min-height: 44px; }
}

@media (max-width: 1023px) {
  /* 触摸场景：菜单项高度 42px，便于点按；保留右侧说明文字（如目录链接需 index.html） */
  .context-menu-item { min-height: 42px; padding: 10px; }
  .context-menu small { font-size: 10.5px; }
}
