:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --text: #101828;
  --muted: #667085;
  --soft: #98a2b3;
  --line: #eef1f6;
  --line-2: #e4e9f2;
  --accent: #2f6bff;
  --accent-2: #22c7dc;
  --accent-soft: #eef3ff;
  --danger: #d92d20;
  --radius: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-sm: 0 2px 8px rgba(16, 24, 40, .06);
  --shadow-md: 0 12px 32px rgba(16, 24, 40, .10);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, .18);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
input, button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.svg { width: 18px; height: 18px; flex: 0 0 18px; }

/* 启动 */
.boot { position: fixed; inset: 0; display: grid; place-content: center; gap: 18px; justify-items: center; background: var(--bg); z-index: 100; }
.boot-logo { font-size: 24px; font-weight: 700; letter-spacing: 8px; color: var(--accent); }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid #e7edf7; border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 登录 */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto; background: radial-gradient(820px 480px at 50% -6%, #e9f1ff 0%, rgba(247, 249, 252, 0) 60%), var(--bg); }
.auth-card { width: min(392px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 34px 30px 26px; box-shadow: var(--shadow-md); }
.brand-lg { display: flex; align-items: center; justify-content: center; gap: 10px; }
.brand-lg img { width: 36px; height: 36px; border-radius: 11px; }
.logo-mark { font-weight: 700; letter-spacing: 3px; font-size: 20px; color: var(--text); }
.auth-tagline { text-align: center; margin: 12px 0 24px; font-size: 13px; color: var(--muted); }
.tabs { display: flex; background: #f4f6fa; border-radius: 12px; padding: 4px; margin-bottom: 20px; }
.tab { flex: 1; padding: 9px; border: 0; background: transparent; border-radius: 9px; color: var(--muted); font-size: 13.5px; transition: all .18s; }
.tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow-xs); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.input { width: 100%; padding: 11px 13px; background: #fff; border: 1px solid var(--line-2); border-radius: 11px; outline: none; transition: border-color .16s, box-shadow .16s; }
.input::placeholder { color: #b3bccd; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 107, 255, .12); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 14px; border-radius: 11px; border: 1px solid transparent; background: #fff; color: var(--text); font-weight: 600; font-size: 13.5px; transition: background .15s, border-color .15s, transform .06s, box-shadow .15s; }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(47, 107, 255, .28); }
.btn.primary:hover { background: #2559e0; }
.btn.ghost { border-color: var(--line-2); background: #fff; color: #344054; }
.btn.ghost:hover { background: #f7f9fc; border-color: #d6def0; }
.btn.danger { background: #fff1f0; color: var(--danger); border-color: #ffd9d5; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; margin-top: 6px; padding: 12px; }
.btn.big { padding: 14px 18px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.form-error { color: var(--danger); font-size: 12.5px; min-height: 18px; margin: 10px 0 0; text-align: center; }

/* 框架 */
.app { display: flex; height: 100%; }
.sidebar { width: 246px; flex: 0 0 246px; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px 14px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 16px; }
.brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 2px 8px rgba(47, 107, 255, .22); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 16px; letter-spacing: 2px; }
.brand-text span { font-size: 11px; color: var(--soft); }
.upload-btn { width: 100%; height: 42px; margin-bottom: 16px; font-size: 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 12px; border: 0; background: transparent; border-radius: 10px; color: #5a6478; text-align: left; font-size: 14px; transition: background .15s, color .15s; }
.nav-item:hover { background: #f5f7fb; color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .svg { color: inherit; }
.badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; font-style: normal; }
.storage { margin-top: auto; background: #f8fafd; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; }
.storage-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 9px; }
.storage-head b { font-weight: 600; color: #344054; font-size: 12px; }
.meter { height: 6px; background: #e9eef7; border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .45s ease; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; padding: 0 24px; background: rgba(255, 255, 255, .86); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--line); flex: 0 0 64px; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar h1 { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: .2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; display: inline-grid; place-items: center; color: #475467; transition: background .15s; }
.icon-btn:hover { background: #f7f9fc; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: linear-gradient(135deg, #2f6bff, #22c7dc); color: #fff; font-weight: 650; font-size: 13px; }
.search { position: relative; }
.search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #98a2b3; pointer-events: none; }
.search-input { width: 240px; padding: 8px 12px 8px 32px; font-size: 13px; border-radius: 999px; background: #f5f7fb; border-color: transparent; }
.search-input:focus { background: #fff; border-color: var(--accent); }

.view { flex: 1; overflow: auto; }
.content { max-width: 1120px; margin: 0 auto; padding: 18px 28px 32px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.crumbs button { border: 0; background: none; color: var(--muted); padding: 4px 6px; border-radius: 7px; transition: background .15s, color .15s; }
.crumbs button:hover { color: var(--text); background: #eef1f7; }
.crumbs .sep { opacity: .4; }
.toolbar-actions { display: flex; gap: 8px; }

.dropzone { position: fixed; inset: 0; background: rgba(247, 249, 252, .92); border: 2px dashed var(--accent); display: none; place-items: center; z-index: 60; font-size: 17px; color: var(--accent); }
.dropzone.on { display: grid; }

.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); overflow: hidden; }
.list-head { display: grid; grid-template-columns: 1fr 110px 168px 64px; gap: 10px; align-items: center; padding: 11px 18px; font-size: 12px; color: var(--soft); background: #fbfcfe; border-bottom: 1px solid var(--line); }
.filelist { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 1fr 110px 168px 64px; gap: 10px; align-items: center; min-height: 58px; padding: 8px 18px; border-bottom: 1px solid #f4f6fa; transition: background .14s; }
.row:last-child { border-bottom: 0; }
.row:hover { background: #f9fbfe; }
.row .name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row .name .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.row .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: #f2f6ff; font-size: 17px; flex: 0 0 38px; }
.row .col-size, .row .col-time { font-size: 12.5px; color: var(--muted); }
.row .col-act { display: flex; justify-content: flex-end; gap: 2px; opacity: 0; transition: opacity .15s; }
.row:hover .col-act { opacity: 1; }
.row .mini { border: 0; background: transparent; color: #98a2b3; padding: 6px; border-radius: 8px; font-size: 13px; line-height: 1; transition: background .14s, color .14s; }
.row .mini:hover { background: #eef2f9; color: var(--text); }
.row.dir { cursor: pointer; }
.row.dir .ico { background: #fff7e8; }

.empty { text-align: center; padding: 56px 20px 64px; }
.empty-art { display: grid; place-items: center; margin-bottom: 14px; }
.empty-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.empty .btn { margin-top: 16px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-xs); }
.panel h2 { margin: 0 0 14px; font-size: 15px; font-weight: 650; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fbfcfe; border: 1px solid var(--line); border-radius: 13px; padding: 14px 16px; }
.stat b { display: block; font-size: 21px; font-weight: 700; margin-bottom: 2px; letter-spacing: -.02em; }
.stat span { font-size: 12px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--soft); font-weight: 500; font-size: 12px; }
tr:hover td { background: #fafbfe; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; background: #f2f4f7; color: #475467; }
.tag.ok { background: #e7f7ef; color: #067647; }
.tag.warn { background: #fff4e5; color: #b54708; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.form-row .input { max-width: 190px; }
.section-gap { height: 22px; }

.transfer-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.transfer-item:last-child { border-bottom: 0; }
.transfer-item .meta { flex: 1; min-width: 0; }
.transfer-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.transfer-item .sub { font-size: 11.5px; color: var(--muted); }
.progress { height: 6px; background: #eef1f6; border-radius: 999px; overflow: hidden; margin-top: 7px; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .25s ease; }

.upload-dock { position: fixed; right: 22px; bottom: 22px; width: min(368px, calc(100vw - 44px)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-md); z-index: 70; overflow: hidden; }
.upload-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; background: #fbfcfe; border-bottom: 1px solid var(--line); font-size: 13px; }
.upload-list { max-height: 240px; overflow: auto; padding: 6px 14px 12px; }
.upload-row { font-size: 12.5px; padding: 8px 0; }
.upload-row .t { display: flex; justify-content: space-between; gap: 8px; }
.upload-row .t span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-dock.min .upload-list { display: none; }

.modal-mask { position: fixed; inset: 0; background: rgba(16, 24, 40, .35); display: grid; place-items: center; z-index: 80; padding: 18px; backdrop-filter: blur(2px); animation: fade .16s ease-out; }
@keyframes fade { from { opacity: 0 } }
.modal { width: min(500px, 100%); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 22px; max-height: 86vh; overflow: auto; animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99) } }
.modal h3 { margin: 0 0 14px; font-size: 16px; font-weight: 650; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.preview-box { display: grid; place-items: center; background: #f7f9fc; border-radius: 14px; overflow: hidden; min-height: 200px; }
.preview-box img, .preview-box video { max-width: 100%; max-height: 70vh; display: block; }
.input-inline { display: flex; gap: 8px; }
.toast-root { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(28px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; z-index: 120; pointer-events: none; }
.toast { background: #ffffff; border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow-md); animation: toastin .22s ease-out; }
.toast.err { border-color: #ffd7d9; color: #b42318; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* 分享页 */
.share-body { display: grid; place-items: center; min-height: 100dvh; padding: 22px; background: radial-gradient(820px 520px at 50% -10%, #e9f1ff 0%, rgba(247, 249, 252, 0) 60%), var(--bg); }
.share-card { width: min(400px, 100%); text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 32px 26px; box-shadow: var(--shadow-md); }
.share-logo { font-weight: 700; letter-spacing: 6px; color: var(--accent); margin-bottom: 18px; }
.share-card h1 { font-size: 17px; font-weight: 650; word-break: break-all; margin: 0 0 6px; }
.share-card .btn { margin-top: 16px; }
.share-card .input { margin: 12px 0; text-align: center; }

.mobile-only { display: none; }
.tabbar { display: none; }
@media (max-width: 900px) {
  .sidebar { display: none; }
  .mobile-only { display: inline-grid; }
  .search { display: none; }
  .topbar { height: 56px; flex-basis: 56px; padding: 0 14px; }
  .content { padding: 12px 12px calc(78px + var(--safe-b)); }
  .list-head { grid-template-columns: 1fr 72px 56px; padding: 10px 14px; }
  .list-head .col-time { display: none; }
  .row { grid-template-columns: 1fr 72px 56px; padding: 10px 14px; min-height: 62px; }
  .row .col-time { display: none; }
  .row .col-act { opacity: 1; }
  .row .col-act .mini[data-act="versions"] { display: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); backdrop-filter: blur(12px); z-index: 50; }
  .tabbar-item { flex: 1; border: 0; background: none; color: #98a2b3; display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11px; }
  .tabbar-item span { font-size: 18px; line-height: 1; }
  .tabbar-item.active { color: var(--accent); }
  .upload-dock { right: 10px; left: 10px; bottom: calc(72px + var(--safe-b)); width: auto; }
  .toast-root { bottom: calc(150px + var(--safe-b)); }
}
@media (display-mode: standalone) {
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); height: auto; flex-basis: auto; }
}

/* 文件类型配色 */
.row .ico svg { display: block; }
.ico.file-dir { color: #f59e0b; background: #fff7e8; }
.ico.file-img { color: #7c5cff; background: #f3f0ff; }
.ico.file-video { color: #f0508d; background: #fff0f6; }
.ico.file-audio { color: #f79009; background: #fff6e8; }
.ico.file-pdf { color: #f04438; background: #fff1f0; }
.ico.file-doc { color: #2f6bff; background: #eef3ff; }
.ico.file-sheet { color: #12b76a; background: #eafaf1; }
.ico.file-slide { color: #f97316; background: #fff4e8; }
.ico.file-zip { color: #7a5af8; background: #f4f0ff; }
.ico.file-txt { color: #667085; background: #f4f6fa; }