:root {
  --bg-page: #f5f6fa;
  --bg-white: #ffffff;
  --border: #e8eaf0;
  --primary: #6366f1;
  --primary-hover: #5457e8;
  --primary-light: rgba(99,102,241,.08);
  --primary-lighter: rgba(99,102,241,.04);
  --text-primary: #1e1e2d;
  --text-secondary: #6b7280;
  --text-dim: #9ca3af;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06);
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-page); color: var(--text-primary); line-height:1.6;
  overflow: hidden;
}
svg { display:inline-block; vertical-align:middle; }
.icon { width:15px; height:15px; display:inline-block; vertical-align:middle; flex-shrink:0; }
.icon-sm { width:13px; height:13px; }
.icon-md { width:18px; height:18px; }
.icon-lg { width:20px; height:20px; color:var(--text-dim); }

/* ===== Login Page ===== */
.login-page {
  height: calc(100vh - 44px); display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f5f6fa 0%, #e8eaf0 100%);
}
.login-container {
  width: 380px; background: var(--bg-white); border-radius: 16px;
  padding: 48px 40px; box-shadow: 0 8px 32px rgba(0,0,0,.08);
}
.login-logo {
  width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 20px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
}
.login-logo svg { width: 28px; height: 28px; color: #fff; }
.login-title {
  font-size: 22px; font-weight: 600; text-align: center; margin-bottom: 6px;
  color: var(--text-primary);
}
.login-subtitle {
  font-size: 13px; text-align: center; color: var(--text-secondary); margin-bottom: 32px;
}
.login-form .form-input-wrap {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-page); transition: all .2s;
  padding: 0 14px;
}
.login-form .form-input-wrap svg { width: 16px; height: 16px; color: var(--text-dim); flex-shrink: 0; }
.login-form .form-input-wrap input {
  flex: 1; border: none; background: transparent; padding: 12px 0 12px 4px;
  font-size: 14px; font-family: inherit; color: var(--text-primary);
  outline: none;
}
.login-form .form-input-wrap:focus-within {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
  background: #fff;
}
.login-btn {
  width: 100%; padding: 12px; background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; border: none; border-radius: var(--radius); font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all .2s; font-family: inherit;
  margin-top: 8px;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.login-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.login-error {
  font-size: 12px; color: var(--error); text-align: center; margin-top: 12px;
  min-height: 18px;
}

/* ===== App Layout ===== */
.app { display: flex; height: calc(100vh - 44px); }

/* ===== Sidebar ===== */
.sidebar {
  width: 220px; min-width: 220px; background: var(--bg-white);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.sidebar-header {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo {
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo svg { width: 16px; height: 16px; color: #fff; }
.sidebar-info { flex: 1; }
.sidebar-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.sidebar-user { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-group-title {
  font-size: 11px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; padding: 8px 14px 6px; letter-spacing: .5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  border-radius: var(--radius); cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); transition: all .2s; margin-bottom: 2px;
  border: none; background: transparent; width: 100%; text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: var(--bg-page); color: var(--text-primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer {
  padding: 12px; border-top: 1px solid var(--border);
}

/* ===== Main ===== */
.main { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.main-inner { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 0; }

/* ===== Top Header Bar ===== */
.top-header {
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-white); display: flex; align-items: center;
  justify-content: flex-start; gap: 16px; min-height: 56px;
}
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.breadcrumb-item {
  color: var(--text-secondary); cursor: pointer; transition: color .2s;
  padding: 4px 6px; border-radius: 4px; border: none; background: transparent;
  font-family: inherit; font-size: 13px;
}
.breadcrumb-item:hover { color: var(--primary); background: var(--primary-lighter); }
.breadcrumb-item.current { color: var(--text-primary); font-weight: 600; cursor: default; }
.breadcrumb-sep { color: var(--text-dim); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.top-header-left { display: contents; }
.top-header-brand { display: none; }
.toolbar-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  font-size: 12px; color: var(--text-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); background: transparent; cursor: pointer;
  transition: all .2s; font-family: inherit;
}
.toolbar-btn:hover { color: var(--text-primary); border-color: #cbd5e1; background: var(--bg-page); }
.toolbar-btn svg { width: 14px; height: 14px; }
.toolbar-btn.primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.toolbar-btn.primary:hover { background: var(--primary-hover); }
.toolbar-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Content ===== */
.content { flex: 1; padding: 24px; overflow-y: auto; }

/* ===== Directory Cards ===== */
.dir-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.dir-card {
  background: var(--bg-white); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; cursor: pointer; transition: all .2s;
}
.dir-card:hover {
  border-color: var(--primary); box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.dir-card-icon {
  width: 40px; height: 40px; border-radius: 10px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
}
.dir-card-icon.server { background: var(--primary-lighter); color: var(--primary); }
.dir-card-icon.server svg { width: 22px; height: 22px; }
.dir-card-name { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-card-path { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
.dir-card-perm {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  display: inline-block; font-weight: 500;
}
.perm-readonly { background: #fef3c7; color: #92400e; }
.perm-readwrite { background: var(--primary-light); color: var(--primary); }

/* ===== File List ===== */
.file-table { width: 100%; border-collapse: collapse; background: var(--bg-white); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.file-table th {
  background: var(--bg-page); padding: 12px 16px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.file-table th:hover { color: var(--primary); }
.sort-arrow { color: var(--text-dim); margin-left: 4px; font-size: 10px; }
.file-table td {
  padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.file-table tr:last-child td { border-bottom: none; }
.file-table tbody tr:hover { background: var(--primary-lighter); }
.file-table .file-name {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.file-table .file-name:hover { color: var(--primary); }
.file-table .file-icon {
  width: 32px; height: 32px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.file-icon.folder { background: #fef3c7; color: #d97706; }
.file-icon.folder svg { width: 18px; height: 18px; }
.file-icon.image { background: #d1fae5; color: #059669; }
.file-icon.image svg { width: 18px; height: 18px; }
.file-icon.pdf { background: #fee2e2; color: #dc2626; }
.file-icon.pdf svg { width: 18px; height: 18px; }
.file-icon.doc { background: #dbeafe; color: #2563eb; }
.file-icon.doc svg { width: 18px; height: 18px; }
.file-icon.video { background: #ede9fe; color: #7c3aed; }
.file-icon.video svg { width: 18px; height: 18px; }
.file-icon.default { background: var(--bg-page); color: var(--text-dim); }
.file-icon.default svg { width: 18px; height: 18px; }
.file-size { color: var(--text-secondary); font-size: 12px; }
.file-date { color: var(--text-dim); font-size: 12px; }
.file-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.file-table tbody tr:hover .file-actions { opacity: 1; }

/* ===== View Toggle ===== */
.view-toggle {
  display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.view-toggle button {
  padding: 6px 10px; border: none; background: transparent; cursor: pointer;
  color: var(--text-dim); transition: all .2s; display: flex; align-items: center;
}
.view-toggle button.active { background: var(--primary); color: #fff; }
.view-toggle button:not(.active):hover { background: var(--bg-page); color: var(--text-secondary); }
.view-toggle button svg { width: 14px; height: 14px; }

/* ===== Grid View ===== */
.file-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.file-grid-item {
  background: var(--bg-white); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 16px; text-align: center; cursor: pointer; transition: all .2s;
  position: relative;
}
.file-grid-more {
  position: absolute; top: 6px; right: 6px; z-index: 5;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: none; border-radius: 8px;
  background: rgba(255,255,255,.85); color: var(--text-secondary);
  cursor: pointer; transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.file-grid-more:hover, .file-grid-more:active { background: var(--primary-lighter); color: var(--primary); }
.file-grid-item:hover {
  border-color: var(--primary); box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.file-grid-item .icon-lg { margin: 0 auto 12px; }
.file-grid-item .file-icon.folder { background: #fef3c7; color: #d97706; }
.file-grid-item .file-icon.image { background: #d1fae5; color: #059669; }
.file-grid-item .file-icon.pdf { background: #fee2e2; color: #dc2626; }
.file-grid-item .file-icon.doc { background: #dbeafe; color: #2563eb; }
.file-grid-item .file-icon.video { background: #ede9fe; color: #7c3aed; }
.file-grid-item .file-icon.default { background: var(--bg-page); color: var(--text-dim); }
.file-grid-item .file-grid-name {
  font-size: 13px; color: var(--text-primary); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.file-grid-item .file-grid-meta {
  font-size: 11px; color: var(--text-dim); margin-top: 4px;
}
.file-grid-item .file-grid-actions {
  display: flex; justify-content: center; gap: 4px; padding-top: 8px;
  opacity: 0; transition: opacity .2s;
}
.file-grid-item:hover .file-grid-actions {
  opacity: 1;
}
.file-grid-item .btn-icon-sm {
  padding: 4px; border-radius: 6px; transition: background .2s;
}
.file-grid-item .btn-icon-sm:hover {
  background: #fee2e2;
}

/* ===== Grid View Thumbnails ===== */
.file-grid-item .file-grid-thumb {
  width: 100%; height: 100px; overflow: hidden;
  border-radius: 8px; margin-bottom: 8px; position: relative;
}
.file-grid-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}

/* ===== Context Menu ===== */
.context-menu {
  position: fixed; background: var(--bg-white); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.15); padding: 4px 0;
  min-width: 160px; z-index: 3000; display: none;
}
.context-menu-item {
  padding: 8px 16px; font-size: 13px; color: var(--text-primary); cursor: pointer;
  transition: background .15s; display: flex; align-items: center; gap: 8px;
}
.context-menu-item:hover { background: var(--primary-lighter); }
.context-menu-item.danger { color: var(--error); }
.context-menu-item.danger:hover { background: #fef2f2; }
.context-menu-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.context-menu-separator { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== Buttons ===== */
button, .btn, .login-btn, .toolbar-btn, .mobile-bar-btn, .nav-item {
  white-space: nowrap;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 8px 16px; font-size: 13px; font-weight: 500;
  border: none; border-radius: var(--radius); cursor: pointer; transition: all .2s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform:none; box-shadow:none; }
.btn-secondary { background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text-primary); border-color: #cbd5e1; }
.btn-danger { background: transparent; color: var(--error); border: 1px solid var(--border); }
.btn-danger:hover { background: #fef2f2; border-color: var(--error); }
.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 30px; }
.btn-icon {
  width: 30px; height: 30px; display: inline-flex; align-items: center;
  justify-content: center; background: transparent; border: 1px solid transparent;
  border-radius: var(--radius); cursor: pointer; color: var(--text-dim); transition: all .2s;
}
.btn-icon:hover { background: var(--bg-page); border-color: var(--border); color: var(--text-primary); }
.btn-icon.danger:hover { background: #fef2f2; border-color: var(--error); color: var(--error); }

/* ===== Modal / Dialog ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-white); border-radius: 16px; padding: 28px; width: 440px;
  max-width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 48px rgba(0,0,0,.12);
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 20px; }
.modal-close {
  float: right; width: 32px; height: 32px; border: none; background: transparent;
  cursor: pointer; border-radius: var(--radius); display: flex; align-items: center;
  justify-content: center; color: var(--text-dim); transition: all .2s;
}
.modal-close:hover { background: var(--bg-page); color: var(--text-primary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; background: var(--bg-page); color: var(--text-primary);
  transition: border-color .2s; height: 38px; box-sizing: border-box;
}
select.form-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea.form-input { resize: vertical; min-height: 80px; }

/* ===== Toast ===== */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  background: var(--bg-white); border: 1px solid var(--border); box-shadow: var(--shadow-md);
  animation: slideIn .3s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--primary); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Upload Progress ===== */
.upload-area {
  border: 2px dashed var(--border); border-radius: 12px; padding: 40px;
  text-align: center; color: var(--text-secondary); cursor: pointer;
  transition: all .2s;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: var(--primary-lighter); }
.upload-area svg { width: 32px; height: 32px; color: var(--text-dim); margin-bottom: 12px; }
.upload-area p { font-size: 13px; margin-bottom: 4px; }
.upload-area .hint { font-size: 12px; color: var(--text-dim); }
.upload-progress { margin-top: 16px; }
.upload-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--bg-page); border-radius: var(--radius); margin-bottom: 8px;
}
.upload-item-name { flex: 1; font-size: 13px; }
.upload-item-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.upload-item-bar-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width .3s; }
.upload-item-pct { font-size: 12px; color: var(--text-secondary); width: 40px; text-align: right; }

/* ===== Context Menu ===== */
.context-menu {
  position: fixed; background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 6px;
  min-width: 180px; z-index: 1500;
}
.context-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  font-size: 13px; color: var(--text-secondary); border-radius: 6px;
  cursor: pointer; transition: all .15s; border: none; background: none; width: 100%;
  text-align: left; font-family: inherit;
}
.context-menu-item:hover { background: var(--primary-lighter); color: var(--text-primary); }
.context-menu-item.danger:hover { background: #fef2f2; color: var(--error); }
.context-menu-item svg { width: 14px; height: 14px; }
.context-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== Preview Modal ===== */
.preview-content iframe { width: 100%; height: 80vh; border: none; }
.preview-content img { max-width: 100%; max-height: 85vh; object-fit: contain; }
.preview-content video { max-width: 100%; max-height: 85vh; }

/* ===== Personal Center ===== */
.profile-section { max-width: 560px; }
.profile-section { max-width: 560px; }
.profile-card {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: 12px; padding: 0;
}
.profile-card-title {
  font-size: 15px; font-weight: 600; padding: 24px 24px 16px;
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.profile-body { padding: 0 24px 24px; }
.profile-row { display: flex; align-items: center; padding: 16px 0; }
.profile-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.profile-label { width: 80px; font-size: 13px; color: var(--text-secondary); flex-shrink: 0; }
.profile-value { flex: 1; font-size: 13px; color: var(--text-primary); display: flex; align-items: center; min-height: 24px; }
.profile-value input[type="text"],
.profile-value input[type="password"] {
  flex: 1; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; background: var(--bg-page); color: var(--text-primary);
  height: 36px; box-sizing: border-box;
}
.profile-value input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.profile-actions { display: flex; gap: 12px; margin-top: 16px; max-width: 300px; }
.text-dim { color: var(--text-dim); }
.btn-save {
  background: var(--primary); color: #fff; border: none; padding: 6px 14px;
  border-radius: var(--radius); font-size: 12px; cursor: pointer; font-family: inherit;
}
.btn-save:hover { background: var(--primary-hover); }
.btn-cancel {
  background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: var(--radius); font-size: 12px; cursor: pointer; font-family: inherit;
}
.btn-cancel:hover { color: var(--text-primary); }

/* ===== 手机端底部导航栏 ===== */
.mobile-bar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
  height: 56px; background: var(--bg-white);
  border-top: 1px solid var(--border);
  justify-content: space-around; align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-bar-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; cursor: pointer; padding: 6px 10px;
  color: var(--text-secondary); font-size: 10px; min-width: 48px;
  transition: color .15s;
}
.mobile-bar-btn.active,
.mobile-bar-btn:hover { color: var(--primary); }
.mobile-bar-btn svg { width: 22px; height: 22px; }

/* ===== 手机端 Header 简化 ===== */
.mobile-back-btn { display: none; }

/* ===== 手机端侧边栏抽屉 ===== */
.mobile-menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; border: none; background: transparent;
  color: var(--text-primary); border-radius: var(--radius); cursor: pointer;
  padding: 0; margin-right: 8px;
}
.mobile-menu-btn:hover { background: var(--bg-page); }
.mobile-menu-btn svg { width: 22px; height: 22px; }
.mobile-sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 1100; opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.mobile-sidebar-overlay.open { opacity: 1; visibility: visible; }
.mobile-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 260px; max-width: 80vw;
  background: var(--bg-white); border-right: 1px solid var(--border);
  z-index: 1101; transform: translateX(-100%);
  transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.mobile-sidebar.open { transform: translateX(0); }
.mobile-sidebar-header {
  padding: 18px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.mobile-sidebar-close {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: var(--radius); cursor: pointer;
  color: var(--text-secondary);
}
.mobile-sidebar-close:hover { background: var(--bg-page); color: var(--text-primary); }
.mobile-sidebar-close svg { width: 18px; height: 18px; }
.mobile-sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.mobile-sidebar-nav .nav-item {
  padding: 12px 14px; font-size: 14px; gap: 12px; margin-bottom: 4px;
}
.mobile-sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.mobile-sidebar-footer .btn { width: 100%; justify-content: center; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  /* --- 全局 --- */
  .sidebar { display: none; }
  .main { margin-left: 0 !important; padding-bottom: 16px !important; }
  .main-inner { padding: 0 !important; }
  .site-footer {
    display: flex; padding: 10px 12px 74px; min-height: auto;
    font-size: 11px; gap: 4px 10px;
  }
  /* 移动端底部区域改为流式布局，彻底避免 iOS 工具栏遮挡导致 tabbar 下沉 */
  body:has(.app) { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
  body:has(.app) .app { flex: 1 1 auto; min-height: 0; height: auto; }
  body:has(.app) .site-footer {
    position: relative; flex: 0 0 auto; order: 1; height: auto;
    display: flex; flex-wrap: wrap; justify-content: center;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }
  .header { padding: 8px 12px; }
  .user-info-text { display: none; }
  .header-right { gap: 6px; }
  .header-right .btn { font-size: 12px; padding: 5px 10px; }

  /* --- 底部导航栏 --- */
  .mobile-bar {
    display: flex; position: relative; flex: 0 0 auto; order: 2; bottom: auto;
  }

  /* --- 顶部工具栏 --- */
  .mobile-menu-btn { display: inline-flex; }
  .top-header {
    padding: 10px 12px; flex-direction: row; align-items: center;
    border-bottom: 1px solid var(--border); margin-bottom: 4px;
    gap: 8px;
  }
  .top-header-left {
    display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-width: 0;
  }
  .top-header-brand {
    display: block; font-size: 15px; font-weight: 700; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .top-header-brand span { color: #1a5cff; }
  .top-actions { display: none; }
  .breadcrumb {
    flex: 1; font-size: 13px; overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch; padding: 0;
  }
  .breadcrumb::-webkit-scrollbar { display: none; }

  /* --- 视图切换 --- */
  .file-toolbar { margin-bottom: 8px !important; }
  .view-toggle button { padding: 6px 12px; font-size: 13px; }

  /* --- 文件列表：卡片式 --- */
  .file-table { border-radius: 0; border-left: none; border-right: none; }
  .file-table thead { display: none; }
  .file-table tbody { display: flex; flex-direction: column; }
  .file-table tbody tr {
    display: flex; align-items: center; flex-wrap: wrap;
    padding: 12px 12px; border-bottom: 1px solid var(--border);
    gap: 0 8px; position: relative; cursor: default !important;
  }
  .file-table tbody tr:last-child { border-bottom: none; }
  .file-table td {
    display: block; padding: 0 !important; border: none;
  }
  .file-table td:first-child { flex: 1 1 100%; min-width: 0; order: 1; }
  .file-table td.file-size { order: 2; font-size: 11px; color: var(--text-secondary); }
  .file-table td.file-date { order: 3; font-size: 11px; color: var(--text-secondary); }
  .file-table td:last-child { order: 4; margin-left: auto; }
  .file-name { gap: 10px; }
  .file-name svg { width: 22px; height: 22px; flex-shrink: 0; }
  .file-name span { 
    font-size: 14px; font-weight: 500; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
  }
  .file-actions { opacity: 1 !important; display: flex; gap: 2px; }
  .file-actions .btn-icon { padding: 4px 6px; }

  /* --- 网格视图 --- */
  .file-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .file-grid-item { padding: 12px 8px; border-radius: 8px; }
  .file-grid-thumb { height: 64px; }
  .file-grid-name { font-size: 11px; }
  .file-grid-meta { font-size: 10px; }

  /* --- 目录总览 --- */
  .dir-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dir-card { padding: 16px; border-radius: 10px; }
  .dir-card h3 { font-size: 14px; }

  /* --- 弹窗居中（移动端） --- */
  .modal-overlay { align-items: center !important; box-sizing: border-box; }
  .modal {
    width: 90vw !important; max-width: 480px !important;
    max-height: 80vh !important; border-radius: 16px !important;
    padding: 24px 20px 24px !important; margin: auto !important;
    box-shadow: 0 24px 48px rgba(0,0,0,.12) !important;
  }
  .modal-title { font-size: 17px; text-align: center; }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions .btn { width: 100%; padding: 12px; font-size: 15px; }
  .form-input { padding: 12px 14px; font-size: 15px; border-radius: 8px; }
  .form-label { font-size: 13px; margin-bottom: 4px; }

  /* --- 搜索弹窗（保持全屏） --- */
  #dialog-search .modal {
    max-height: 90vh !important; border-radius: 16px !important;
    width: 95vw !important; max-width: 600px !important;
    position: relative;
  }
  #dialog-search .modal-close {
    position: absolute !important;
    right: 12px !important;
    top: 12px !important;
    float: none !important;
  }
  #search-results { margin: 8px 0 !important; padding: 8px !important; }
  #search-results .file-table tbody tr { padding: 10px 6px; }
  #search-results-tbody .file-name { gap: 8px; }
  #search-results-tbody .file-name svg { width: 20px; height: 20px; }

  /* --- 移动弹窗（移动目录） --- */
  #dialog-move .modal {
    max-height: 85vh !important; width: 90vw !important;
    max-width: 700px !important; border-radius: 16px !important;
  }
  #dialog-move select.form-input {
    height: 44px !important; min-height: 44px !important;
    padding: 0 36px 0 14px !important;
    font-size: 14px !important; line-height: 44px !important;
    text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
  }
  .move-dialog-table { font-size: 13px; }
  .move-dialog-table td { padding: 10px 12px; }

  /* --- 预览弹窗 --- */
  #preview-content img { max-height: 70vh; }

  /* --- 登录 --- */
  .login-page { padding: 0; }
  .login-container {
    width: 100vw; max-width: 100vw; min-height: 100vh;
    border-radius: 0; padding: 48px 24px 32px;
    display: flex; flex-direction: column; justify-content: center;
  }
  .login-container h2 { font-size: 22px; }
  .login-form .form-input-wrap input { font-size: 16px; padding: 14px 0 14px 4px; }

  /* --- 个人中心 --- */
  .profile-section { max-width: 100%; }
  .profile-card { border-radius: 0; border-left: none; border-right: none; }
  .profile-row {
    flex-direction: column; align-items: flex-start;
    padding: 14px 0; gap: 8px; border-color: var(--border);
  }
  .profile-label { width: 100%; font-size: 12px; }
  .profile-actions { max-width: 100%; flex-direction: column; gap: 8px; }
  .profile-actions .btn { width: 100%; padding: 12px; font-size: 15px; }
}

@media (max-width: 480px) {
  .file-grid { grid-template-columns: repeat(2, 1fr); }
  .dir-grid { grid-template-columns: repeat(2, 1fr); }
  .file-table tbody tr { padding: 10px 6px; }
  .file-name .fi-name { font-size: 13px; }
}

/* ===== Footer ===== */
.site-footer {
  position: fixed; left: 0; right: 0; bottom: 0;
  min-height: 44px; display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 4px 10px; row-gap: 4px;
  background: var(--bg-white); border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary); padding: 8px 16px; z-index: 200;
}
.site-footer .footer-brand { font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.site-footer .footer-sep { color: var(--text-dim); white-space: nowrap; }
.site-footer span { white-space: nowrap; }
.site-footer a { color: var(--primary); text-decoration: none; font-weight: 500; white-space: nowrap; }
.site-footer a:hover { text-decoration: underline; }
