:root {
  --paper: #f4ebdb;
  --paper-2: #fffaf1;
  --ink: #241f19;
  --ink-2: #4d4338;
  --muted: #8a7a69;
  --line: rgba(71, 52, 33, 0.14);
  --red: #b23a2b;
  --red-deep: #8e271b;
  --red-soft: #f5e0d7;
  --green: #3f6b56;
  --green-soft: #e4efe7;
  --gold: #a87c3f;
  --gold-soft: #f2e6d0;
  --serif: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(900px 700px at 12% 0%, #fff8ea, transparent 62%),
    linear-gradient(135deg, #efe5d4, #e2d1b8);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 440px;
  align-items: stretch;
  padding: clamp(28px, 7vw, 110px);
  gap: clamp(24px, 6vw, 100px);
  background:
    radial-gradient(800px 560px at 15% 20%, rgba(255, 250, 240, 0.9), transparent 68%),
    linear-gradient(135deg, #e8dac5, #dcc8ad);
}
.login-copy { display: flex; flex-direction: column; justify-content: center; max-width: 520px; }
.login-seal {
  width: 72px; height: 72px; display: grid; place-items: center;
  background: var(--red); color: #fff1de; border-radius: 8px;
  font-family: var(--serif); font-size: 46px; transform: rotate(-4deg);
  box-shadow: inset 0 0 0 4px rgba(255, 244, 228, .45), 0 12px 28px rgba(142, 39, 27, .2);
}
.eyebrow, .top-eyebrow {
  margin: 28px 0 8px; color: var(--muted); font-size: 11px;
  letter-spacing: .28em; font-weight: 700;
}
.login-copy h1 {
  margin: 0; font-family: var(--serif); font-size: clamp(48px, 7vw, 80px);
  line-height: 1.14; letter-spacing: .08em; font-weight: 700;
}
.login-copy h1 span { color: var(--red-deep); }
.login-lead { margin: 26px 0 0; font-family: var(--serif); font-size: 20px; color: var(--ink-2); }
.login-note { margin: 18px 0 0; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.login-card {
  align-self: center; padding: 42px 38px 30px; border-radius: 22px;
  background: rgba(255, 250, 241, .93); border: 1px solid rgba(71, 52, 33, .14);
  box-shadow: 0 28px 70px rgba(55, 34, 18, .18);
}
.login-card h2 { margin: 0; font-family: var(--serif); font-size: 30px; letter-spacing: .08em; }
.login-card > p { margin: 10px 0 28px; color: var(--muted); font-size: 13px; }
.login-card label { display: block; margin: 0 0 16px; color: var(--ink-2); font-size: 12px; }
.login-card input {
  width: 100%; height: 46px; display: block; margin-top: 8px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; outline: none;
  background: #fffdf8; color: var(--ink); font-size: 14px;
}
.login-card input:focus { border-color: rgba(178, 58, 43, .55); box-shadow: 0 0 0 3px rgba(178, 58, 43, .08); }
.form-error { min-height: 18px; margin: 0 0 8px !important; color: var(--red) !important; font-size: 12px !important; }
.primary-btn {
  width: 100%; height: 48px; border: 0; border-radius: 10px;
  background: var(--ink); color: #fff5e5; letter-spacing: .18em; font-size: 13px;
}
.primary-btn:hover { background: #332a22; }
.login-foot { margin: 22px 0 0 !important; text-align: center; color: var(--muted); font-size: 11px !important; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 28px 18px 22px;
  display: flex; flex-direction: column; background: #211d19; color: #e9dcc9;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.side-brand .seal {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 5px;
  background: var(--red); color: #fff1de; font-family: var(--serif); font-size: 26px;
  transform: rotate(-3deg);
}
.side-brand strong { display: block; font-family: var(--serif); font-size: 21px; letter-spacing: .12em; }
.side-brand span { display: block; margin-top: 3px; color: #9d8c78; font-size: 10px; letter-spacing: .2em; }
.side-label { margin: 46px 10px 12px; color: #756555; font-size: 10px; letter-spacing: .24em; }
.side-nav { display: flex; flex-direction: column; gap: 5px; }
.side-nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 12px;
  border: 0; border-radius: 9px; background: transparent; color: #ac9b87; text-align: left;
  font-size: 13px;
}
.side-nav button b {
  width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid #5c4e40;
  border-radius: 6px; font-family: var(--serif); font-size: 15px; font-weight: 400;
}
.side-nav button:hover { background: rgba(255,255,255,.05); color: #f3e6d2; }
.side-nav button.active { background: #3a2e25; color: #fff1dc; }
.side-nav button.active b { border-color: var(--red); background: var(--red); color: #fff1dc; }
.side-bottom { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid #3b3028; }
.side-bottom p { margin: 0 0 7px; color: #8e7b66; font-size: 10px; letter-spacing: .12em; }
.side-bottom code { color: #b9a58e; font-size: 10px; word-break: break-all; }
.side-bottom span { display: block; margin-top: 18px; color: #66594c; font-size: 11px; }
.main { min-width: 0; background: rgba(244, 235, 219, .72); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 38px clamp(24px, 4vw, 58px) 22px;
}
.top-eyebrow { margin: 0 0 7px; font-size: 10px; color: var(--red-deep); }
.topbar h1 { margin: 0; font-family: var(--serif); font-size: 34px; letter-spacing: .1em; }
.top-sub { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.admin-name { color: var(--muted); font-size: 12px; }
.ghost-btn {
  height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(255, 250, 241, .65); color: var(--ink-2); font-size: 12px;
}
.content { padding: 6px clamp(20px, 4vw, 58px) 58px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card {
  position: relative; overflow: hidden; padding: 22px 22px 18px; min-height: 130px;
  border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 251, 243, .85);
}
.stat-card::after {
  content: ""; position: absolute; right: -25px; bottom: -35px; width: 100px; height: 100px;
  border: 1px solid rgba(178,58,43,.14); border-radius: 50%;
}
.stat-card .label { color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.stat-card strong { display: block; margin-top: 18px; font-family: var(--serif); font-size: 38px; font-weight: 700; }
.stat-card .hint { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.stat-card.alert strong { color: var(--red-deep); }
.panel {
  margin-top: 20px; border: 1px solid var(--line); border-radius: 15px;
  background: rgba(255, 251, 243, .83); overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-family: var(--serif); font-size: 19px; letter-spacing: .08em; }
.panel-head span { color: var(--muted); font-size: 11px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.toolbar input, .toolbar select, .toolbar button {
  height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fffdf8; color: var(--ink-2); font-size: 12px; outline: none;
}
.toolbar input { width: min(280px, 50vw); }
.toolbar select { min-width: 110px; }
.toolbar input:focus { border-color: rgba(178,58,43,.5); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th {
  padding: 11px 18px; text-align: left; color: var(--muted); font-size: 10px;
  font-weight: 500; letter-spacing: .1em; background: rgba(244,235,219,.35);
  white-space: nowrap;
}
td { padding: 14px 18px; border-top: 1px solid rgba(71,52,33,.08); vertical-align: middle; font-size: 12px; color: var(--ink-2); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(178,58,43,.035); }
.post-cell { max-width: 440px; }
.post-cell strong { display: block; color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-cell span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-flex; align-items: center; height: 23px; padding: 0 8px; border: 1px solid rgba(178,58,43,.22); border-radius: 5px; color: var(--red-deep); background: var(--red-soft); font-size: 10px; white-space: nowrap; }
.status { display: inline-flex; align-items: center; height: 23px; padding: 0 8px; border-radius: 99px; font-size: 10px; white-space: nowrap; }
.status.visible { color: var(--green); background: var(--green-soft); }
.status.hidden { color: #8b651f; background: var(--gold-soft); }
.status.deleted, .status.banned, .status.open { color: var(--red-deep); background: var(--red-soft); }
.status.resolved, .status.active { color: var(--green); background: var(--green-soft); }
.status.ignored { color: var(--muted); background: #eee8dd; }
.numeric { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
td .actions { flex-wrap: nowrap; }
.action {
  height: 28px; min-width: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px;
  background: #fffdf8; color: var(--ink-2); font-size: 10px;
  white-space: nowrap;
}
.action:hover { border-color: rgba(178,58,43,.4); color: var(--red-deep); }
.action.danger { color: var(--red-deep); }
.empty-state { padding: 55px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-state .empty-mark { font-family: var(--serif); font-size: 36px; color: rgba(71,52,33,.35); margin-bottom: 10px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; color: var(--muted); font-size: 11px; }
.pager button { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fffdf8; font-size: 11px; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.quick-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.quick-links button {
  height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(255,250,241,.8); color: var(--ink-2); font-size: 11px;
}
.loading { padding: 60px 20px; color: var(--muted); text-align: center; font-size: 13px; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end;
  background: rgba(30,22,15,.38); backdrop-filter: blur(2px);
}
.drawer {
  width: min(680px, 100vw); height: 100%; overflow-y: auto; padding: 28px 34px 40px;
  background: #fbf4e7; box-shadow: -20px 0 50px rgba(30,22,15,.22);
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.drawer-head h2 { margin: 0; font-family: var(--serif); font-size: 28px; line-height: 1.35; }
.drawer-head p { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.close-btn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 20px; color: var(--muted); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }
.detail-body { margin: 22px 0; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.9; white-space: pre-wrap; color: var(--ink-2); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 30px 0 12px; }
.section-title h3 { margin: 0; font-family: var(--serif); font-size: 18px; letter-spacing: .08em; }
.section-title span { color: var(--muted); font-size: 11px; }
.comment-row { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px dashed var(--line); }
.avatar {
  flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--red-soft);
  color: var(--red-deep); display: grid; place-items: center; font-family: var(--serif); font-size: 14px;
}
.comment-main { flex: 1; min-width: 0; }
.comment-main .who { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 11px; }
.comment-main .who span { color: var(--muted); font-size: 10px; }
.comment-main p { margin: 5px 0 0; color: var(--ink-2); font-size: 12px; line-height: 1.7; }
.comment-row .actions { flex: none; }
.toast {
  position: fixed; left: 50%; bottom: 30px; z-index: 100; transform: translate(-50%, 12px);
  padding: 10px 16px; border-radius: 9px; background: rgba(36,31,25,.93); color: #fff1dc;
  font-size: 12px; opacity: 0; pointer-events: none; transition: .22s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 960px) {
  .login-shell { grid-template-columns: 1fr; gap: 26px; padding: 34px 24px; }
  .login-copy h1 { font-size: 48px; }
  .login-copy .login-lead, .login-note { display: none; }
  .login-card { align-self: auto; padding: 30px 24px; }
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; padding: 18px; }
  .side-label, .side-bottom { display: none; }
  .side-nav { flex-direction: row; overflow-x: auto; margin-top: 16px; }
  .side-nav button { flex: none; padding: 8px 10px; }
  .side-nav button span { font-size: 11px; }
  .topbar { padding: 24px 20px 16px; }
  .content { padding: 4px 20px 40px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .topbar h1 { font-size: 28px; }
  .top-sub { display: none; }
  .top-actions { gap: 6px; }
  .admin-name { display: none; }
  .drawer { padding: 22px 20px 30px; }
  .stats-grid { gap: 9px; }
  .stat-card { min-height: 110px; padding: 17px; }
  .stat-card strong { font-size: 31px; }
  .toolbar { padding: 12px 14px; }
  .toolbar input { width: 100%; }
  .panel-head { padding: 15px 14px; }
}
