:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e5e8ec;
  --border-strong: #d5dae1;
  --text: #1f2328;
  --text-2: #5b6472;
  --text-3: #8b94a3;
  --brand: #2563eb;
  --brand-weak: #eaf1ff;
  --brand-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-weak: #fee9e9;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 32px rgba(16, 24, 40, .14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }

.hidden { display: none !important; }

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #e8efff 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 36px 32px;
}
.login-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.login-logo svg { width: 30px; height: 30px; }
.login-sub { color: var(--text-2); font-size: 13px; margin-bottom: 24px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 13px; transition: .15s;
}
.btn:hover { background: var(--brand-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; padding: 11px; font-size: 14px; }
.btn-ghost { background: #fff; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: #f2f4f7; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin: 4px 0 18px; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--brand); }
.login-tip { margin-top: 18px; font-size: 12px; color: var(--text-3); text-align: center; line-height: 1.7; }

/* ============ 主布局 ============ */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 232px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px; font-weight: 700; font-size: 15px; }
.brand svg { width: 26px; height: 26px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; transition: .12s; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: #f2f4f7; color: var(--text); }
.nav-item.active { background: var(--brand-weak); color: var(--brand); font-weight: 600; }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item .cnt { margin-left: auto; font-size: 11px; color: var(--text-3); font-weight: 500; }
.nav-sep { height: 1px; background: var(--border); margin: 10px 6px; }
.nav-title { font-size: 11px; font-weight: 700; color: var(--text-3); padding: 6px 10px; letter-spacing: .4px; }

.usage { margin-top: auto; padding: 12px; background: #f7f8fa; border-radius: var(--radius); border: 1px solid var(--border); }
.usage-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-2); margin-bottom: 7px; }
.usage-bar { height: 6px; background: #e5e8ec; border-radius: 99px; overflow: hidden; }
.usage-bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.usage-note { font-size: 10px; color: var(--text-3); margin-top: 7px; }

/* ============ 主区 ============ */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; flex-shrink: 0; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
}
.search-box { position: relative; flex: 1; max-width: 460px; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.search-box input {
  width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--border-strong); border-radius: 99px;
  background: #f7f8fa; outline: none; font-size: 13px;
}
.search-box input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 99px;
  background: #f2f4f7; font-size: 12px; font-weight: 600; color: var(--text-2);
}
.avatar { width: 24px; height: 24px; border-radius: 99px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.icon-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: #fff; color: var(--text-2);
}
.icon-btn:hover { background: #f2f4f7; color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

.content { flex: 1; overflow: auto; padding: 18px 20px 40px; }

.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); margin-bottom: 12px; flex-wrap: wrap; }
.crumbs button { background: none; border: none; color: var(--brand); padding: 2px 4px; border-radius: 4px; font-size: 13px; }
.crumbs button:hover { background: var(--brand-weak); }
.crumbs .cur { color: var(--text); font-weight: 600; }

/* ============ 拖拽上传区 ============ */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--panel);
  padding: 22px; text-align: center; margin-bottom: 16px; transition: .15s;
}
.dropzone.hot { border-color: var(--brand); background: var(--brand-weak); }
.dropzone .dz-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.dropzone .dz-sub { font-size: 12px; color: var(--text-3); }
.dropzone svg { width: 30px; height: 30px; color: var(--brand); margin-bottom: 8px; }

