/* ============================================================
   在线文件管理系统 — 样式（无框架，纯 CSS）
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --warn: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow: 0 4px 12px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
  --topbar-h: 58px;
  --sidebar-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #131c31;
    --surface-2: #18223a;
    --surface-3: #1e2942;
    --border: #26324c;
    --border-strong: #37456a;
    --text: #e8edf7;
    --text-2: #b3c0d6;
    --muted: #7c8aa5;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-soft: #1e3a8a;
    --danger: #f87171;
    --danger-soft: #431417;
    --success: #4ade80;
    --warn: #fbbf24;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 4px 12px rgba(0, 0, 0, .35);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

/* 关键兜底：类选择器里的 display 会覆盖浏览器默认的 [hidden]{display:none}，
   而前端大量依赖 hidden 属性控制显隐，这里统一保证它一定生效。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

.muted { color: var(--muted); font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }

.ico {
  width: 20px; height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 32px; height: 32px; }

/* ---------------------------------------------------------- 基础控件 */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .06s, opacity .15s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; font-size: 15px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  padding: 0;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on { color: var(--primary); background: var(--primary-soft); }

.select, input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="datetime-local"] {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.select { width: auto; cursor: pointer; }
input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
input::placeholder { color: var(--muted); }

.badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
}
.badge.ok { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.badge.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.badge.admin { background: var(--primary-soft); color: var(--primary); }

.link-btn {
  background: none; border: 0; padding: 0 2px;
  font: inherit; font-size: inherit; color: var(--primary);
  cursor: pointer; text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------------- 登录页 */

.auth-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}
.auth-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(1000px 500px at 12% -10%, color-mix(in srgb, var(--primary) 26%, transparent), transparent 60%),
    radial-gradient(900px 500px at 92% 110%, color-mix(in srgb, #8b5cf6 24%, transparent), transparent 62%),
    var(--bg);
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 396px;
  padding: 32px 30px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo {
  width: 54px; height: 54px;
  margin: 0 auto 12px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.auth-logo .ico { width: 28px; height: 28px; }
.auth-brand h1 { font-size: 21px; letter-spacing: .3px; }
.auth-brand p { color: var(--muted); font-size: 13px; margin-top: 4px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; padding: 6px; cursor: pointer; color: var(--muted);
  display: grid; place-items: center; border-radius: 6px;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-3); }

.auth-error, .auth-notice {
  padding: 9px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  display: flex; gap: 8px; align-items: flex-start;
}
.auth-error { color: var(--danger); background: var(--danger-soft); }
.auth-notice { color: var(--primary); background: var(--primary-soft); }
.auth-switch { margin-top: 16px; text-align: center; font-size: 13.5px; color: var(--text-2); }
.auth-foot {
  margin-top: 20px; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11.5px; color: var(--muted);
}

/* ---------------------------------------------------------- 应用骨架 */

.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}
.menu-toggle { display: none; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; white-space: nowrap; }
.brand-ico { color: var(--primary); }

.search-wrap {
  flex: 1;
  max-width: 460px;
  display: flex; align-items: center; gap: 7px;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}
.search-wrap input {
  flex: 1; border: 0; background: transparent; padding: 7px 0; font-size: 13.5px;
  box-shadow: none !important;
}
.search-wrap input::-webkit-search-cancel-button { display: none; }
.ico-clear { width: 24px; height: 24px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px;
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  font: inherit; color: var(--text); cursor: pointer;
}
.user-btn:hover { background: var(--surface-3); }
.avatar {
  width: 30px; height: 30px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 50%;
}
.user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 258px; padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}
.dropdown-head { padding: 6px 8px 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dropdown-head strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.dropdown-quota { padding: 2px 8px 8px; font-size: 12px; color: var(--muted); }
.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px;
  background: none; border: 0; border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; color: var(--text); text-align: left; cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-3); }
.dropdown-item.danger { color: var(--danger); }

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

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 auto;
  display: flex; flex-direction: column;
  padding: 12px 10px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  background: none; border: 0; border-radius: var(--radius-sm);
  font: inherit; font-size: 13.8px; font-weight: 500; color: var(--text-2);
  cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ico { width: 18px; height: 18px; }

