:root {
  --bg: #f7f2ec;
  --card: #fffdfa;
  --ink: #33292d;
  --muted: #8c7f83;
  --line: #ece1d7;
  --brand: #c9778b;
  --brand-dark: #a8556a;
  --brand-soft: #f8e6ea;
  --side: #2b2326;
  --side-ink: #f4ece7;
  --ok: #4f9a76;
  --warn: #b7823c;
  --danger: #b64d4d;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(73, 45, 55, .07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-dark); text-decoration: none; }
code { background: #f3ece6; padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
p { margin: 0; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(720px 420px at 12% 8%, #fbe3e8 0%, transparent 65%),
    radial-gradient(620px 420px at 92% 88%, #efe3d2 0%, transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 34px 32px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card h1 { font-size: 24px; margin-top: 12px; }
.login-card .muted { margin-bottom: 22px; }
.login-card .field { text-align: left; }
.login-card .btn { margin-top: 10px; }
.brand-mark {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  margin: 0 auto;
  border-radius: 17px;
  background: linear-gradient(140deg, #f4b9c5, #c9778b);
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(201, 119, 139, .28);
}
.brand-mark.small { width: 38px; height: 38px; font-size: 18px; border-radius: 12px; margin: 0; box-shadow: none; }
.login-hint {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  text-align: left;
  background: #faf5f0;
  border-radius: 10px;
  padding: 10px 12px;
}

/* ---------- 布局 ---------- */
.app {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--side);
  color: var(--side-ink);
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.side-brand strong { display: block; font-size: 15px; }
.side-brand span { display: block; font-size: 12px; color: #b9a9ad; }
#nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #cfc1c4;
  text-align: left;
  font-size: 13.5px;
  transition: background .16s, color .16s;
}
.nav-item svg {
  width: 17px; height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.side-foot {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: #a9999d;
  padding: 12px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #6fc08d; box-shadow: 0 0 0 3px rgba(111, 192, 141, .16); }

.main { padding: 26px 32px 48px; max-width: 1320px; width: 100%; }
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.topbar p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.top-actions { display: flex; gap: 8px; }
.view { display: flex; flex-direction: column; gap: 18px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 2px 10px rgba(73, 45, 55, .03);
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.panel-head p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar p { margin-top: 3px; font-size: 12.5px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 按钮与表单 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  transition: transform .12s, box-shadow .16s, background .16s;
}
.btn:hover { background: #fdf8f3; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, #d98ba0, var(--brand));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(201, 119, 139, .24);
}
.btn.primary:hover { background: linear-gradient(135deg, #d18098, var(--brand-dark)); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #eed3d3; }
.btn.danger:hover { background: #fcf1f1; }
.btn.small { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; color: #6c5f63; font-weight: 500; }
.field small { color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.input, .field input[type="text"], .field input[type="password"], .field input[type="number"],
.field input:not([type]), .field select, .field textarea, .login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 9px 11px;
  outline: none;
  transition: border .16s, box-shadow .16s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .login-card input:focus {
  border-color: #dda8b5;
  box-shadow: 0 0 0 3px rgba(201, 119, 139, .12);
}
.field textarea { resize: vertical; min-height: 76px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid.narrow { max-width: 460px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; padding-top: 6px; }
.checkbox-line { flex-direction: row; align-items: center; gap: 9px; margin-top: 2px; }
.checkbox-line input { width: 16px !important; height: 16px; accent-color: var(--brand); }

/* ---------- 统计 ---------- */
.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: 14px;
  padding: 16px 18px;
}
.stat-card .label { color: var(--muted); font-size: 12.5px; }
.stat-card .value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; }
.stat-card .hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stat-card.accent { background: linear-gradient(135deg, #fff7f8, #fbe9ed); border-color: #f3d7de; }

.trend { display: flex; align-items: flex-end; gap: 18px; height: 160px; padding: 10px 8px 0; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend-bars { display: flex; align-items: flex-end; gap: 5px; height: 110px; }
.trend-bar { width: 13px; border-radius: 4px 4px 2px 2px; min-height: 3px; }
.trend-bar.users { background: #d98ba0; }
.trend-bar.unlocks { background: #a9c6bb; }
.trend-day { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }

.log-list { display: flex; flex-direction: column; }
.log-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.log-row:last-child { border-bottom: 0; }
.log-time { color: var(--muted); width: 132px; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.log-user { color: var(--brand-dark); width: 70px; flex: 0 0 auto; }
.log-action { flex: 1; }
.empty { color: var(--muted); font-size: 13px; padding: 18px 0; text-align: center; }

/* ---------- 壁纸 ---------- */
.wallpaper-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.wp-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.wp-thumb { position: relative; height: 190px; background: #f2ebe5; }
.wp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badges { position: absolute; left: 8px; top: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(43, 35, 38, .72);
  color: #fff;
  backdrop-filter: blur(3px);
}
.badge.pink { background: rgba(201, 119, 139, .92); }
.badge.gold { background: rgba(183, 130, 60, .92); }
.badge.green { background: rgba(79, 154, 118, .92); }
.badge.gray { background: rgba(120, 110, 113, .8); }
.wp-body { padding: 11px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.wp-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.wp-actions { display: flex; gap: 6px; margin-top: 4px; }
.wp-actions .btn { flex: 1; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; font-size: 12.5px; color: var(--muted); }

/* ---------- 分类 / 模块 ---------- */
.category-list { display: flex; flex-direction: column; }
.cat-row {
  display: grid;
  grid-template-columns: 52px 1.4fr 1fr 70px 90px auto;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px dashed var(--line);
}
.cat-row:last-child { border-bottom: 0; }
.cat-cover { width: 44px; height: 56px; border-radius: 8px; object-fit: cover; background: #f2ebe5; }
.cat-name { font-weight: 600; font-size: 13.5px; }
.cat-slug { font-size: 11.5px; color: var(--muted); }
.cat-actions { display: flex; gap: 6px; justify-content: flex-end; }

.module-list { display: flex; flex-direction: column; gap: 10px; }
.module-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
}
.module-handle { color: #cbbfc2; font-size: 16px; letter-spacing: 1px; }
.module-main { flex: 1; min-width: 0; }
.module-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.module-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.type-tag { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: #f4ebe6; color: #96767f; font-weight: 400; }
.module-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- 开关 ---------- */
.switch-list { display: flex; flex-direction: column; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 2px;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
}
.switch-row:last-child { border-bottom: 0; }
.switch-row strong { display: block; font-size: 13.5px; font-weight: 600; }
.switch-row span.desc { display: block; font-size: 12px; color: var(--muted); }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0;
  background: #e3d9d4;
  border-radius: 999px;
  transition: background .18s;
}
.switch i::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .16);
  transition: transform .18s;
}
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(18px); }

.notice {
  background: #fdf6ef;
  border: 1px solid #f1e2d2;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 12.5px;
  color: #7d6a58;
  line-height: 1.7;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(43, 35, 38, .42);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 50;
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(43, 35, 38, .26);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}
.modal-head h3 { font-size: 16px; }
.modal-close {
  border: 0; background: transparent;
  font-size: 20px; line-height: 1;
  color: var(--muted); padding: 2px 6px;
}
.modal-body { padding: 20px 22px 6px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 22px 20px;
}
.upload-box {
  border: 1px dashed #d9c9c2;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fdfaf6;
  margin-bottom: 16px;
  cursor: pointer;
}
.upload-box img { width: 74px; height: 98px; object-fit: cover; border-radius: 8px; background: #f1e8e2; }
.upload-box .upload-text strong { display: block; font-size: 13px; }
.upload-box .upload-text span { font-size: 11.5px; color: var(--muted); }
.upload-box input[type="file"] { display: none; }
.upload-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.upload-pair .upload-box { margin-bottom: 0; padding: 12px; align-items: flex-start; }
.upload-pair .upload-box img { width: 62px; height: 84px; flex: none; }
.upload-pair .upload-text { min-width: 0; }
.upload-pair .upload-text em { display: block; margin-top: 4px; font-size: 11px; font-style: normal; color: var(--muted); }
.upload-pair .upload-actions { margin-top: 6px; }
.upload-pair .upload-actions button {
  border: 0; background: none; padding: 0; color: #b0607a;
  font-size: 11.5px; cursor: pointer; text-decoration: underline;
}
.upload-hint { margin: -6px 0 14px; }
.link-btn {
  border: 0; background: none; padding: 0; color: #b0607a;
  font-size: 12px; cursor: pointer; text-decoration: underline;
}

.ask-text { font-size: 13.5px; color: #5b4d51; line-height: 1.8; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: #33292d;
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b64d4d; }

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wallpaper-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 12px; gap: 12px; }
  .side-brand { flex: 0 0 auto; }
  .side-brand div:last-child span { display: none; }
  #nav { flex-direction: row; flex: 0 0 auto; }
  .nav-item { white-space: nowrap; padding: 8px 11px; }
  .side-foot { display: none; }
  .main { padding: 18px 16px 40px; }
  .topbar { align-items: center; }
  .form-grid { grid-template-columns: 1fr; }
  .cat-row { grid-template-columns: 44px 1fr auto; }
  .cat-row .cat-count, .cat-row .cat-sort { display: none; }
  .wallpaper-grid { grid-template-columns: 1fr; }
  .modal-mask { padding: 12px; }
}