:root {
  --brand: #a32328;
  --brand-dark: #7c171b;
  --brand-soft: #f8e9e6;
  --gold: #c39a4d;
  --ink: #24211e;
  --ink-2: #57504a;
  --muted: #8b8279;
  --line: #e9e1d5;
  --cream: #f7f3ec;
  --card: #fffdfa;
  --green: #2f6f5e;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", Georgia, serif;
  --shadow: 0 12px 30px -22px rgba(60, 40, 20, .55);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 14px; line-height: 1.7;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh; display: grid; place-items: center; position: relative;
  padding: 24px; overflow: hidden;
}
.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(195, 154, 77, .32), transparent 42%),
    radial-gradient(circle at 85% 78%, rgba(163, 35, 40, .38), transparent 46%),
    linear-gradient(135deg, #2a1d18, #4a2320 55%, #2a1d18);
}
.login-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 26px 26px;
}
.login-card {
  position: relative; width: min(400px, 100%); background: var(--card);
  border-radius: 20px; padding: 34px 34px 28px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.mark {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  color: #f7e9c8; font-family: var(--serif); font-size: 23px;
  box-shadow: 0 8px 16px -10px rgba(163, 35, 40, .9);
}
.login-brand strong { display: block; font-family: var(--serif); font-size: 20px; letter-spacing: 2px; line-height: 1.3; }
.login-brand em { font-style: normal; font-size: 10px; letter-spacing: 2px; color: var(--muted); }
.login-card h2 { font-family: var(--serif); font-size: 22px; margin: 0 0 20px; letter-spacing: 1px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; outline: none; transition: .2s; font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(163, 35, 40, .1); }
.field textarea { resize: vertical; min-height: 96px; line-height: 1.8; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.captcha-row { display: flex; gap: 10px; }
.captcha-row input { flex: 1; }
.captcha-row img {
  width: 120px; height: 42px; border-radius: 8px; border: 1px solid var(--line);
  cursor: pointer; flex-shrink: 0; background: #fbf5ea; object-fit: cover;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 9px; border: 1px solid transparent;
  background: #efe8dc; color: var(--ink-2); cursor: pointer; font-size: 13.5px;
  transition: .2s; white-space: nowrap;
}
.btn:hover { background: #e7ddcd; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); box-shadow: 0 10px 20px -14px rgba(163, 35, 40, .9); }
.btn.danger { color: #a32328; border-color: #ecc9c6; background: #fdf1ef; }
.btn.danger:hover { background: #f9e2df; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; padding: 11px; font-size: 15px; letter-spacing: 4px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.login-tip { margin: 16px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- 布局 ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex-shrink: 0; background: #241c18; color: rgba(255, 255, 255, .78);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 22px 20px 20px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.side-brand strong { display: block; color: #fff; font-family: var(--serif); font-size: 17px; letter-spacing: 1px; line-height: 1.3; }
.side-brand em { font-style: normal; font-size: 10px; letter-spacing: 2px; color: rgba(255, 255, 255, .45); }
.side-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 9px;
  font-size: 14px; transition: .2s;
}
.side-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-nav a.active { background: linear-gradient(100deg, rgba(163, 35, 40, .95), rgba(163, 35, 40, .55)); color: #fff; box-shadow: 0 8px 18px -12px rgba(163, 35, 40, .9); }
.side-nav .ico { width: 18px; text-align: center; font-size: 13px; opacity: .85; }
.side-foot { padding: 16px 20px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12.5px; }
.side-foot a:hover { color: #f2ddb1; }
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 66px; display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: rgba(255, 253, 250, .9); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-family: var(--serif); font-size: 19px; letter-spacing: 1px; margin: 0; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { font-size: 13px; color: var(--muted); }
.who::before { content: "●"; color: var(--green); margin-right: 6px; font-size: 9px; vertical-align: 2px; }
.menu-btn { display: none; background: none; border: 0; font-size: 19px; cursor: pointer; }
.view { padding: 24px 28px 48px; }

/* ---------- 仪表盘 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::after {
  content: ""; position: absolute; right: -24px; top: -24px; width: 88px; height: 88px;
  border-radius: 50%; background: var(--brand-soft); opacity: .7;
}
.stat-card .label { font-size: 13px; color: var(--muted); position: relative; z-index: 1; }
.stat-card .num { font-family: var(--serif); font-size: 34px; line-height: 1.2; color: var(--brand); margin: 8px 0 2px; position: relative; z-index: 1; }
.stat-card .sub { font-size: 12px; color: var(--muted); position: relative; z-index: 1; }
.stat-card.gold .num { color: #a57c22; }
.stat-card.gold::after { background: #f6ecd8; }
.stat-card.green .num { color: var(--green); }
.stat-card.green::after { background: #e6f0eb; }
.stat-card.dark .num { color: #3a332d; }
.stat-card.dark::after { background: #efe9df; }
.dash-cols { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; margin-top: 22px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); }
.panel h3 { font-family: var(--serif); font-size: 16px; margin: 0 0 14px; letter-spacing: 1px; }
.quick-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-list a {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 13.5px; transition: .2s; background: #fff;
}
.quick-list a:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.quick-list a span.i { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 13px; }
.home-tips { font-size: 13px; color: var(--ink-2); line-height: 1.9; }
.home-tips b { color: var(--brand); }
.home-tips ul { padding-left: 18px; margin: 8px 0 0; }
.home-tips li { margin-bottom: 4px; }

/* ---------- 列表工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search {
  flex: 1; max-width: 320px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; outline: none; font-size: 13.5px;
}
.toolbar .search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(163, 35, 40, .1); }
.toolbar .spacer { flex: 1; }
.toolbar .count { font-size: 12.5px; color: var(--muted); }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: auto; box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; min-width: 720px; }
table.data th, table.data td { padding: 13px 16px; text-align: left; border-bottom: 1px solid #f0e9de; font-size: 13.5px; vertical-align: middle; }
table.data th { background: #fbf7f0; color: var(--muted); font-weight: 500; font-size: 12.5px; letter-spacing: .5px; white-space: nowrap; }
table.data tbody tr:hover { background: #fdf9f3; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .title-cell { max-width: 380px; }
table.data .title-cell b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data .thumb { width: 76px; height: 50px; border-radius: 7px; object-fit: cover; background: var(--brand-soft); }
table.data .ops { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-row { text-align: center; color: var(--muted); padding: 46px 0 !important; }

.badge { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); line-height: 1.8; white-space: nowrap; }
.badge.gray { background: #eee7dc; color: var(--muted); }
.badge.green { background: #e3efe9; color: var(--green); }
.badge.gold { background: #f6ecd8; color: #8a6415; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 42px; height: 23px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #d9d0c3; border-radius: 999px; transition: .25s; cursor: pointer; }
.switch i::before { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .25s; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::before { transform: translateX(19px); }

/* 分页 */
.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pagination button, .pagination span { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.pagination button { cursor: pointer; }
.pagination button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pagination button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }
.pagination .info { border: 0; background: transparent; color: var(--muted); font-size: 12.5px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(25, 18, 14, .55); z-index: 90;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px;
  overflow: auto; backdrop-filter: blur(2px);
}
.modal {
  background: var(--card); border-radius: 16px; width: min(760px, 100%);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .6); animation: pop .22s ease;
}
.modal.small { width: min(440px, 100%); }
@keyframes pop { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; padding: 18px 26px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--serif); font-size: 18px; margin: 0; letter-spacing: 1px; }
.modal-head .close { margin-left: auto; background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-head .close:hover { color: var(--brand); }
.modal-body { padding: 22px 26px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 26px 22px; }

/* ---------- 编辑器 ---------- */
.editor-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.editor-toolbar { display: flex; gap: 4px; padding: 8px 10px; background: #fbf7f0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.editor-toolbar button {
  min-width: 30px; height: 28px; padding: 0 9px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; cursor: pointer; font-size: 13px; color: var(--ink-2);
}
.editor-toolbar button:hover { background: #f0e7d9; }
.editor-toolbar .sep { width: 1px; height: 18px; background: var(--line); margin: 5px 4px; }
.editor { min-height: 190px; max-height: 420px; overflow: auto; padding: 14px 16px; outline: none; font-size: 14px; line-height: 1.9; }
.editor:empty::before { content: "在此输入内容…"; color: #b9b0a5; }
.editor img { max-width: 100%; border-radius: 8px; margin: 6px 0; }

.cover-field { display: flex; gap: 14px; align-items: flex-start; }
.cover-preview {
  width: 168px; height: 106px; border-radius: 10px; border: 1px dashed var(--line);
  background: #fbf7f0 center/cover no-repeat; display: grid; place-items: center;
  color: #b3a99c; font-size: 12px; flex-shrink: 0; overflow: hidden;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-actions { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }

.option-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.option-row input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none; font-size: 13.5px;
}
.option-row input:focus { border-color: var(--brand); }
.option-row .del { border: 1px solid #ecc9c6; color: var(--brand); background: #fdf1ef; border-radius: 7px; width: 32px; height: 34px; cursor: pointer; }
.option-row .del:hover { background: #f9e2df; }
.options-list { margin-bottom: 8px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 20px; right: 22px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 11px 18px; border-radius: 9px; background: #2b2521; color: #fff;
  font-size: 13.5px; box-shadow: 0 16px 34px -18px rgba(0, 0, 0, .7); animation: slide .22s;
  max-width: 340px;
}
.toast.ok { background: var(--green); }
.toast.err { background: #9e2b2f; }
@keyframes slide { from { transform: translateX(22px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-cols { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; transform: translateX(-100%); transition: .25s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: block; }
  .topbar { padding: 0 16px; height: 60px; }
  .topbar h1 { font-size: 16px; }
  .view { padding: 16px 14px 40px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-card .num { font-size: 26px; }
  .who { display: none; }
  .field-row { flex-direction: column; gap: 0; }
  .modal-mask { padding: 16px 10px; }
  .quick-list { grid-template-columns: 1fr; }
}
