:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e4e6eb;
  --text: #1f2328;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --danger: #dc2626;
  --ok: #15803d;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

button, input, select { font: inherit; color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 600; letter-spacing: .02em; }

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .04em;
}

.dropzone {
  border: 1.5px dashed #cbd2dc;
  border-radius: 10px;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  outline: none;
}

.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dz-main { font-size: 15px; font-weight: 500; }
.dz-sub { color: var(--muted); margin-top: 6px; font-size: 13px; }

.picked {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.picked li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.picked li:last-child { border-bottom: none; }
.picked .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked .size { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-top: 16px;
}

.form-row label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

.form-row input[type="text"], .form-row select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  min-width: 180px;
}

.form-row input[type="text"]:focus, .form-row select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.primary, .ghost, .button {
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.primary:hover:not(:disabled) { background: #1d4ed8; }
.primary:disabled { opacity: .45; cursor: not-allowed; }

.ghost { background: #fff; border-color: var(--line); color: var(--text); }
.ghost:hover { border-color: #c3c9d3; }

.small { padding: 5px 12px; font-size: 13px; }

.link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}

.link.danger { color: var(--danger); }

.progress { margin-top: 18px; }
.bar { height: 6px; background: #eceef2; border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-text {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.file-progress { list-style: none; margin: 12px 0 0; padding: 0; }
.file-progress li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 44px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
}
.fp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-bar { height: 4px; background: #eceef2; border-radius: 99px; overflow: hidden; }
.fp-bar > i { display: block; height: 100%; width: 0; background: #9aa4b2; transition: width .15s; }
.file-progress li.done .fp-bar > i { background: var(--ok); }
.file-progress li.error .fp-bar > i { background: var(--danger); }
.fp-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.result.empty { color: var(--muted); }
.link-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-row input {
  flex: 1;
  min-width: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: #fafbfc;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }

.sub-links { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); }
.sub-links li { display: flex; gap: 10px; align-items: center; padding: 3px 0; font-size: 13px; }
.sub-links .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 14px; }
.tabs .tab {
  background: none;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
}
.tabs .tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.tabs .spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
td.actions button + button { margin-left: 10px; }

.folder {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}
.folder summary {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  background: #fafbfc;
}
.folder summary::-webkit-details-marker { display: none; }
.folder .folder-name { font-weight: 500; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.folder .muted { color: var(--muted); font-size: 12px; }
.folder ul { list-style: none; margin: 0; padding: 6px 14px 12px; }
.folder li { display: flex; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.folder li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder li .size { color: var(--muted); font-variant-numeric: tabular-nums; }

.empty-state { color: var(--muted); padding: 18px 0; text-align: center; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; background: #eef0f4; color: var(--muted); }
.badge.expired { background: #fdecec; color: var(--danger); }
.badge.ok { background: #e9f7ee; color: var(--ok); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #1f2328;
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 50;
}
.toast.show { opacity: 1; }

.hidden { display: none !important; }

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
}
.login-card h1 { font-size: 17px; margin: 0 0 6px; }
.login-card p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.login-card button { width: 100%; justify-content: center; }
.login-error { color: var(--danger); font-size: 13px; min-height: 20px; margin: 0 0 8px; }

@media (max-width: 640px) {
  .form-row { flex-direction: column; align-items: stretch; }
  .form-row input[type="text"], .form-row select { min-width: 0; width: 100%; }
  .file-progress li { grid-template-columns: minmax(0, 1fr) 80px 40px; }
  table { font-size: 12px; }
  th:nth-child(4), td:nth-child(4) { display: none; }
}
