[hidden] { display: none !important; }

:root {
  --bg: #f5f4f8;
  --surface: #fff;
  --surface-2: #faf9fc;
  --line: rgba(24, 20, 44, .08);
  --line-strong: rgba(24, 20, 44, .13);
  --ink: #0d0b14;
  --ink-2: #3b3747;
  --muted: #7a7589;
  --muted-2: #9c97aa;
  --accent: #7c3aed;
  --accent-2: #8b5cf6;
  --accent-soft: #f4eeff;
  --accent-line: rgba(124, 58, 237, .24);
  --danger: #dc2626;
  --shadow-xs: 0 1px 2px rgba(17, 12, 34, .04);
  --shadow-sm: 0 1px 2px rgba(17, 12, 34, .04), 0 4px 12px -6px rgba(17, 12, 34, .10);
  --shadow-md: 0 1px 2px rgba(17, 12, 34, .04), 0 14px 32px -16px rgba(17, 12, 34, .18);
  --shadow-lg: 0 2px 6px rgba(17, 12, 34, .05), 0 32px 64px -28px rgba(17, 12, 34, .28);
  --r-xl: 20px;
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 8px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro SC", "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(880px 460px at 50% -14%, rgba(168, 85, 247, .11), rgba(245, 244, 248, 0) 68%),
    radial-gradient(700px 380px at 98% 2%, rgba(99, 102, 241, .07), rgba(245, 244, 248, 0) 62%);
}

::selection { background: rgba(124, 58, 237, .18); }

h1 { font-size: 23px; margin: 0 0 6px; letter-spacing: -.025em; font-weight: 750; }
h2 { font-size: 15.5px; margin: 0; letter-spacing: -.015em; font-weight: 700; }

/* ------------------------------ 顶栏 ------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(252, 251, 254, .82);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 750;
  font-size: 15px;
  color: inherit;
  text-decoration: none;
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.brand::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
  box-shadow: var(--shadow-xs);
  transition: background .16s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease), transform .16s var(--ease);
}

.btn:hover { border-color: #cfc9dc; background: #fbfafd; box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px -12px rgba(124, 58, 237, .9), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.btn.primary:hover {
  background: linear-gradient(135deg, #936af8, #6f2fe0);
  border-color: transparent;
  box-shadow: 0 10px 24px -10px rgba(124, 58, 237, .95), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(124, 58, 237, .05); border-color: var(--accent-line); color: var(--accent); }
.btn.small { padding: 6px 11px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }

/* ------------------------------ 布局与卡片 ------------------------------ */
.wrap { max-width: 1140px; margin: 0 auto; padding: 30px 24px 90px; }

.login-card,
.panel,
.project-card,
.detail-head {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}

.login-card { max-width: 392px; margin: 11vh auto 0; padding: 34px 30px; }

.login-card h1 { font-size: 19px; margin-bottom: 6px; }

.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 22px; line-height: 1.65; }

#loginForm { display: grid; gap: 12px; }

.login-card input {
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface-2);
  outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}

.login-card input:focus {
  border-color: var(--accent-line);
  background: #fff;
  box-shadow: 0 0 0 3.5px rgba(124, 58, 237, .12);
}

.section-head { margin-bottom: 22px; }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(312px, 1fr)); gap: 16px; }

.project-card {
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(124, 58, 237, .18);
  transform: translateY(-2px);
}

.project-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.project-name { font-size: 15.5px; font-weight: 700; letter-spacing: -.015em; word-break: break-word; }
.project-slug { color: var(--muted-2); font-size: 11.5px; margin-top: 3px; word-break: break-all; font-variant-numeric: tabular-nums; }
.project-desc { color: var(--ink-2); font-size: 12.5px; line-height: 1.65; word-break: break-all; min-height: 18px; }
.project-stats { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }

.badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
}

.badge.on { background: var(--accent-soft); border-color: var(--accent-line); color: #6d28d9; }

.project-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* ------------------------------ 详情 ------------------------------ */
.back {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
  font-family: inherit;
  transition: color .16s var(--ease), transform .16s var(--ease);
}

.back:hover { color: var(--accent); transform: translateX(-2px); }

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.detail-sub { color: var(--muted); font-size: 12.5px; margin: 5px 0 0; word-break: break-all; }
.detail-links { display: flex; gap: 8px; flex-wrap: wrap; }

.panel { padding: 22px 24px; margin-bottom: 16px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.upload-date { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }

.upload-date input {
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--surface-2);
  outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}

.upload-date input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3.5px rgba(124, 58, 237, .12); }

