* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --border: #e6eaf1;
  --text: #1a2233;
  --muted: #8b95a5;
  --primary: #4f6ef7;
  --primary-2: #7c5cf6;
  --primary-dim: rgba(79, 110, 247, .09);
  --danger: #e5484d;
  --danger-dim: rgba(229, 72, 77, .1);
  --ok: #18a058;
  --ok-dim: rgba(24, 160, 88, .12);
  --warn: #c07b1a;
  --warn-dim: rgba(217, 155, 42, .15);
  --shadow: 0 1px 2px rgba(20, 30, 60, .05), 0 8px 24px rgba(20, 30, 60, .06);
  --shadow-lg: 0 24px 64px rgba(15, 20, 40, .22);
  --radius: 12px;
}
:root[data-theme="dark"] {
  --bg: #0e1116;
  --panel: #161a21;
  --panel-2: #1c212b;
  --border: #262d3a;
  --text: #e7ebf2;
  --muted: #7e8899;
  --primary: #6d84ff;
  --primary-2: #9a7bff;
  --primary-dim: rgba(109, 132, 255, .13);
  --danger: #f2555a;
  --danger-dim: rgba(242, 85, 90, .14);
  --ok: #3dd68c;
  --ok-dim: rgba(61, 214, 140, .13);
  --warn: #e0a03f;
  --warn-dim: rgba(224, 160, 63, .15);
  --shadow: none;
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .5);
}

html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  min-height: 100vh; transition: background .25s, color .25s;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 22px; height: 58px; position: sticky; top: 0; z-index: 10;
}
.logo { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; cursor: pointer; white-space: nowrap; letter-spacing: .2px; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 4px 12px rgba(79, 110, 247, .35);
}
.logo-mark svg { width: 17px; height: 17px; }
.searchbox { flex: 1; max-width: 400px; position: relative; }
.searchbox svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.searchbox input {
  width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--panel-2); outline: none; font-size: 13px;
  color: var(--text); transition: border .15s, background .15s, box-shadow .15s;
}
.searchbox input:focus { border-color: var(--primary); background: var(--panel); box-shadow: 0 0 0 3px var(--primary-dim); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.usage { display: flex; align-items: center; gap: 8px; }
.usage-bar { width: 88px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.usage-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 3px; transition: width .4s; }
.usage-fill.warn { background: var(--danger); }
.usage-text { font-size: 12px; color: var(--muted); white-space: nowrap; }
.username { font-weight: 600; }
.userbadge {
  font-size: 11px; color: var(--primary); background: var(--primary-dim);
  border-radius: 5px; padding: 1px 6px; margin-left: 5px; font-weight: 500;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 15px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel); color: var(--text); font-size: 13px; cursor: pointer;
  text-decoration: none; font-family: inherit; line-height: 1.4;
  transition: border .15s, color .15s, background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: scale(.97); }
.btn svg { width: 15px; height: 15px; }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border: none; color: #fff; box-shadow: 0 4px 14px rgba(79, 110, 247, .3);
}
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-dim); }
.btn.mini { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--primary-dim); }
select.btn { appearance: auto; padding-right: 8px; }
.iconbtn {
  border: none; background: none; cursor: pointer; color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; transition: background .12s, color .12s;
}
.iconbtn svg { width: 16px; height: 16px; }
.iconbtn:hover { background: var(--primary-dim); color: var(--primary); }
.iconbtn.danger:hover { background: var(--danger-dim); color: var(--danger); }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 2px; padding: 14px 22px 0; max-width: 1140px; margin: 0 auto; }
.tab {
  border: none; background: none; padding: 9px 16px; font-size: 14px; cursor: pointer;
  color: var(--muted); border-radius: 9px; font-family: inherit; font-weight: 500;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); background: var(--primary-dim); }
.tab.active { color: var(--primary); font-weight: 600; background: var(--primary-dim); }

main {
  max-width: 1140px; margin: 12px auto 60px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; min-height: 62vh; box-shadow: var(--shadow);
}
main h3 { margin: 26px 0 12px; font-size: 15px; }
main h3:first-child { margin-top: 4px; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 12px; }

/* ---------- 面包屑 ---------- */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 8px 0 12px; font-size: 13px; color: var(--muted); }
.breadcrumb a { color: var(--text); text-decoration: none; padding: 3px 8px; border-radius: 7px; cursor: pointer; font-weight: 500; transition: background .12s, color .12s; }
.breadcrumb a:hover { background: var(--primary-dim); color: var(--primary); }
.breadcrumb .sep { color: var(--muted); opacity: .5; }

/* ---------- 文件列表 ---------- */
.filelist { width: 100%; border-collapse: collapse; }
.filelist th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 500;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
  user-select: none;
}
.filelist th.sortable { cursor: pointer; }
.filelist th.sortable:hover { color: var(--primary); }
.filelist th .arrow { font-size: 9px; margin-left: 3px; }
.filelist td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.filelist tbody tr { transition: background .1s; }
.filelist tbody tr:hover { background: var(--panel-2); }
.filelist tr:last-child td { border-bottom: none; }
.col-check { width: 34px; }
.col-size { width: 90px; }
.col-access { width: 118px; }
.col-dl { width: 84px; }
.col-time { width: 150px; }
.col-ops { width: 218px; text-align: right; }
.fname {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text);
  max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500;
}
.fname:hover { color: var(--primary); }
.ficon { width: 26px; height: 26px; flex-shrink: 0; display: inline-flex; }
.ficon svg { width: 26px; height: 26px; }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-weight: 500;
}
.badge.public { background: var(--ok-dim); color: var(--ok); }
.badge.login { background: var(--warn-dim); color: var(--warn); }
.badge.private { background: var(--danger-dim); color: var(--danger); }
.badge.inherit { opacity: .6; }
.badge.limit { background: var(--primary-dim); color: var(--primary); margin-left: 4px; }
.ops { text-align: right; white-space: nowrap; }
@media (hover: hover) {
  .filelist .ops .iconbtn { opacity: 0; transition: opacity .12s, background .12s, color .12s; }
  .filelist tr:hover .ops .iconbtn { opacity: 1; }
}
.muted { color: var(--muted); font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 70px 0 60px; }
.empty svg { width: 52px; height: 52px; opacity: .35; margin-bottom: 12px; }
.empty p { font-size: 13.5px; }
.statusbar { padding: 10px 4px 2px; font-size: 12px; color: var(--muted); }

