/* ===== 合成五虎 · 管理后台 白色卡片风格 ===== */
:root {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
  color: #23262b;
  background: #eef1f5;
  --red: #9f2d25;
  --red-dark: #7e211c;
  --red-soft: #fdf0ef;
  --line: #e4e8ee;
  --line-strong: #d5dbe3;
  --muted: #6b7280;
  --green: #1f7a4d;
  --card: #ffffff;
  --bg: #eef1f5;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: #23262b;
}

button, input, textarea, select { font: inherit; letter-spacing: 0; }

/* ---------- 按钮 ---------- */
button {
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #33383e;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
button:hover { border-color: #b6bec7; background: #f7f8fa; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

button.primary {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 1px 2px rgba(159, 45, 37, .25);
}
button.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }

button.quiet {
  height: 30px;
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}
button.quiet:hover { background: rgba(0, 0, 0, .04); border-color: transparent; }

button.ghost { background: #fff; }
button.ghost.active {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-soft);
  font-weight: 600;
}

button.danger { color: #b42318; border-color: #ecc6c2; background: #fff; }
button.danger:hover { background: #fdf0ef; border-color: #dfa39d; }

/* ---------- 输入 ---------- */
input, textarea, select {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #33383e;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(159, 45, 37, .12);
}
input:disabled, textarea:disabled { background: #f4f6f8; color: #9aa1a8; }
textarea { resize: vertical; }

/* ---------- 登录页 ---------- */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, #e8ecf2 0%, #f4f6f9 60%, #faf7f2 100%);
}
.login-panel {
  width: min(400px, 100%);
  background: var(--card);
  border-radius: var(--radius);
  padding: 36px 32px 28px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.login-panel::before {
  content: "";
  display: block;
  width: 48px;
  height: 5px;
  border-radius: 3px;
  background: var(--red);
  margin-bottom: 18px;
}
.brand-mark { margin: 0; color: var(--red); font-weight: 700; font-size: 14px; letter-spacing: 2px; }
.login-panel h1 { margin: 6px 0 22px; font-size: 26px; color: #1c1f24; }
.login-panel label,
.editor-panel label {
  display: grid;
  gap: 7px;
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 600;
  color: #4b5259;
}
.login-panel input, .login-panel textarea, .editor-panel input, .editor-panel textarea, .search input { width: 100%; }
.login-panel button { width: 100%; margin-top: 4px; }
.error { min-height: 20px; margin: 12px 0 0; color: #b42318; font-size: 13px; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 60px;
  background: var(--card);
  color: #23262b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar strong { font-size: 18px; color: #1c1f24; }
.topbar strong::before {
  content: "虎";
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  background: var(--red);
  color: #fff;
  border-radius: 8px;
  font-size: 15px;
  margin-right: 10px;
  vertical-align: -5px;
}
.topbar span { margin-left: 12px; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions > span {
  font-size: 13px;
  color: var(--muted);
  background: #f2f4f7;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------- 标签页 ---------- */
.tabs {
  height: 52px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  display: flex;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.tabs button {
  height: 52px;
  padding: 0 6px;
  margin: 0 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  font-weight: 600;
  color: #5b626a;
}
.tabs button:hover { background: none; color: var(--red); }
.tabs button.active { color: var(--red); border-bottom-color: var(--red); }

/* ---------- 页面布局 ---------- */
.tab-page { display: none; padding: 24px 28px 40px; max-width: 1500px; margin: 0 auto; }
.tab-page.active { display: block; }

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 18px;
}
.page-heading h2 { margin: 0 0 4px; font-size: 22px; color: #1c1f24; }
.page-heading p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- 搜索 ---------- */
.search { display: flex; width: min(480px, 100%); }
.search select { min-width: 130px; border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding: 0 10px; color: #35393c; }
.search input { border-radius: 0; }
.search button { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; min-width: 68px; }
.search select:focus, .search input:focus { box-shadow: none; }

/* ---------- 玩家布局 ---------- */
.user-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.1fr) minmax(440px, .9fr);
  gap: 16px;
  align-items: start;
}
.split-layout { display: grid; grid-template-columns: minmax(360px, 440px) 1fr; gap: 16px; align-items: start; }

/* ---------- 卡片 ---------- */
.table-wrap,
.detail-panel,
.editor-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.table-wrap { overflow: hidden; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid #eef0f4; font-size: 13px; vertical-align: top; }
th { background: #f7f8fa; color: #5b626a; font-weight: 600; }
tbody tr[data-id] { cursor: pointer; transition: background .12s; }
tbody tr[data-id]:hover { background: #faf6f4; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- 状态 ---------- */
.status {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e8f4ed;
  color: var(--green);
}
.status.banned { background: #fbe9e7; color: #a3281f; }
.muted { color: var(--muted); font-size: 12px; }

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid #eef0f4;
}

/* ---------- 详情面板 ---------- */
.detail-panel { min-height: 420px; padding: 20px; }
.detail-panel.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}
.detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}
.detail-header h3 { margin: 0 0 5px; font-size: 18px; color: #1c1f24; }
.detail-actions { display: flex; gap: 8px; }
.detail-section { padding-top: 18px; }
.detail-section h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #33383e;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-section h4::before {
  content: "";
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--red);
}

/* ---------- 存档摘要 ---------- */
.save-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}
.save-metric {
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  transition: box-shadow .15s;
}
.save-metric:hover { box-shadow: var(--shadow-sm); }
.save-metric .label { font-size: 11px; color: var(--muted); }
.save-metric .value { font-size: 15px; font-weight: 600; margin-top: 2px; color: #23262b; }

/* ---------- 存档编辑器 ---------- */
.save-editor {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: 12px/1.55 Consolas, "Courier New", monospace;
  resize: vertical;
  tab-size: 2;
}
.reason-row { display: flex; gap: 8px; margin-top: 10px; }
.reason-row input { flex: 1; min-width: 0; }

/* 模式切换 */
.mode-switch {
  display: inline-flex;
  gap: 4px;
  background: #f2f4f7;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  margin-left: auto;
}
.mode-switch button {
  height: 28px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.mode-switch button.active {
  background: #fff;
  color: var(--red);
  box-shadow: var(--shadow-sm);
}

/* 表单模式 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.form-field { display: grid; gap: 6px; }
.form-field > span { font-size: 12px; font-weight: 600; color: #4b5259; }
.form-field input, .form-field select { width: 100%; }
.form-field .hint { font-size: 11px; color: var(--muted); font-weight: 400; }
.form-field.full { grid-column: 1 / -1; }

.field-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fbfcfe;
  transition: background .15s;
}
.field-group:hover { background: #f7f9fc; }
.field-group.collapsed { padding: 8px 12px; background: #fbfcfe; }
.field-group.collapsed .form-grid { display: none; }
.field-group legend {
  padding: 0 8px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #33383e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.field-group legend:hover { color: var(--red); }
.fold-arrow {
  display: inline-block;
  width: 18px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  transition: transform .15s;
}
.field-group.collapsed .fold-arrow { color: var(--red); }
.field-group-title {
  font-size: 12px;
  font-weight: 700;
  color: #33383e;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 键值对编辑器 */
.kv-editor { display: grid; gap: 8px; }
.kv-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}
.kv-row input { padding: 7px 10px; }
.kv-row button {
  height: 32px;
  width: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border-color: #e8c9c4;
  color: #a3281f;
  background: #fff;
  border-radius: var(--radius-sm);
}
.kv-row button:hover { background: #fdf0ef; }

/* 进度行（星级等） */
.progress-list { display: grid; gap: 8px; }
.progress-row {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 8px;
  align-items: center;
}
.progress-row .p-label { font-size: 13px; color: #33383e; }
.progress-row input { padding: 7px 10px; }

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

/* ---------- 审计 ---------- */
.audit-list { display: grid; gap: 8px; max-height: 460px; overflow: auto; padding-right: 4px; }
.audit-item {
  border-left: 3px solid #c9cfd6;
  padding: 10px 12px;
  background: #f7f8fa;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.audit-item strong { font-size: 13px; color: #33383e; }
.audit-item pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 6px 0 0;
  color: #4e5459;
  font-size: 11px;
  line-height: 1.6;
}

/* ---------- 编辑面板（公告/礼包） ---------- */
.editor-panel { padding: 20px; }
.editor-panel textarea { font: 13px Consolas, "Microsoft YaHei", sans-serif; }
.form-row { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px; }
.editor-panel label.check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-weight: 400; }
.editor-panel label.check input { width: auto; }
.editor-panel small { color: var(--muted); font-weight: 400; }
.button-row { display: flex; gap: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 380px;
  background: #272c30;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .user-layout, .split-layout { grid-template-columns: 1fr; }
  .tab-page { padding: 18px; }
  .detail-panel { min-height: 0; }
}
@media (max-width: 640px) {
  .topbar, .tabs { padding-left: 14px; padding-right: 14px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .user-layout { display: block; }
  .detail-panel { margin-top: 14px; }
  .table-wrap { overflow-x: auto; }
  .form-row { grid-template-columns: 1fr; }
  .tabs { gap: 8px; }
  .tabs button { font-size: 13px; margin: 0 6px; }
  .topbar span { display: none; }
  .kv-row { grid-template-columns: 1fr 1fr auto; }
}
