* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #222;
  background: #ece9d8;
}
a { color: #0645ad; text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #999;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

/* 顶栏 */
.top-header {
  background: linear-gradient(#5b7db8, #3f6299);
  color: #fff;
  padding: 0;
}
.top-header-sub { padding-bottom: 0; }
.header-row-main {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.header-left {
  grid-column: 1;
  justify-self: start;
  min-width: 0;
}
.header-right {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.header-label { font-size: 13px; opacity: 0.9; }
.header-center {
  grid-column: 2;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.site-title {
  margin: 0;
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  white-space: nowrap;
}
.quick-login {
  display: flex;
  align-items: center;
  gap: 0;
  width: min(320px, 86vw);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  padding: 3px 3px 3px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.quick-login-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: #222;
  padding: 6px 8px 6px 0;
  letter-spacing: 0.12em;
}
.quick-login-input::placeholder {
  color: #9aa3b2;
  letter-spacing: 0;
}
.quick-login-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  background: linear-gradient(#5b7db8, #3f6299);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
}
.quick-login-btn:hover { background: linear-gradient(#6a8bc4, #4a71ab); }
.user-info {
  font-size: 13px;
  white-space: nowrap;
  opacity: 0.95;
}
.logout-form { margin: 0; display: inline; }
.header-link {
  color: #fff;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 6px;
}
.header-link:hover { background: rgba(255,255,255,0.15); text-decoration: none; }
.manage-btn {
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.18);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
}
.manage-btn-outline {
  background: transparent;
  font-size: 12px;
  padding: 6px 10px;
}
.manage-btn-danger {
  background: rgba(180, 40, 40, 0.85);
  border-color: rgba(255, 200, 200, 0.7);
  font-size: 12px;
  padding: 6px 10px;
}
.manage-btn-danger:hover { background: rgba(200, 50, 50, 1); }
.session-badge {
  color: #ffe08a;
  font-weight: bold;
}
.manage-btn:hover { background: rgba(255,255,255,0.32); }

.header-tools {
  background: rgba(0,0,0,0.12);
  border-top: 1px solid rgba(255,255,255,0.2);
  padding: 10px 16px 12px;
}
.tool-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.tool-btn {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.14);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.tool-btn:hover, .tool-btn.active {
  background: rgba(255,255,255,0.3);
}

/* 目录列表下方工具栏 */
.dir-toolbar {
  border-top: 1px solid #d8dee8;
  background: #f5f8fc;
  padding: 10px 12px 12px;
}
.dir-toolbar-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.dir-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid #b8c8dc;
  background: #fff;
  color: #333;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.dir-tool-btn:hover, .dir-tool-btn.active {
  background: #e8f0fa;
  border-color: #5b7db8;
  color: #3f6299;
}
.dir-tool-icon { font-size: 16px; }
.dir-tool-label { font-size: 13px; }

/* 底部工具弹窗 */
.tool-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.tool-modal-overlay[hidden] { display: none; }
.tool-modal-box {
  background: #fff;
  border-radius: 10px;
  width: min(520px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
}
.tool-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.tool-modal-title { font-size: 16px; font-weight: bold; color: #333; }
.tool-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #888;
  cursor: pointer;
  line-height: 1;
  padding: 0 0 0 12px;
}
.tool-modal-close:hover { color: #333; }
.tool-modal-body {
  padding: 16px;
  overflow-y: auto;
}
.tool-modal-body .tool-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  max-width: none;
}
.tool-panel {
  background: #fff;
  color: #222;
  border-radius: 8px;
  padding: 12px 14px;
  max-width: 520px;
  margin: 0 auto;
}
.tool-panel[hidden] { display: none !important; }
.tool-panel .btn-primary { width: auto; min-width: 120px; }
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.form-actions .btn-primary,
.form-actions .btn-secondary {
  margin-top: 0;
  flex: 1;
  min-width: 0;
}
.upload-hint {
  margin: 4px 0 8px;
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}
.upload-file-list {
  margin: 0 0 8px;
  padding: 8px 10px;
  background: #f5f8fc;
  border: 1px solid #d8e0ea;
  border-radius: 6px;
  font-size: 12px;
  color: #333;
  max-height: 140px;
  overflow: auto;
}
.upload-file-list .upload-file-count {
  font-weight: bold;
  color: #3f6299;
  margin-bottom: 4px;
}
.upload-file-list ul {
  margin: 0;
  padding-left: 18px;
}
.upload-file-list li {
  margin: 2px 0;
  word-break: break-all;
}
.upload-progress-wrap {
  margin: 0 0 10px;
}
.upload-progress-bar {
  height: 10px;
  background: #e4ebf3;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #d0dae6;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4a7ab5, #3f6299);
  border-radius: 999px;
  transition: width 0.15s ease-out;
}
.upload-progress-text {
  margin: 6px 0 0;
  font-size: 12px;
  color: #3f6299;
  line-height: 1.4;
}
.tool-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #999;
  font: inherit;
  border-radius: 4px;
  margin-bottom: 6px;
  resize: vertical;
}

/* 主内容 */
.main-content {
  flex: 1;
  min-width: 0;
  padding-bottom: 16px;
}
.path-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #f7f7f7;
  border-bottom: 1px solid #ddd;
  font-size: 13px;
}
.path-bar-main {
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.path-download-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  color: #3f6299;
  text-decoration: none;
  font-size: 12px;
  border: 1px solid #c5d4e8;
  background: #fff;
}
.path-download-btn:hover {
  background: #e8f0fa;
  text-decoration: none;
  color: #2a4f8a;
}
@media (max-width: 520px) {
  .path-download-btn span { display: none; }
}

.dir-list { padding: 0; }
.dir-row {
  border-bottom: 1px solid #e8e8e8;
}
.dir-row.up-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: inherit;
}
.dir-row.up-row .name { font-size: 14px; flex: 1; }
.dir-row.up-row:hover {
  background: #eef3fb;
  text-decoration: none;
}

/* 列表行：图标 | 名称 | 大小 | 分享+下载 */
.entry-row {
  display: grid;
  grid-template-columns: 30px 42px minmax(0, 1fr) auto 84px;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 12px;
  min-height: 44px;
}
.entry-row:hover { background: #fafbfd; }
.dir-list.can-sort .entry-row {
  grid-template-columns: 30px 22px 42px minmax(0, 1fr) auto 84px;
}
.dir-list.root-list .entry-row {
  grid-template-columns: 30px 42px minmax(0, 1fr) auto;
}
.dir-list.root-list.can-sort .entry-row {
  grid-template-columns: 30px 22px 42px minmax(0, 1fr) auto;
}
.entry-drag-handle {
  cursor: grab;
  color: #b0b8c4;
  font-size: 16px;
  line-height: 1;
  user-select: none;
  text-align: center;
  touch-action: none;
}
.entry-drag-handle:active { cursor: grabbing; color: #5b7db8; }
.entry-row-sortable.dragging { opacity: 0.45; }
.entry-row-sortable.drag-over { background: #e8f0fa; box-shadow: inset 0 0 0 1px #5b7db8; }
.entry-icon-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.entry-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  position: relative;
}
.entry-icon-btn:hover { background: #e8f0fa; }
.entry-icon-static {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
}
.icon.folder { font-size: 20px; line-height: 1; }
.icon.file { font-size: 18px; line-height: 1; opacity: 0.85; }
.icon.link { font-size: 18px; line-height: 1; }
.icon.notepad { font-size: 18px; line-height: 1; }
.icon.up { color: #2a7; font-weight: bold; font-size: 16px; }
.lock-on-icon {
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 10px;
  line-height: 1;
}
.entry-name {
  color: #222;
  word-break: break-all;
  font-size: 14px;
  min-width: 0;
  flex-shrink: 0;
}
.entry-name-cell {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}
.entry-remark-inline {
  font-size: 12px;
  color: #3a7ec8;
  line-height: 1.4;
  word-break: break-all;
  flex: 1;
  min-width: 0;
}
.entry-direct-line {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  min-width: 0;
}
.entry-direct-label {
  flex-shrink: 0;
  font-size: 11px;
  color: #fff;
  background: #3f6299;
  border-radius: 3px;
  padding: 0 5px;
  line-height: 18px;
}
.entry-direct-url {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: #1a5fb4;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-direct-url:hover { text-decoration: underline; }
.entry-direct-copy {
  flex-shrink: 0;
  border: 1px solid #c5d4e8;
  background: #fff;
  color: #3f6299;
  border-radius: 4px;
  font-size: 11px;
  padding: 1px 8px;
  cursor: pointer;
  line-height: 18px;
}
.entry-direct-copy:hover { background: #e8f0fa; }
.entry-direct-copy.copied,
.direct-btn.copied { color: #1a7f37; border-color: #8fd19e; background: #e8f8ee; }
.direct-btn { color: #1a7f37; }
.direct-btn:hover { background: #e8f8ee; color: #146c2e; }
a.entry-name:hover { color: #0645ad; text-decoration: none; }
.entry-name-preview { color: #0645ad; cursor: pointer; }
.entry-name-preview:hover { text-decoration: underline; }
.entry-name-text { color: #222; word-break: break-all; }
.entry-size {
  color: #888;
  font-size: 12px;
  white-space: nowrap;
  padding-right: 4px;
}
.entry-url-hint {
  max-width: 28vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
}
.entry-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}
.share-btn,
.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: #3f6299;
  border-radius: 6px;
  text-decoration: none;
  font-size: 18px;
  font-weight: bold;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.share-btn:hover,
.download-btn:hover {
  background: #e8f0fa;
  text-decoration: none;
  color: #2a4f8a;
}
.share-btn.copied {
  color: #1a7f37;
  background: #e8f8ee;
}
.download-icon,
.share-icon { display: block; }
.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(34, 48, 68, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: 90vw;
  text-align: center;
}
.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.menu-panel-title {
  margin: 0 0 8px;
  font-size: 12px;
  color: #666;
}
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.icon-pick-btn {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
.icon-pick-btn:hover { background: #eef3fb; border-color: #5b7db8; }
.icon-pick-btn.active {
  background: #dce6f3;
  border-color: #3f6299;
  box-shadow: inset 0 0 0 1px #3f6299;
}
.menu-panel-edit { min-width: 240px; }
.menu-panel-icon { min-width: 200px; }
.menu-edit-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.menu-hint {
  font-size: 12px;
  color: #888;
  margin: 2px 0 0;
}
.menu-panel-lock { min-width: 220px; }
.menu-lock-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.menu-lock-label {
  font-size: 12px;
  color: #555;
  margin-top: 2px;
}
.menu-lock-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #aaa;
  font-size: 13px;
  border-radius: 4px;
}
.menu-lock-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #444;
  cursor: pointer;
  margin: 2px 0;
}
.menu-lock-check input { width: auto; margin: 0; }

/* 点击图标弹出的操作菜单 */
.entry-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 120;
  min-width: 148px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 4px 0;
}
.entry-menu[hidden] { display: none !important; }
.menu-form { margin: 0; }
.menu-item {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: #222;
  cursor: pointer;
}
.menu-item:hover { background: #f0f4fa; }
.menu-item.menu-danger { color: #c00; }
.menu-item.menu-danger:hover { background: #fff0f0; }
.menu-section { position: relative; border-bottom: 1px solid #eee; }
.menu-section:last-child { border-bottom: none; }
.menu-item-sub { display: flex; align-items: center; justify-content: space-between; }
.menu-arrow { color: #999; font-size: 16px; }
.menu-sub {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 100px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 4px 0;
}
.menu-section-sub:hover .menu-sub { display: block; }
.menu-sub-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.menu-sub-item:hover:not(:disabled) { background: #f0f4fa; }
.menu-sub-item:disabled { color: #bbb; cursor: not-allowed; }
.menu-panel {
  padding: 8px 10px;
  background: #f8fafc;
  border-top: 1px dashed #ddd;
}
.menu-panel[hidden] { display: none !important; }
.menu-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
}
.menu-inline-form input[type="text"] {
  flex: 1;
  min-width: 100px;
  padding: 5px 8px;
  border: 1px solid #aaa;
  font-size: 13px;
  border-radius: 4px;
}
.menu-transfer-form { flex-direction: column; align-items: stretch; }
.menu-select {
  width: 100%;
  min-width: 140px;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid #aaa;
  font-size: 13px;
  border-radius: 4px;
  background: #fff;
}
.menu-action-btn {
  padding: 5px 10px;
  border: 1px solid #888;
  background: #eef3fb;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.empty { padding: 24px; color: #777; }

.inline-form { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.btn-mini {
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid #888;
  background: #f5f5f5;
  cursor: pointer;
}
.btn-danger-mini { background: #ffe8e8; color: #900; border-color: #c88; }
.btn-move { background: #e8f5e9; color: #2e7d32; border-color: #81c784; min-width: 28px; }
.btn-move:disabled { opacity: 0.35; cursor: not-allowed; }

.flash {
  margin: 8px 12px 0;
  padding: 8px 10px;
  border: 1px solid;
  font-size: 13px;
}
.flash.ok { background: #eef9ee; border-color: #8c8; color: #262; }
.flash.err { background: #fff0f0; border-color: #d88; color: #900; }

/* 主页页脚 */
.site-footer {
  margin-top: auto;
  padding: 20px 16px 24px;
  text-align: center;
  font-size: 12px;
  color: #666;
  border-top: 1px solid #e0e0e0;
  background: #fafafa;
}
.site-footer p { margin: 0 0 6px; }
.site-footer p:last-child { margin-bottom: 0; }
.site-footer-beian {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 16px;
}
.site-footer a {
  color: #666;
  text-decoration: none;
}
.site-footer a:hover { color: #333; text-decoration: underline; }

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay[hidden] { display: none !important; }
.image-preview-box {
  background: #fff;
  width: min(920px, 100%);
  max-height: min(90vh, 900px);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.image-preview-body {
  padding: 12px;
  overflow: auto;
  text-align: center;
  background: #1a1a1a;
  flex: 1;
}
.image-preview-body img {
  max-width: 100%;
  max-height: calc(90vh - 120px);
  object-fit: contain;
  vertical-align: middle;
}
.media-preview-box {
  background: #fff;
  width: min(960px, 100%);
  max-height: min(92vh, 920px);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.media-preview-body {
  padding: 12px;
  background: #111;
  flex: 1;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-preview-audio {
  width: min(100%, 520px);
}
.media-preview-video {
  max-width: 100%;
  max-height: calc(92vh - 150px);
  width: 100%;
  background: #000;
}
.media-preview-pdf {
  width: 100%;
  height: calc(92vh - 150px);
  min-height: 420px;
  border: none;
  background: #fff;
}
.media-preview-footer {
  padding: 10px 14px;
  border-top: 1px solid #ddd;
  background: #fff;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.text-preview-box {
  background: #fff;
  width: min(920px, 100%);
  max-height: min(90vh, 900px);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.text-preview-body {
  padding: 0;
  overflow: auto;
  flex: 1;
  background: #f7f8fa;
}
.text-preview-pre {
  margin: 0;
  padding: 16px 18px;
  font: 13px/1.55 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  color: #222;
  min-height: 120px;
}
.text-preview-editor {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  margin: 0;
  padding: 16px 18px;
  border: none;
  resize: none;
  outline: none;
  font: 13px/1.55 Consolas, "Courier New", monospace;
  color: #222;
  background: #fffef8;
  box-sizing: border-box;
}
.text-preview-footer {
  padding: 10px 14px;
  border-top: 1px solid #ddd;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.text-preview-status {
  font-size: 12px;
  color: #666;
  flex: 1;
  min-width: 120px;
}
.text-preview-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.text-preview-dl,
.text-preview-save {
  display: inline-block;
  width: auto;
  margin: 0;
  text-decoration: none;
  text-align: center;
  min-width: 72px;
}
.text-preview-save[hidden] { display: none !important; }
.modal-box {
  background: #fff;
  width: min(480px, 100%);
  max-height: min(85vh, 720px);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(#5b7db8, #3f6299);
  color: #fff;
}
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}
.modal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
}
.modal-tab {
  flex: 1;
  padding: 8px 4px;
  border: 1px solid #ccc;
  background: #f5f5f5;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  border-radius: 4px;
}
.modal-tab.active {
  background: #dce6f3;
  border-color: #5b7db8;
  font-weight: bold;
}
.modal-panel { display: none; }
.modal-panel.active { display: block; }

.panel-form label,
.admin-box label {
  display: block;
  margin: 8px 0 4px;
  font-size: 13px;
}
.panel-form input[type="text"],
.panel-form input[type="password"],
.panel-form input[type="file"],
.panel-form select,
.panel-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #999;
  font: inherit;
  border-radius: 4px;
  margin-bottom: 6px;
}
.btn-primary, .btn-secondary, .btn-danger {
  margin-top: 12px;
  padding: 8px 16px;
  border: 1px solid #666;
  cursor: pointer;
  font: inherit;
  border-radius: 4px;
  width: 100%;
}
.btn-primary { background: #dce6f3; }
.btn-secondary { background: #eee; }
.btn-danger {
  margin-top: 12px;
  padding: 8px 16px;
  border: 1px solid #c88;
  background: #ffe8e8;
  color: #900;
  cursor: pointer;
  font: inherit;
  border-radius: 4px;
  width: 100%;
}
.btn-link-back {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  width: auto;
  padding: 8px 16px;
  margin-top: 12px;
}
/* 记事本编辑页：内容区尽量铺满，避免中间一条窄栏 */
.page.notepad-page {
  max-width: min(1600px, 100%);
  width: 100%;
  border-left: none;
  border-right: none;
}
.notepad-main {
  padding: 20px 32px 36px;
  max-width: none;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}
.notepad-edit-form {
  width: 100%;
  max-width: none;
}
.notepad-edit-form input[type="text"],
.notepad-edit-form textarea {
  width: 100%;
  box-sizing: border-box;
}
.notepad-edit-form textarea {
  min-height: 420px;
  padding: 12px 14px;
  border: 1px solid #999;
  font: inherit;
  line-height: 1.6;
  border-radius: 4px;
  resize: vertical;
}
.notepad-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.notepad-actions .btn-primary,
.notepad-actions .btn-link-back { width: auto; min-width: 96px; }
.notepad-main > form .btn-danger {
  width: auto;
  min-width: 120px;
}
.notepad-readonly {
  width: 100%;
  max-width: none;
}
.notepad-readonly h2 { margin: 0 0 12px; }
.notepad-content {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8f8f8;
  border: 1px solid #ddd;
  padding: 16px 18px;
  border-radius: 6px;
  line-height: 1.6;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 860px) {
  .notepad-main { padding: 16px; }
  .page.notepad-page {
    max-width: none;
  }
}
.hint { color: #666; font-size: 12px; margin-top: 8px; }
.hint.warn { color: #c00; }
.hint.ok { color: #080; }
.welcome-line { margin: 0 0 10px; font-size: 15px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 14px; cursor: pointer; }
.checkbox-label input { width: auto; margin: 0; }
.admin-box h4 { margin: 12px 0 6px; font-size: 14px; }
.user-list { margin-top: 10px; font-size: 13px; }

.storage-stats {
  background: #f6f8fb;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 12px;
  margin-top: 6px;
}
.storage-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.storage-stat-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
}
.storage-label {
  display: block;
  font-size: 11px;
  color: #777;
  margin-bottom: 2px;
}
.storage-value {
  font-size: 15px;
  color: #2a4a7a;
}
.storage-bar-wrap { margin-bottom: 10px; }
.storage-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
  gap: 8px;
}
.storage-bar {
  position: relative;
  height: 12px;
  background: #e8edf4;
  border-radius: 999px;
  overflow: hidden;
}
.storage-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: #c5d0de;
  border-radius: 999px;
}
.storage-bar-netdisk {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #5b7db8, #3f6299);
  border-radius: 999px;
  max-width: 100%;
}
.storage-bar-hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: #888;
}
.storage-top-title {
  margin: 0 0 6px;
  font-size: 12px;
  color: #555;
  font-weight: bold;
}
.storage-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}
.storage-top-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
}
.storage-top-size { color: #666; white-space: nowrap; }
.storage-top-bar {
  grid-column: 1 / -1;
  height: 4px;
  background: #e8edf4;
  border-radius: 999px;
  overflow: hidden;
}
.storage-top-bar span {
  display: block;
  height: 100%;
  background: #7a9bc8;
  border-radius: 999px;
}
@media (max-width: 520px) {
  .storage-summary { grid-template-columns: 1fr; }
}
.user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed #ddd;
}
.btn-link-danger {
  background: none;
  border: none;
  color: #c00;
  cursor: pointer;
  font-size: 12px;
}

.unlock-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ece9d8;
}
.unlock-box {
  width: min(360px, 92vw);
  background: #fff;
  border: 1px solid #999;
  padding: 24px;
  border-radius: 8px;
}
.unlock-box h2 { margin: 0 0 8px; font-size: 18px; }
.unlock-box form { margin-top: 16px; }
.unlock-box input {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  border: 1px solid #999;
  border-radius: 4px;
}

@media (max-width: 860px) {
  .page {
    border: none;
    max-width: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .site-title { font-size: 17px; letter-spacing: 1px; }
  .quick-login { width: min(260px, 72vw); padding: 2px 2px 2px 12px; }
  .quick-login-input { font-size: 12px; padding: 5px 6px 5px 0; }
  .quick-login-btn { padding: 6px 12px; font-size: 12px; }
  .header-label { display: none; }
  .header-left { visibility: hidden; height: 0; overflow: hidden; }
  .header-right { gap: 4px; }
  .user-info { font-size: 12px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
  .dir-tool-btn { padding: 8px 10px; }
  .dir-tool-label { display: none; }
  .dir-tool-icon { font-size: 18px; }
  .entry-row {
    grid-template-columns: 30px 38px minmax(0, 1fr) auto 72px;
    padding: 8px 8px 8px 6px;
    gap: 6px;
  }
  .dir-list.can-sort .entry-row {
    grid-template-columns: 30px 20px 38px minmax(0, 1fr) auto 72px;
  }
  .dir-list.root-list .entry-row {
    grid-template-columns: 30px 38px minmax(0, 1fr) auto;
  }
  .dir-list.root-list.can-sort .entry-row {
    grid-template-columns: 30px 20px 38px minmax(0, 1fr) auto;
  }
  .share-btn,
  .download-btn {
    width: 32px;
    height: 32px;
  }
  .entry-url-hint { max-width: 18vw; }
  .menu-sub {
    left: auto;
    right: 0;
    top: 100%;
  }
  .modal-box {
    max-height: calc(100vh - 80px - env(safe-area-inset-bottom));
    border-radius: 12px 12px 0 0;
    align-self: flex-end;
  }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

/* ============ 多选批量下载 ============ */
.entry-check-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}
.entry-check {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: #3f6299;
}
.batch-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: #eef3fa;
  border: 1px solid #cfd9e8;
  border-radius: 8px;
}
.batch-bar[hidden] { display: none; }
.batch-info {
  font-size: 13px;
  color: #333;
  flex: 1;
}
.batch-info strong { color: #3f6299; font-size: 15px; }
.batch-btn { padding: 6px 14px; font-size: 13px; }
body.batch-active .entry-check-cell { display: flex; }
body.batch-active .entry-row { background: #f8faff; }
body.batch-active .entry-row:has(.entry-check:checked) { background: #e7effb; }

/* ============ 文件名搜索 ============ */
.path-bar {
  flex-wrap: wrap;
  gap: 8px 12px;
}
.search-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 1 1 280px;
  max-width: 460px;
}
.search-input {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  font-size: 14px;
  border: 1px solid #c8d0dc;
  border-radius: 999px;
  outline: none;
  background: #fff;
}
.search-input:focus { border-color: #3f6299; box-shadow: 0 0 0 2px rgba(63, 98, 153, 0.15); }
.search-btn {
  padding: 7px 16px;
  font-size: 14px;
  border: none;
  border-radius: 999px;
  background: #3f6299;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.search-btn:active { background: #34507f; }
.search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: #555;
  background: #f4f7fb;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 6px;
}
.search-clear {
  color: #3f6299;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.search-row {
  display: grid;
  grid-template-columns: 30px 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 10px 8px 10px 6px;
  text-decoration: none;
  color: inherit;
}
.search-row:hover { background: #fafbfd; }
.search-icon { font-size: 20px; text-align: center; }
.search-meta {
  color: #888;
  font-size: 12px;
  white-space: nowrap;
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ 分享管理（管理弹窗） ============ */
.share-list { margin-top: 4px; }
.share-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed #ddd;
}
.share-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.share-item-name { font-size: 14px; color: #333; font-weight: bold; }
.share-item-meta { font-size: 12px; color: #888; }
.share-item-link {
  font-size: 12px;
  color: #3f6299;
  word-break: break-all;
}

/* ============ 分享页面 ============ */
.share-card {
  max-width: 460px;
  margin: 40px auto;
  padding: 28px 24px;
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(30, 50, 90, 0.08);
  text-align: center;
}
.share-card-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  word-break: break-all;
}
.share-card-hint { margin: 0 0 16px; font-size: 13px; color: #777; }
.share-code-form input {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  text-align: center;
  border: 1px solid #c8d0dc;
  border-radius: 8px;
  margin-bottom: 12px;
}
.share-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}
.share-action-btn {
  display: inline-block;
  padding: 10px 22px;
  font-size: 14px;
  border-radius: 8px;
  text-decoration: none;
}
.share-dir { padding: 0 0 12px; }
.share-meta { color: #888; font-size: 12px; }

/* ============ 分享创建结果 ============ */
.share-result {
  margin-top: 10px;
  padding: 12px;
  background: #f2f7f0;
  border: 1px solid #cfe3c8;
  border-radius: 8px;
  text-align: left;
}
.share-result-title { margin: 0 0 6px; font-size: 13px; font-weight: bold; color: #2f6b2f; }
.share-result-link {
  font-size: 12px;
  color: #1d5c1d;
  word-break: break-all;
  user-select: all;
  margin-bottom: 6px;
}
.share-result-hint { margin: 0 0 8px; font-size: 12px; color: #6b8a6b; }
.share-result-actions { display: flex; gap: 8px; }
.share-result-actions .menu-action-btn { font-size: 12px; }

/* ============ 移动端增强 ============ */
@media (max-width: 860px) {
  .search-form {
    flex: 1 1 100%;
    max-width: none;
    order: 10;
  }
  .path-bar-main { order: 0; }
  .path-download-btn { order: 20; }
  .batch-bar {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 10px 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  }
  body.batch-active .dir-list { padding-bottom: 64px; }
  .entry-check { width: 20px; height: 20px; }
  .search-row { padding: 12px 8px 12px 6px; }
  .search-icon { font-size: 22px; }
  .share-card { margin: 16px auto; padding: 20px 16px; }
}
@media (max-width: 520px) {
  .search-meta { max-width: 28vw; }
  .share-action-btn { flex: 1 1 100%; }
}

/* ============ 回收站 ============ */
.recycle-tip {
  background: #fff7e6;
  border: 1px solid #f0d9a8;
  color: #7a5b1e;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.5;
}
.recycle-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #333;
}
.recycle-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recycle-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  padding: 10px 14px;
}
.recycle-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.recycle-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.recycle-name {
  font-size: 15px;
  color: #222;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recycle-meta {
  font-size: 12px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recycle-expiring { color: #c0392b; font-weight: 600; }
.recycle-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.recycle-actions form { margin: 0; }
.recycle-actions .batch-btn { margin-top: 0; }
@media (max-width: 520px) {
  .recycle-item { flex-wrap: wrap; }
  .recycle-actions { width: 100%; }
  .recycle-actions .batch-btn { flex: 1; }
}

/* ============ 主页访问门禁（访问密码） ============ */
.gate-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.gate-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #c9d4e4;
  border-radius: 12px;
  padding: 36px 34px 28px;
  text-align: center;
  box-shadow: 0 6px 22px rgba(30, 60, 110, 0.12);
}
.gate-lock { font-size: 46px; line-height: 1; }
.gate-title {
  margin: 14px 0 6px;
  font-size: 22px;
  color: #1f2d46;
}
.gate-sub {
  margin: 0 0 20px;
  font-size: 13px;
  color: #7a8698;
}
.gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}
.gate-input {
  padding: 12px 14px;
  border: 1px solid #b8c4d6;
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  text-align: center;
  outline: none;
}
.gate-input:focus { border-color: #3f6299; box-shadow: 0 0 0 3px rgba(63, 98, 153, 0.18); }
.gate-btn {
  padding: 12px 16px;
  border: 1px solid #34507f;
  border-radius: 8px;
  background: #3f6299;
  color: #fff;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.gate-btn:hover { background: #34507f; }
.gate-btn-secondary {
  padding: 10px 14px;
  border: 1px solid #b8c4d6;
  border-radius: 8px;
  background: #eef3fb;
  color: #2b4a7a;
  font: inherit;
  cursor: pointer;
}
.gate-btn-secondary:hover { background: #dce6f3; }
.gate-alt {
  margin-top: 18px;
  font-size: 13px;
  color: #7a8698;
}
.gate-alt summary {
  cursor: pointer;
  color: #2b4a7a;
  display: inline-block;
}
.gate-alt details[open] summary { display: block; margin-bottom: 12px; }
.gate-alt .hint { color: #7a8698; margin: 0 0 10px; }
.gate-footer {
  margin-top: 18px;
  font-size: 12px;
  color: #9aa4b3;
}
