/* ===== Maoxian PC 管理台样式 ===== */
:root {
  --primary: #8e6e5a;
  --primary-dark: #6f5443;
  --primary-light: #f4ede6;
  --accent: #c9a27e;
  --bg: #f7f4f0;
  --card: #ffffff;
  --text: #3a322c;
  --text-2: #857a6f;
  --border: #e8e0d6;
  --danger: #c0392b;
  --success: #2e7d5b;
  --shadow: 0 2px 10px rgba(90, 70, 50, 0.08);
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 60px;
  padding: 0 28px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: 0.5px; }

.nav { display: flex; gap: 6px; flex: 1; }
.nav a {
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  transition: all .2s;
}
.nav a:hover { background: var(--primary-light); color: var(--primary-dark); }
.nav a.active { background: var(--primary); color: #fff; font-weight: 500; }

.userbox { display: flex; align-items: center; gap: 12px; }
.user-info { font-size: 13px; color: var(--text-2); }
.user-info strong { color: var(--primary-dark); }
.role-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: var(--primary-light);
  color: var(--primary-dark);
}
.role-tag.admin { background: #fdecea; color: var(--danger); }

/* ===== 主区域 ===== */
.main { max-width: 1160px; margin: 0 auto; padding: 28px 20px 60px; }

/* 页面标题 */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-title { font-size: 20px; font-weight: 700; }
.page-sub { margin-top: 4px; font-size: 13px; color: var(--text-2); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
  background: var(--primary);
  color: #fff;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--primary-light); color: var(--primary-dark); }
.btn-danger { background: #fdecea; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.mt-12 { margin-top: 12px; }

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.stat-num { font-size: 30px; font-weight: 700; color: var(--primary-dark); }
.stat-label { margin-top: 6px; font-size: 13px; color: var(--text-2); }

/* ===== 围巾卡片网格 ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}
.scarf-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all .2s;
}
.scarf-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(90, 70, 50, 0.12); }
.scarf-color {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.scarf-rows { font-size: 18px; font-weight: 700; }
.scarf-meta { margin-top: 8px; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.scarf-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.scarf-actions { display: flex; gap: 6px; }

/* ===== 状态标签 ===== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
}
.bad-wip { background: #fff4e2; color: #b07c1f; }
.bad-done { background: #e6f4ec; color: var(--success); }
.bad-sent { background: #e8edf7; color: #3d5f9e; }

/* ===== 图文卡片 ===== */
.timeline { display: flex; flex-direction: column; gap: 18px; }
.post-card {
  display: flex;
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.post-img {
  width: 200px;
  height: 200px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 8px;
  background: var(--primary-light);
}
.post-body { flex: 1; display: flex; flex-direction: column; }
.post-date { font-size: 13px; color: var(--text-2); }
.post-text { margin-top: 10px; font-size: 15px; line-height: 1.8; white-space: pre-wrap; flex: 1; }
.post-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.like-btn { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.like-btn.liked { color: var(--danger); font-weight: 600; }
.post-tags { display: flex; gap: 8px; }

/* ===== 分页 ===== */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 26px; }
.pager-info { font-size: 13px; color: var(--text-2); }

/* ===== 表单 ===== */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-item label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-2); }
.form-item input, .form-item select, .form-item textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary); }
.form-item textarea { resize: vertical; min-height: 90px; }
.form-tip { font-size: 12px; color: var(--text-2); }

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(50, 40, 30, 0.45);
}
.modal {
  width: 440px;
  max-width: 92vw;
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--text-2); cursor: pointer; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ===== 登录页 ===== */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f4ede6 0%, #e8dccf 100%);
}
.auth-card {
  width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 34px;
  box-shadow: 0 14px 44px rgba(90, 70, 50, 0.18);
}
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 26px;
  font-weight: 800;
}
.auth-title { font-size: 20px; font-weight: 700; }
.auth-sub { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
.auth-hint { margin-top: 16px; text-align: center; font-size: 12px; color: var(--text-2); }

/* ===== 空状态 ===== */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-2);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ===== 每日签到 ===== */
.checkin-panel {
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.checkin-tip {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-2);
}
.checkin-history { display: flex; flex-direction: column; gap: 8px; }
.ck-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ck-date { font-size: 14px; font-weight: 600; min-width: 110px; }
.ck-points { margin-left: auto; font-size: 14px; color: var(--primary-dark); font-weight: 700; }

/* ===== 用户管理 ===== */
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.filter-bar input {
  flex: 1;
  max-width: 320px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.filter-bar input:focus { border-color: var(--primary); }
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}
.user-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.user-table th, .user-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.user-table th { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; white-space: nowrap; }
.user-table tr:last-child td { border-bottom: none; }
.user-table tbody tr:hover td { background: #fbf8f4; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.role-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  color: var(--text);
}
.role-select:disabled { opacity: .6; cursor: not-allowed; }
.btn-warn { background: #fff4e2; color: #b07c1f; }
.btn-warn:hover { background: #b07c1f; color: #fff; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.tag-ok { background: #e6f4ec; color: var(--success); }
.tag-off { background: #fdecea; color: var(--danger); }
.tag-self { background: var(--primary-light); color: var(--primary-dark); }

/* ===== 系统设置 ===== */
.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 24px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-info .setting-name { font-size: 15px; font-weight: 600; color: var(--text); }
.setting-desc { margin-top: 4px; font-size: 13px; color: var(--text-2); line-height: 1.6; }
/* 开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: #d9d2c9;
  border-radius: 26px;
  transition: background .2s;
  cursor: pointer;
}
.switch .slider:before {
  content: "";
  position: absolute; left: 3px; top: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  padding: 10px 22px;
  border-radius: 8px;
  background: rgba(50, 40, 30, 0.92);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
.toast.err { background: rgba(192, 57, 43, 0.95); }

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .post-card { flex-direction: column; }
  .post-img { width: 100%; height: auto; }
  .topbar { gap: 12px; padding: 0 14px; }
  .brand-name { display: none; }
}