:root {
  --brand: #0f9d78;
  --brand-dark: #0b7d5f;
  --brand-soft: #e8f6f2;
  --text: #1f2329;
  --text-2: #5f6b7a;
  --text-3: #98a2b3;
  --line: #e6eaef;
  --bg: #f5f7f9;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warn: #b7791f;
  --warn-soft: #fdf6e7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
}
.brand i {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--brand);
  display: inline-block;
  position: relative;
}
.brand i::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid #fff;
  border-radius: 2px;
  border-right-color: transparent;
  border-bottom-color: transparent;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 7px 13px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
}
.nav a:hover { background: #f2f4f7; color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-right .who { color: var(--text-3); font-size: 13px; }

/* ---------- 布局 ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.page-head { margin: 2px 0 18px; }
.page-head h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; }
.page-head p { margin: 0; color: var(--text-3); font-size: 13px; }

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .sub { font-weight: 400; color: var(--text-3); font-size: 12px; }

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 16px; }
label.field > span.label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 7px;
  font-weight: 500;
}
.hint { color: var(--text-3); font-size: 12px; margin-top: 6px; }

.input, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.input:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 157, 120, 0.12);
}
.textarea { resize: vertical; min-height: 168px; line-height: 1.8; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.input.small { padding: 8px 10px; font-size: 13px; border-radius: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 14px rgba(15, 157, 120, 0.2); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn-plain { border-color: var(--line); color: var(--text-2); }
.btn-plain:hover { background: #f7f9fb; color: var(--text); }
.btn-danger { border-color: #f3d1d2; color: var(--danger); background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }

/* ---------- 拖拽上传 ---------- */
.dropzone {
  border: 1.5px dashed #cfd8e3;
  border-radius: var(--radius);
  background: #fbfcfd;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover { border-color: var(--brand); background: #f7fdfb; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .dz-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border-radius: 12px;
  background: var(--brand-soft);
  position: relative;
}
.dropzone .dz-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 16px;
  width: 2px;
  height: 14px;
  background: var(--brand);
  transform: translateX(-50%);
}
.dropzone .dz-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 23px;
  width: 12px;
  height: 12px;
  border-left: 2px solid var(--brand);
  border-top: 2px solid var(--brand);
  transform: translateX(-50%) rotate(45deg);
}
.dropzone .dz-main { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.dropzone .dz-sub { font-size: 12px; color: var(--text-3); }

/* ---------- 待上传列表 ---------- */
.pending { margin-top: 18px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fff;
}
.file-item .thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #f2f5f8 center/cover no-repeat;
  flex: 0 0 auto;
  border: 1px solid var(--line);
}
.file-item .meta { flex: 1; min-width: 0; }
.file-item .meta .name-line { display: flex; gap: 8px; align-items: center; }
.file-item .meta .origin { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .remove {
  border: 0;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 6px;
  border-radius: 6px;
}
.file-item .remove:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- 输出区 ---------- */
.out-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.out-actions { display: flex; gap: 8px; }
.links-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
  padding: 12px 14px;
  min-height: 180px;
  max-height: 420px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.9;
  white-space: pre;
  color: #2c3542;
}
.links-box .empty { color: var(--text-3); font-family: inherit; white-space: normal; }
.stat-row { display: flex; gap: 24px; margin-top: 14px; flex-wrap: wrap; }
.stat { font-size: 12px; color: var(--text-3); }
.stat b { display: block; font-size: 18px; color: var(--text); font-weight: 600; }

.notice {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 12px;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #f6e5c6;
}
.notice.error { background: var(--danger-soft); color: var(--danger); border-color: #f8d7d8; white-space: pre-line; }
.notice.ok { background: var(--brand-soft); color: var(--brand-dark); border-color: #c9e9e0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th {
  text-align: left;
  font-weight: 500;
  color: var(--text-3);
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.list td { padding: 12px; border-bottom: 1px solid #f1f4f7; vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fbfcfd; }
.cell-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #f2f5f8 center/cover no-repeat;
  border: 1px solid var(--line);
  display: block;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #f2f4f7;
  color: var(--text-2);
}
.badge.on { background: var(--brand-soft); color: var(--brand-dark); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-3); }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 32px 28px; }
.login-card .brand { justify-content: center; margin-bottom: 6px; font-size: 17px; }
.login-card .sub { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 24px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  background: rgba(23, 30, 38, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
  max-width: 80vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (max-width: 720px) {
  .topbar-inner { gap: 12px; padding: 0 14px; }
  .topbar-right .who { display: none; }
  .nav a { padding: 7px 10px; font-size: 13px; }
  .container { padding: 18px 14px 50px; }
  .card { padding: 16px; }
}
