/* ------------------------------------------------------------------
   pindou 管理后台
------------------------------------------------------------------- */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --violet: #7c3aed;
  --violet-dark: #6d28d9;
  --fuchsia: #d946ef;
  --soft: #f8fafc;
  --violet-soft: #f5f3ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --radius: 16px;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--violet-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

/* ---------------- 登录页 ---------------- */
.admin-login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(48rem 28rem at 12% -10%, rgba(237, 233, 254, 0.95), transparent 62%),
    radial-gradient(42rem 26rem at 96% 0%, rgba(252, 231, 243, 0.9), transparent 62%),
    #f8fafc;
}
.admin-login {
  width: min(100%, 430px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(76, 29, 149, 0.12);
}
.admin-login .brand { margin-bottom: 22px; }
.admin-login h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.admin-login .lede { margin: 9px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.admin-login .field { display: block; margin-bottom: 15px; font-size: 13px; font-weight: 600; color: #334155; }
.admin-login .field span { display: block; margin-bottom: 7px; }
.admin-login .field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  outline: none;
  font-weight: 400;
}
.admin-login .field input:focus { border-color: #a78bfa; box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.16); }
.admin-login-footer { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------------- 布局 ---------------- */
.admin-shell { min-height: 100vh; display: flex; }
.admin-sidebar {
  width: 246px;
  flex: none;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
}
.admin-brand {
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--line);
}
.admin-brand .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
}
.admin-brand .brand:hover { text-decoration: none; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 6px); gap: 2px; }
.brand-mark i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.admin-brand .sub { margin: 7px 0 0; font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

.admin-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow: auto; }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 10px 12px;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
}
.admin-nav a:hover { background: var(--soft); text-decoration: none; color: var(--ink); }
.admin-nav a.active {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.12), rgba(217, 70, 239, 0.08));
  color: var(--violet-dark);
}
.admin-nav .nav-icon { width: 18px; height: 18px; display: inline-grid; place-items: center; font-size: 15px; }

.admin-sidebar-footer {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
}
.version-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  background: var(--violet-soft);
  color: var(--violet-dark);
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.version-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.admin-main {
  flex: 1;
  min-width: 0;
  margin-left: 246px;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.admin-topbar h1 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.admin-topbar .topbar-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.admin-topbar .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.admin-user { font-size: 13px; color: #475569; }
.admin-user strong { color: var(--ink); }
.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  color: #475569;
}

.admin-content { padding: 24px 26px 46px; display: flex; flex-direction: column; gap: 18px; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}
.card-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head h2 { margin: 0; font-size: 15px; }
.card-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.card-body { padding: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-card .stat-label { font-size: 12px; color: var(--muted); }
.stat-card .stat-value { margin-top: 8px; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.stat-card .stat-hint { margin-top: 5px; font-size: 11px; color: #94a3b8; }
.stat-card.accent { background: linear-gradient(135deg, #f5f3ff, #fdf4ff); border-color: #ddd6fe; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:hover { border-color: #c4b5fd; text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn { white-space: nowrap; }
.version-pill { white-space: nowrap; }
.btn-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(90deg, var(--violet), var(--fuchsia));
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.22);
}
.btn-danger { color: var(--red); border-color: #fecaca; background: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-link { border: 0; background: none; color: var(--violet-dark); padding: 0; cursor: pointer; font-weight: 700; font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.violet { background: var(--violet-soft); color: var(--violet-dark); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.slate { background: #f1f5f9; color: #475569; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.admin-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  vertical-align: middle;
}
.admin-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; background: #fafbfc; }
.admin-table tbody tr:hover { background: #fafbfd; }
.admin-table td.actions { white-space: nowrap; }
.admin-table .muted { color: var(--muted); font-size: 12px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: block; font-size: 12px; font-weight: 700; color: #334155; }
.field span.label-text { display: block; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font-weight: 400;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.field textarea { min-height: 86px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #a78bfa; box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.14); }
.field .hint { display: block; margin-top: 5px; font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.5; }
.check-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #334155; font-weight: 600; }
.check-field input { width: 16px; height: 16px; accent-color: var(--violet); }

.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.alert { border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.6; border: 1px solid transparent; }
.alert.error { background: var(--red-soft); border-color: #fecaca; color: var(--red); }
.alert.success { background: var(--green-soft); border-color: #a7f3d0; color: var(--green); }
.alert.info { background: var(--violet-soft); border-color: #ddd6fe; color: var(--violet-dark); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type="search"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  min-width: 220px;
  outline: none;
  font-size: 13px;
}
.toolbar input[type="search"]:focus { border-color: #a78bfa; box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.14); }
.toolbar .spacer { flex: 1; }

/* 版本 */
.version-hero {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #f5f3ff, #fdf4ff);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius);
  padding: 22px;
}
.version-hero > div:first-child {
  min-width: 160px;
}
.version-notes {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.version-notes li {
  border: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.6;
  color: #4c1d95;
}
.version-hero .v-number { font-size: 30px; font-weight: 800; letter-spacing: -0.04em; color: var(--violet-dark); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.version-hero .v-meta { font-size: 12px; color: var(--muted); line-height: 1.7; }
.version-hero .v-title { margin: 0; font-size: 15px; font-weight: 700; }
.release-list { list-style: none; margin: 0; padding: 0; }
.release-list li { padding: 13px 0; border-bottom: 1px solid #f1f5f9; }
.release-list li:last-child { border-bottom: 0; }
.release-list .release-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.release-list .release-title { font-weight: 700; font-size: 13px; }
.release-list .release-date { font-size: 11px; color: var(--muted); }
.release-list ul { margin: 7px 0 0; padding-left: 18px; color: #475569; font-size: 12px; line-height: 1.75; }

/* 作品 */
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.work-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.work-card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #f8fafc; display: block; }
.work-card .work-body { padding: 10px 12px 12px; }
.work-card .work-title { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work-card .work-meta { margin-top: 3px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.work-card .work-actions { margin-top: 8px; display: flex; gap: 8px; align-items: center; font-size: 12px; }

.empty { border: 1px dashed #cbd5e1; border-radius: 14px; padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; }

/* 弹窗 */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, 0.5); display: grid; place-items: center; padding: 20px; }
.modal-card {
  width: min(100%, 520px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
}
.modal-card h2 { margin: 0 0 4px; font-size: 18px; }
.modal-card .modal-sub { margin: 0 0 18px; font-size: 12px; color: var(--muted); }
.modal-card .form-actions { margin-top: 20px; justify-content: flex-end; }

/* Toast */
.admin-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 8px);
  z-index: 80;
  max-width: min(90vw, 420px);
  border-radius: 10px;
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  text-align: center;
}
.admin-toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* 移动端 */
.admin-backdrop { display: none; }
@media (max-width: 900px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .admin-backdrop.open { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(15, 23, 42, 0.4); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-topbar { padding: 12px 16px; }
  .admin-content { padding: 18px 16px 36px; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .admin-topbar .admin-user { display: none; }
  .admin-topbar h1 { font-size: 16px; }
  .admin-topbar .topbar-sub { display: none; }
  .admin-topbar > div:nth-of-type(1) { min-width: 0; flex: 1; }
  .admin-topbar .topbar-actions { gap: 6px; }
  .admin-topbar .btn-sm { padding: 6px 8px; }
  .admin-login { padding: 24px 20px; }
}