.progress-list { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.progress-row { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; }
.progress-row .pr-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; gap: 12px; }
.progress-row .pr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.progress-row .pr-pct { color: var(--brand); font-weight: 600; flex-shrink: 0; }
.progress-row .pr-bar { height: 5px; background: #eceff3; border-radius: 99px; overflow: hidden; }
.progress-row .pr-bar > i { display: block; height: 100%; background: var(--brand); transition: width .2s; }
.progress-row.error .pr-pct { color: var(--danger); }
.progress-row.error .pr-bar > i { background: var(--danger); }

/* ============ 工具条 ============ */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .sel { font-size: 13px; color: var(--text-2); }
.toolbar .sel b { color: var(--brand); }
.seg { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.seg button { border: none; background: #fff; padding: 6px 10px; font-size: 12px; color: var(--text-2); display: flex; align-items: center; }
.seg button.active { background: var(--brand-weak); color: var(--brand); font-weight: 600; }
.seg button svg { width: 15px; height: 15px; }
select.mini {
  padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; font-size: 12px; color: var(--text-2); outline: none;
}

/* ============ 文件网格 ============ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; position: relative; transition: .15s; cursor: default;
}
.card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.card.selected { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(37, 99, 235, .18); }
.card-thumb {
  height: 92px; border-radius: var(--radius-sm); background: #f4f6f9; display: flex;
  align-items: center; justify-content: center; margin-bottom: 10px; overflow: hidden; position: relative;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb svg { width: 34px; height: 34px; }
.card-name { font-size: 13px; font-weight: 600; line-height: 1.35; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px; }
.card-meta { font-size: 11px; color: var(--text-3); margin-top: 5px; display: flex; justify-content: space-between; gap: 6px; }
.card-check { position: absolute; top: 8px; left: 8px; width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; opacity: 0; transition: .12s; }
.card:hover .card-check, .card.selected .card-check { opacity: 1; }
.card-actions {
  position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: .12s;
}
.card:hover .card-actions { opacity: 1; }
.chip {
  width: 26px; height: 26px; border-radius: 6px; background: rgba(255,255,255,.94); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--text-2); backdrop-filter: blur(4px);
}
.chip:hover { background: #fff; color: var(--brand); border-color: var(--brand); }
.chip.danger:hover { color: var(--danger); border-color: var(--danger); }
.chip svg { width: 14px; height: 14px; }
.badge-share {
  position: absolute; bottom: 8px; left: 8px; font-size: 10px; background: rgba(22,163,74,.12);
  color: var(--ok); padding: 2px 6px; border-radius: 99px; font-weight: 600;
}
.badge-trash { position: absolute; bottom: 8px; left: 8px; font-size: 10px; background: rgba(220,38,38,.1); color: var(--danger); padding: 2px 6px; border-radius: 99px; font-weight: 600; }

/* ============ 列表视图 ============ */
.table { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.trow { display: grid; grid-template-columns: 26px 1fr 110px 92px 130px 118px; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.trow:last-child { border-bottom: none; }
.trow:hover { background: #fafbfc; }
.trow.head { background: #f7f8fa; font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: .3px; }
.trow.selected { background: var(--brand-weak); }
.trow .tname { display: flex; align-items: center; gap: 9px; min-width: 0; }
.trow .tname svg { width: 18px; height: 18px; flex-shrink: 0; }
.trow .tname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.trow .tmuted { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .tact { display: flex; gap: 5px; justify-content: flex-end; }

.folder-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.folder-card .card-thumb { background: #fff8e6; }

/* ============ 空状态 ============ */
.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .5; }
.empty .e-title { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }

/* ============ 弹窗 ============ */
.mask { position: fixed; inset: 0; background: rgba(16,24,40,.5); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 24px; }
.modal { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; overflow: hidden; max-height: 88vh; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; gap: 12px; }
.modal-head .mh-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: #fafbfc; }
.modal-body .pv-img { max-width: 100%; max-height: 62vh; display: block; margin: 0 auto; border-radius: var(--radius-sm); }
.modal-body iframe { width: 100%; height: 62vh; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.modal-body pre { margin: 0; padding: 14px; background: #f7f8fa; border-radius: var(--radius-sm); overflow: auto; max-height: 56vh; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.modal-body video, .modal-body audio { width: 100%; border-radius: var(--radius-sm); }
.modal-md { max-width: 460px; }
.row-form { display: flex; flex-direction: column; gap: 12px; }
.share-link-box { display: flex; gap: 8px; }
.share-link-box input { flex: 1; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #f7f8fa; font-size: 12px; outline: none; }
.hint { font-size: 12px; color: var(--text-3); line-height: 1.7; }
.warn-box { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.6; }

/* ============ Toast ============ */
#toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1f2328; color: #fff; padding: 9px 18px; border-radius: 99px; font-size: 13px;
  box-shadow: var(--shadow-lg); animation: rise .22s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.banner {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: var(--radius);
  padding: 10px 14px; font-size: 12.5px; margin-bottom: 14px; display: flex; gap: 8px; align-items: center;
}
.banner svg { width: 16px; height: 16px; flex-shrink: 0; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .trow { grid-template-columns: 26px 1fr 92px; }
  .trow .hide-sm { display: none; }
}