.quota-card {
  margin-top: auto;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px; color: var(--text-2);
}
.quota-card .q-row { display: flex; justify-content: space-between; margin-bottom: 6px; }
.quota-card .q-bar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.quota-card .q-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #7c3aed); border-radius: 999px; transition: width .3s; }
.sidebar-foot { padding: 10px 4px 2px; font-size: 11px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.panel { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0; }

/* ---------------------------------------------------------- 工具栏 */

.toolbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.toolbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-width: 0; }
.crumb {
  display: inline-flex; align-items: center; gap: 5px;
  max-width: 220px;
  padding: 4px 8px;
  background: none; border: 0; border-radius: 6px;
  font: inherit; font-size: 13.5px; color: var(--text-2);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumb:hover { background: var(--surface-3); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.crumb.current:hover { background: none; }
.crumb-sep { color: var(--muted); display: inline-flex; }

.selection-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px; font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.selection-bar .btn { color: var(--text); background: var(--surface); }

/* ---------------------------------------------------------- 文件列表 */

.list-wrap { flex: 1; overflow-y: auto; position: relative; }

.list-head {
  display: grid;
  grid-template-columns: 40px minmax(180px, 1fr) 100px 168px 120px 110px;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
}
.file-list { padding-bottom: 40px; }

.file-row {
  display: grid;
  grid-template-columns: 40px minmax(180px, 1fr) 100px 168px 120px 110px;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  cursor: default;
  transition: background .1s;
}
.file-row:hover { background: var(--surface-2); }
.file-row.selected { background: var(--primary-soft); }
.file-row.drop-target { background: var(--primary-soft); outline: 2px dashed var(--primary); outline-offset: -2px; }

.col-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.col-size, .col-time, .col-owner { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-act { display: flex; justify-content: flex-end; gap: 2px; }
.col-act .icon-btn { width: 28px; height: 28px; opacity: 0; }
.file-row:hover .col-act .icon-btn, .file-row.selected .col-act .icon-btn { opacity: 1; }

.fname {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13.6px; cursor: pointer;
}
.fname:hover { color: var(--primary); text-decoration: underline; }
.fthumb {
  width: 24px; height: 24px; flex: 0 0 auto;
  display: grid; place-items: center;
  color: var(--text-2);
}
.fthumb .ico { width: 21px; height: 21px; }
.fthumb img { width: 24px; height: 24px; object-fit: cover; border-radius: 4px; }
.k-folder { color: #f59e0b; }
.k-image { color: #8b5cf6; }
.k-video { color: #ec4899; }
.k-audio { color: #06b6d4; }
.k-pdf { color: #ef4444; }
.k-archive { color: #a16207; }
.k-code, .k-text { color: #0ea5e9; }
.k-html { color: #f97316; }

.cb { display: grid; place-items: center; }
.cb input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.empty, .loading {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-ico { width: 58px; height: 58px; color: var(--border-strong); margin-bottom: 10px; }
.empty h3 { color: var(--text-2); margin-bottom: 4px; }
.empty p { font-size: 13px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.upload-hint {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 7px;
  padding: 8px 18px;
  font-size: 12px; color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* 网格视图 */
.file-list.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
  padding: 16px 18px 60px;
}
.file-list.grid .file-row {
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
}
.file-list.grid .file-row:hover { box-shadow: var(--shadow); }
.file-list.grid .cb { position: absolute; top: 8px; left: 8px; z-index: 2; }
.file-list.grid .col-size, .file-list.grid .col-time, .file-list.grid .col-owner { display: none; }
.file-list.grid .col-name { flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.file-list.grid .fthumb { width: 100%; height: 78px; }
.file-list.grid .fthumb .ico { width: 52px; height: 52px; }
.file-list.grid .fthumb img { width: 100%; height: 78px; border-radius: 8px; }
.file-list.grid .fname { width: 100%; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; }
.file-list.grid .col-act { justify-content: center; }
.file-list.grid .col-act .icon-btn { opacity: 1; }
.file-list.grid .grid-meta { font-size: 11.5px; color: var(--muted); }
#list-wrap.grid .list-head { display: none; }

/* ---------------------------------------------------------- 分享 / 管理面板 */

.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.shares-list { padding: 14px 18px 60px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }

.share-card {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.share-card .sc-main { flex: 1; min-width: 0; }
.share-card .sc-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.share-card .sc-url {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 3px; cursor: pointer;
}
.share-card .sc-url:hover { color: var(--primary); }
.share-card .sc-meta { display: flex; gap: 12px; margin-top: 5px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.share-card .sc-actions { display: flex; gap: 6px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; padding: 16px 18px;
}
.stat-card {
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat-card .sv { font-size: 21px; font-weight: 700; letter-spacing: -.4px; }
.stat-card .sl { font-size: 12px; color: var(--muted); margin-top: 2px; }

.table-wrap { flex: 1; overflow: auto; padding: 0 18px 60px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 10px 12px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.table td { padding: 10px 12px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.table tr:hover td { background: var(--surface-2); }
.table .act { text-align: right; white-space: nowrap; }
.table .act .icon-btn { width: 30px; height: 30px; }
.quota-inline { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.quota-inline .q-bar { height: 5px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.quota-inline .q-fill { height: 100%; background: var(--primary); }
.quota-inline .q-fill.hot { background: var(--danger); }

.grid-meta { display: none; font-size: 11.5px; color: var(--muted); text-align: center; }
.file-list.grid .grid-meta { display: block; }
.ico-placeholder { display: inline-grid; place-items: center; width: 24px; height: 24px; color: var(--text-2); }

/* ---------------------------------------------------------- 拖拽遮罩 */

.drop-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 12%, rgba(15, 23, 42, .45));
  backdrop-filter: blur(3px);
}
.drop-box {
  padding: 34px 54px;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  border: 2px dashed var(--primary);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.drop-box h3 { margin: 10px 0 4px; font-size: 17px; }
.drop-box p { color: var(--muted); font-size: 13px; }
.drop-ico { width: 46px; height: 46px; color: var(--primary); }

/* ---------------------------------------------------------- 上传面板 */

.upload-panel {
  position: fixed; right: 18px; bottom: 18px; z-index: 150;
  width: min(410px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: min(58vh, 460px);
}
.upload-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.upload-list { overflow-y: auto; padding: 6px; }
.upload-panel.min .upload-list, .upload-panel.min .upload-head .muted { display: none; }
.upload-panel.min { max-height: none; }
.upload-panel.min #upload-min .ico { transform: rotate(180deg); }

.up-item { padding: 9px 10px; border-radius: var(--radius-sm); }
.up-item:hover { background: var(--surface-2); }
.up-top { display: flex; align-items: center; gap: 8px; }
.up-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-stat { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.up-bar { height: 4px; margin-top: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.up-fill { height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .2s; }
.up-fill.done { background: var(--success); }
.up-fill.err { background: var(--danger); }
.up-fill.paused { background: var(--warn); }
.up-actions { display: flex; gap: 2px; }
.up-actions .icon-btn { width: 26px; height: 26px; }
.up-err { font-size: 11.5px; color: var(--danger); margin-top: 3px; }

/* ---------------------------------------------------------- Toast */

.toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 400;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 16px;
  min-width: 220px; max-width: min(560px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  animation: toast-in .22s ease-out;
  pointer-events: auto;
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast .ico { color: var(--primary); }
.toast.ok .ico { color: var(--success); }
.toast.err .ico { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------- 弹窗 */

.modal-root { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(2px);
  pointer-events: auto;
  animation: fade-in .16s ease-out;
  overflow-y: auto;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: modal-in .2s cubic-bezier(.2, .8, .3, 1);
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
}
.modal.wide { max-width: 620px; }
.modal.xwide { max-width: min(1000px, 96vw); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15.5px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 16px 16px;
}
.modal-foot.between { justify-content: space-between; }
.form-row { margin-bottom: 13px; }
.form-row > label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.hint { margin-top: 5px; font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--primary); }

/* 预览 */
.preview-body {
  display: grid; place-items: center;
  min-height: 240px;
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow: auto;
  padding: 8px;
}
.preview-body img, .preview-body video { max-width: 100%; max-height: 68vh; border-radius: 8px; }
.preview-body audio { width: 100%; max-width: 560px; }
.preview-body iframe { width: 100%; height: 68vh; border: 0; background: #fff; border-radius: 8px; }
.preview-body pre {
  margin: 0; width: 100%; max-height: 66vh; overflow: auto;
  padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4;
}
.preview-none { text-align: center; color: var(--muted); padding: 40px 20px; }
.preview-none .ico { width: 46px; height: 46px; margin-bottom: 10px; color: var(--border-strong); }

/* 文件选择器 / 移动 */
.picker { border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 300px; overflow-y: auto; }
.picker-path { padding: 8px 12px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); font-family: var(--mono); }
.picker-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 12px;
  background: none; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  font: inherit; font-size: 13.5px; color: var(--text); text-align: left; cursor: pointer;
}
.picker-item:hover { background: var(--surface-2); }
.picker-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }

/* 上下文菜单 */
.ctx-menu {
  position: fixed; z-index: 500;
  min-width: 182px; padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}
.ctx-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 10px;
  background: none; border: 0; border-radius: 6px;
  font: inherit; font-size: 13.5px; color: var(--text); text-align: left; cursor: pointer;
}
.ctx-item:hover { background: var(--surface-3); }
.ctx-item.danger { color: var(--danger); }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--border); }

/* ---------------------------------------------------------- 响应式 */

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 40;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .list-head, .file-row { grid-template-columns: 36px minmax(120px, 1fr) 80px 92px; }
  .col-owner, .col-time { display: none; }
  .list-head .col-owner, .list-head .col-time { display: none; }
  .user-name { display: none; }
  .search-wrap { max-width: none; }
}
@media (max-width: 620px) {
  .toolbar { padding: 10px 12px; }
  .toolbar-actions .btn span { display: none; }
  .list-head, .file-row { padding-left: 12px; padding-right: 12px; }
  .brand span { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .upload-panel { right: 8px; bottom: 8px; }
}