/* 拖拽区 */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1.5px dashed rgba(124, 58, 237, .28);
  border-radius: var(--r-lg);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background:
    radial-gradient(420px 160px at 50% 0%, rgba(168, 85, 247, .07), rgba(250, 249, 252, 0) 70%),
    var(--surface-2);
  transition: border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}

.dropzone svg { color: #a78bfa; transition: transform .2s var(--ease); }

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  color: var(--accent);
  background:
    radial-gradient(420px 200px at 50% 0%, rgba(168, 85, 247, .14), rgba(244, 238, 255, 0) 72%),
    #faf7ff;
}

.dropzone:hover svg { transform: translateY(-2px); }

.dropzone p { margin: 10px 0 0; font-size: 13.5px; }
.dropzone .drop-hint { font-size: 11.5px; color: var(--muted-2); margin-top: 6px; }
.dropzone .link { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-line); }

.queue { margin-top: 18px; }
.queue-info { font-size: 12.5px; color: var(--ink-2); margin: 0 0 9px; font-variant-numeric: tabular-nums; }

.progress { height: 7px; border-radius: 999px; background: #eeebf3; overflow: hidden; }

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #c084fc, var(--accent));
  box-shadow: 0 0 12px rgba(124, 58, 237, .5);
  transition: width .25s var(--ease);
}

.queue-actions { display: flex; gap: 8px; margin-top: 13px; }

.upload-result {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: #15803d;
  background: #f2fdf5;
  border: 1px solid #d9f5e2;
  padding: 10px 13px;
  border-radius: var(--r-md);
  line-height: 1.65;
}

.upload-result.warn { color: #9a5b12; background: #fffbeb; border-color: #fdecc8; }

/* 图片管理 */
.filters { display: flex; align-items: center; gap: 10px; font-size: 12.5px; flex-wrap: wrap; }

.filters select {
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink-2);
  outline: none;
}

.filters select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3.5px rgba(124, 58, 237, .12); }

.pager { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }

.manage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 10px; }

.thumb {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #e9e6ef;
  aspect-ratio: 16 / 10;
  border: 1px solid rgba(17, 12, 34, .06);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb .del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  background: rgba(10, 8, 16, .55);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  backdrop-filter: blur(8px);
  transition: opacity .16s var(--ease), background .16s var(--ease);
}

.thumb:hover .del { opacity: 1; }
.thumb .del:hover { background: var(--danger); border-color: transparent; }

.thumb .tdate {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 10.5px;
  color: #fff;
  background: rgba(10, 8, 16, .55);
  border: 1px solid rgba(255, 255, 255, .14);
  padding: 2px 6px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}

.empty { color: var(--muted-2); font-size: 12.5px; text-align: center; padding: 28px 0; }
.error { color: var(--danger); font-size: 12.5px; margin: 0; }

/* ------------------------------ 弹窗 ------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 12, 34, .34);
  backdrop-filter: blur(6px);
  animation: fadeIn .18s var(--ease) both;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  width: 100%;
  max-width: 470px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 26px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow: auto;
  animation: popIn .22s var(--ease) both;
}

@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-box h2 { margin-bottom: 18px; font-size: 16.5px; }

#modalForm { display: grid; gap: 14px; }

.field { display: grid; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); }

.field input[type="text"],
.field input[type="password"],
.field textarea {
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface-2);
  outline: none;
  resize: vertical;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent-line);
  background: #fff;
  box-shadow: 0 0 0 3.5px rgba(124, 58, 237, .12);
}

.field.checkbox label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); }
.field.checkbox input { accent-color: var(--accent); width: 15px; height: 15px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

@media (max-width: 600px) {
  .topbar { padding: 10px 14px; }
  .wrap { padding: 18px 14px 60px; }
  .detail-head { padding: 18px; }
  .panel { padding: 18px; }
  .dropzone { padding: 28px 14px; }
  .manage-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
  .login-card { margin-top: 8vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- 上传授权 ---------- */
.mini-input {
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  min-width: 150px;
}

.mini-input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3.5px rgba(124, 58, 237, .1); }

.uploader-list { display: grid; gap: 8px; }

.uploader-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.uploader-row.off { opacity: .5; }

.up-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.up-meta { font-size: 11px; color: var(--muted); margin-top: 3px; word-break: break-all; }
.up-meta code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--accent);
}

.up-actions { display: flex; gap: 6px; }

@media (max-width: 600px) {
  .uploader-row { grid-template-columns: 1fr; }
  .up-actions { justify-content: flex-start; }
}
