* { box-sizing: border-box; }
:root {
  --bg: #f6f2e9;
  --surface: #fffdf8;
  --surface-2: #faf6ed;
  --ink: #2c2a26;
  --ink-2: #6b6558;
  --ink-3: #9a9384;
  --line: #e6dfd0;
  --gold: #a8813c;
  --gold-soft: #f3ead6;
  --green: #3f7d4f;
  --red: #b0473b;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}
html, body { margin: 0; padding: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.6; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 16px; font-weight: 500; transition: .15s; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.primary:hover { background: #8f6d31; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; padding: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link-btn { border: 0; background: none; color: var(--ink-2); text-decoration: underline; padding: 4px 0; }
.link-btn:hover { color: var(--gold); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: var(--surface);
  border-radius: 8px; padding: 10px 12px; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--gold); }
.field textarea { min-height: 84px; resize: vertical; }
.field-hint { display: block; font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.form-error { background: #fdf0ed; border: 1px solid #f0cfc8; color: var(--red); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 32px; }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-mark, .side-mark { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--gold); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 500; }
.login-title { font-size: 19px; font-weight: 500; }
.login-sub { font-size: 12px; color: var(--ink-3); letter-spacing: 2px; }
.login-tip { color: var(--ink-2); font-size: 13px; margin: 22px 0 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.login-foot { display: flex; flex-direction: column; gap: 6px; margin-top: 20px; font-size: 12px; color: var(--ink-3); text-align: center; }
.login-diag { color: var(--red); }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex: none; background: #2f2c26; color: #efe9dc; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,.09); }
.side-name { font-size: 15px; font-weight: 500; }
.side-name span { display: block; font-size: 11px; font-weight: 400; color: #a9a294; letter-spacing: 1px; margin-top: 2px; }
.side-nav { padding: 18px 12px; flex: 1; }
.nav-item { width: 100%; text-align: left; border: 0; background: none; color: #c9c2b4; padding: 11px 14px; border-radius: 9px; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(168,129,60,.28); color: #fff; }
.badge { background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.side-foot { padding: 18px 20px 22px; border-top: 1px solid rgba(255,255,255,.09); font-size: 12px; color: #a9a294; display: flex; flex-direction: column; gap: 8px; }
.side-user { color: #efe9dc; }

.main { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 22px 32px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 500; }
.topbar p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.sync-time { font-size: 12px; color: var(--ink-3); }
.content { padding: 28px 32px 48px; max-width: 1180px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat-label { font-size: 12px; color: var(--ink-3); }
.stat-value { font-size: 28px; font-weight: 500; margin-top: 6px; }
.stat-note { font-size: 12px; color: var(--ink-2); margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 500; }
.card-head .sub { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: 8px; }
.notice { background: var(--gold-soft); border: 1px solid #e8d7b4; color: #6f572c; border-radius: 10px; padding: 12px 16px; font-size: 13px; margin-top: 18px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #f0ebdf; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.row-title { font-weight: 500; }
.row-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #eee9dc; color: var(--ink-2); }
.tag.published { background: #e6f2e8; color: var(--green); }
.tag.draft { background: #f1ece0; color: #8a7444; }
.tag.archived, .tag.hidden, .tag.rejected { background: #f2e5e2; color: var(--red); }
.tag.pending { background: #fdf0d9; color: #946818; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.mini { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 5px 10px; font-size: 12px; }
.mini:hover { border-color: var(--gold); }
.mini.danger { color: var(--red); }
.empty { text-align: center; color: var(--ink-3); padding: 34px 0; font-size: 13px; }
.loading { text-align: center; color: var(--ink-3); padding: 40px 0; }

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-mask { position: absolute; inset: 0; background: rgba(30,27,22,.45); }
.modal-box { position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--surface); border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.18); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 500; }
.modal-close { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--ink-3); }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px 22px; display: flex; justify-content: flex-end; gap: 10px; align-items: center; border-top: 1px solid var(--line); }
.modal-foot .form-error { flex: 1; margin: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-row .field { margin-bottom: 14px; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #2f2c26; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 13px; z-index: 80; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.error { background: var(--red); }

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .side-brand { border: 0; padding: 14px 16px; }
  .side-nav { display: flex; padding: 8px 12px; flex-wrap: wrap; flex: 1; }
  .nav-item { width: auto; margin: 0 4px 4px 0; }
  .side-foot { border: 0; padding: 12px 16px; flex-direction: row; gap: 14px; }
  .topbar { padding: 16px 18px; }
  .content { padding: 18px; }
  .form-row { grid-template-columns: 1fr; }
}