/* ---------- 拖拽上传 ---------- */
.dropzone { position: relative; border-radius: var(--radius); }
.dropzone .drop-hint {
  display: none; position: absolute; inset: -4px; z-index: 5;
  border: 2px dashed var(--primary); border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  backdrop-filter: blur(2px);
  align-items: center; justify-content: center;
  color: var(--primary); font-size: 15px; font-weight: 600; pointer-events: none;
}
.dropzone.dragover .drop-hint { display: flex; }

/* ---------- 上传进度 ---------- */
#uploadProgress { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.up-item {
  display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 9px;
}
.up-item .up-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.up-item .up-bar { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.up-item .up-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); width: 0; transition: width .2s; border-radius: 3px; }
.up-item.done .up-fill { background: var(--ok); }
.up-item.error .up-fill { background: var(--danger); }
.up-item .up-status { min-width: 40px; text-align: right; }

/* ---------- 统计卡片 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  background: var(--panel-2); transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .num { font-size: 19px; font-weight: 700; margin-top: 4px; letter-spacing: .2px; }
.stat-card .lbl { font-size: 12px; color: var(--muted); }

/* ---------- 对话框 ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 16px; padding: 0;
  box-shadow: var(--shadow-lg); min-width: 360px; max-width: 92vw;
  background: var(--panel); color: var(--text);
}
dialog[open] { animation: dlg-pop .18s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes dlg-pop { from { opacity: 0; transform: scale(.94) translateY(8px); } }
dialog::backdrop { background: rgba(10, 14, 24, .45); backdrop-filter: blur(3px); }
.dlg-form { padding: 22px 24px; display: flex; flex-direction: column; gap: 13px; }
.dlg-form h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.dlg-form input, .dlg-form select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; outline: none; width: 100%; background: var(--panel-2);
  color: var(--text); font-family: inherit; transition: border .15s, box-shadow .15s;
}
.dlg-form input:focus, .dlg-form select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.radio {
  display: flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px;
  transition: border .12s, background .12s;
}
.radio:hover { border-color: var(--primary); background: var(--primary-dim); }
.radio input { width: auto; accent-color: var(--primary); }
.movelist { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.movelist .mv-item { padding: 9px 13px; cursor: pointer; display: flex; gap: 9px; align-items: center; font-weight: 500; }
.movelist .mv-item:hover { background: var(--primary-dim); color: var(--primary); }
.movelist .mv-item .ficon, .movelist .mv-item .ficon svg { width: 20px; height: 20px; }

/* ---------- 预览 ---------- */
.preview-overlay { position: fixed; inset: 0; background: rgba(10, 12, 18, .93); z-index: 100; display: flex; flex-direction: column; animation: fade-in .15s; }
@keyframes fade-in { from { opacity: 0; } }
.preview-top { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: #fff; }
.preview-top .btn { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; }
.preview-top .btn:hover { background: rgba(255,255,255,.2); }
.preview-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 0 20px 20px; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.preview-body iframe { width: 92vw; height: 100%; border: none; background: #fff; border-radius: 8px; }
.preview-body pre {
  background: var(--panel); color: var(--text); padding: 22px; border-radius: 10px;
  max-width: 92vw; max-height: 100%; overflow: auto; font-size: 13px; white-space: pre-wrap;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.preview-body audio { width: 480px; max-width: 90vw; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%);
  background: #202633; color: #fff; padding: 10px 22px; border-radius: 999px;
  font-size: 13px; z-index: 200; box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  animation: toast-up .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes toast-up { from { opacity: 0; transform: translate(-50%, 14px); } }
.toast.error { background: var(--danger); }

/* ---------- 分享落地页 ---------- */
.share-page { max-width: 620px; margin: 7vh auto; padding: 0 16px; }
.share-brand { display: flex; align-items: center; justify-content: center; gap: 9px; font-weight: 700; font-size: 15px; margin-bottom: 18px; color: var(--muted); }
.share-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  padding: 32px; text-align: center; box-shadow: var(--shadow);
}
.share-card .bigicon { display: flex; justify-content: center; }
.share-card .bigicon svg { width: 64px; height: 64px; }
.share-card h2 { margin: 14px 0 6px; font-size: 18px; word-break: break-all; }
.share-card .meta { color: var(--muted); font-size: 13px; margin-bottom: 20px; line-height: 1.7; }
.share-card input {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  width: 220px; text-align: center; font-size: 15px; outline: none;
  background: var(--panel-2); color: var(--text); letter-spacing: 2px;
}
.share-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.share-list { text-align: left; margin-top: 16px; }
.share-actions { display: flex; gap: 10px; justify-content: center; }

@media (max-width: 720px) {
  .usage, .col-time, .col-dl { display: none; }
  .col-ops { width: auto; }
  main { border-radius: 0; border-left: none; border-right: none; margin-top: 0; }
  .tabs { padding-top: 8px; }
  .fname { max-width: 46vw; }
}
