:root {
  --red: #c62828;
  --red-dark: #8e0000;
  --gold: #e0a13a;
  --ink: #24211e;
  --muted: #8a8580;
  --line: #eee9e2;
  --bg: #f6f3ee;
  --card: #ffffff;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--red); text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  background: #f1ece5; color: #5a524a; transition: .15s;
  white-space: nowrap;
}
.btn:hover { background: #e8e1d8; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: #b21f1f; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: #6b6259; }
.btn.danger { background: #fdecea; color: #c62828; }
.btn.danger:hover { background: #fbd9d6; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #6b6259; margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid #e6e0d8; border-radius: 10px;
  background: #fff; outline: none; transition: .15s; font-size: 15px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(198,40,40,.08); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.6; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 2px 10px rgba(60,40,20,.06); }
.muted { color: var(--muted); font-size: 12px; }
.empty { text-align: center; color: #bcb5ac; padding: 44px 0; font-size: 14px; }

.spinner {
  width: 22px; height: 22px; border: 2.5px solid #eee; border-top-color: var(--red);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 顶部提示条 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: rgba(36,33,30,.92); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 3000;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(30,20,15,.45); z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 460px;
  max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal.wide { max-width: 860px; }
.modal-hd { padding: 18px 20px 12px; font-size: 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.modal-hd .x { font-size: 22px; color: #bbb; line-height: 1; padding: 0 4px; }
.modal-bd { padding: 4px 20px 8px; overflow: auto; }
.modal-ft { padding: 14px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th {
  text-align: left; font-size: 12px; font-weight: 600; color: #8a8077;
  padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fbf9f6;
}
table.grid td { padding: 10px 8px; border-bottom: 1px solid #f5f1ec; vertical-align: middle; }
table.grid tr:hover td { background: #fdfbf8; }
table.grid td.num { font-variant-numeric: tabular-nums; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; line-height: 1.7; }
.tag.on { background: #e8f5e9; color: #2e7d32; }
.tag.off { background: #f2f0ed; color: #8a8077; }
.tag.admin { background: #fff3e0; color: #e65100; }
.tag.viewer { background: #eef3fb; color: #4573a7; }
