:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; }
.userbox { display: flex; align-items: center; gap: 10px; }

/* 布局 */
.container { max-width: 1080px; margin: 24px auto; padding: 0 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 17px; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.tools { display: flex; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: 400; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

/* 按钮与输入 */
.btn {
  display: inline-block;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none !important;
  font-family: inherit;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--primary); }
.btn.ghost:hover { background: #eff6ff; }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #fef2f2; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; padding: 10px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }

input[type=text], input[type=password], input[type=search] {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
  font-family: inherit;
}
input:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.tools input[type=search] { width: 220px; }
label { display: block; font-size: 14px; margin-bottom: 12px; }
label input { margin-top: 4px; }
.err-msg { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 4px 0 8px; }

/* 上传区 */
.dropzone {
  border: 2px dashed #c7d2fe;
  border-radius: var(--radius);
  background: #f8faff;
  padding: 28px 16px;
  text-align: center;
  transition: .15s;
}
.dropzone.over { background: #e0e7ff; border-color: var(--primary); }
.dropzone p { margin: 6px 0; }
.dz-icon { font-size: 30px; color: var(--primary); line-height: 1; }

.upload-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.upload-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.upload-item.ok { border-color: #bbf7d0; background: #f0fdf4; }
.upload-item.err { border-color: #fecaca; background: #fef2f2; }
.u-head { display: flex; align-items: center; gap: 10px; }
.u-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.u-size { color: var(--muted); font-size: 13px; white-space: nowrap; }
.bar { height: 8px; background: #e5e7eb; border-radius: 4px; margin: 8px 0 6px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.upload-item.ok .bar-fill { background: var(--ok); }
.upload-item.err .bar-fill { background: var(--danger); }
.u-meta { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.u-status { color: var(--text); }

/* 文件表格 */
.table-wrap { overflow-x: auto; }
table.files { width: 100%; border-collapse: collapse; font-size: 14px; }
table.files th, table.files td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.files th { color: var(--muted); font-weight: 600; font-size: 13px; }
table.files td.name { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.files td.num, table.files td.ops { white-space: nowrap; }
table.files td.ops .btn + .btn { margin-left: 6px; }

/* 登录页 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  width: 360px;
  max-width: 92vw;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 16px; }

/* 对话框 */
dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
  width: 360px;
  max-width: 92vw;
}
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.dlg { padding: 24px; }
.dlg h3 { margin: 0 0 14px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 50;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* MD5 与校验 */
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 0 4px; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  font-size: 12.5px;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  word-break: break-all;
}
table.files td.md5 { white-space: nowrap; }
.u-md5 code { font-size: 12px; }
.kv { display: flex; gap: 10px; align-items: center; margin: 6px 0; font-size: 14px; flex-wrap: wrap; }
.kv > span:first-child { color: var(--muted); min-width: 36px; }
.v-name { font-weight: 600; word-break: break-all; margin: 0 0 8px; }
.v-progress { margin-top: 14px; }
.v-result { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 14px; background: #f3f4f6; line-height: 1.8; }
.v-result.ok { background: #f0fdf4; color: #166534; }
.v-result.err { background: #fef2f2; color: #991b1b; }
.v-result code { background: rgba(255, 255, 255, .7); }
details { margin-top: 14px; font-size: 13px; color: var(--muted); }
details summary { cursor: pointer; }
details pre { background: #f3f4f6; padding: 8px 10px; border-radius: 6px; margin: 6px 0 0; white-space: pre-wrap; color: var(--text); font-size: 12.5px; }
#verifyDialog { width: 540px; }

@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .card { padding: 16px; }
  .tools input[type=search] { width: 150px; }
  .userbox .muted { display: none; }
}
