:root {
  --primary: #E8618C;
  --primary-dark: #D14E78;
  --secondary: #F5A9B8;
  --bg-pink: #FFF7F9;
  --text: #3A2E33;
  --text-light: #8A7A80;
  --border: #F2D7DE;
  --card: #FFFFFF;
  --success: #7BC8A4;
  --danger: #E8618C;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(232, 97, 140, 0.08);
  --shadow-lg: 0 8px 30px rgba(232, 97, 140, 0.14);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg-pink);
  font-size: 14px;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FFF0F4 0%, #FFE3EC 50%, #FFF7F9 100%);
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo { font-size: 52px; margin-bottom: 8px; }
.login-title { font-size: 24px; color: var(--primary); margin-bottom: 4px; }
.login-sub { color: var(--text-light); font-size: 13px; margin-bottom: 24px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 10px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-icon { font-size: 28px; }
.sidebar-logo-text { display: flex; flex-direction: column; line-height: 1.3; }
.sidebar-logo-text strong { color: var(--primary); font-size: 16px; }
.sidebar-logo-text small { color: var(--text-light); font-size: 12px; }

.sidebar-nav { padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  margin-bottom: 4px;
  transition: background .18s, color .18s;
  font-size: 14px;
}
.nav-item:hover { background: var(--bg-pink); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .nav-icon { font-size: 16px; }

.main { flex: 1; margin-left: 220px; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h2 { font-size: 18px; font-weight: 600; }

.content { padding: 24px 28px; flex: 1; }

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

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
.card-sub { font-size: 13px; color: var(--text-light); margin: -10px 0 14px; }

/* ---------- 统计卡片 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}
.stat-card .stat-label { color: var(--text-light); font-size: 13px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--primary); margin-top: 6px; }
.stat-card .stat-icon { font-size: 22px; margin-bottom: 6px; }

@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 图表 ---------- */
.chart-row { display: flex; gap: 20px; flex-wrap: wrap; }
.chart-col { flex: 1; min-width: 300px; }

.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 220px; padding-top: 10px; }
.bar-group { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: 100%; }
.bar-wrap { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; width: 100%; }
.bar {
  width: 100%;
  max-width: 30px;
  border-radius: 6px 6px 0 0;
  min-height: 2px;
  transition: height .3s;
}
.bar.assessments { background: var(--primary); }
.bar.checkins { background: var(--secondary); }
.bar.chat { background: #B9A0E8; }
.bar-axis-label { font-size: 11px; color: var(--text-light); margin-top: 6px; white-space: nowrap; }
.chart-legend { display: flex; gap: 16px; margin-bottom: 8px; font-size: 12px; color: var(--text-light); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

.hbar-row { display: flex; align-items: center; margin-bottom: 10px; gap: 10px; }
.hbar-label { width: 90px; text-align: right; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { flex: 1; background: #FBEFF3; border-radius: 6px; height: 18px; overflow: hidden; }
.hbar-fill { height: 100%; background: linear-gradient(90deg, var(--secondary), var(--primary)); border-radius: 6px; }
.hbar-value { width: 46px; font-size: 12px; color: var(--text-light); }

/* ---------- 表单 ---------- */
.input, .textarea, select.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  font-family: inherit;
}
.input:focus, .textarea:focus, select.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232, 97, 140, .1);
}
.textarea { resize: vertical; min-height: 80px; }
.field-label { display: block; font-size: 13px; color: var(--text-light); margin: 12px 0 6px; font-weight: 500; }
.field-label:first-child { margin-top: 0; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.color-input { width: 48px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }

/* ---------- Tab ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 9px 16px;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  color: var(--text-light);
  font-size: 14px;
  border: none;
  background: transparent;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); font-weight: 600; border-bottom: 2px solid var(--primary); }

/* ---------- 列表项 ---------- */
.list-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  background: #fff;
}
.list-item .item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.item-title { font-weight: 600; font-size: 14px; }
.item-del { cursor: pointer; color: var(--danger); font-size: 13px; }

.option-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.option-row .input { flex: 1; }

.advice-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.advice-row .input { flex: 1; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.switch-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.switch-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-light); font-weight: 500; background: #FFFBFD; }
.table tr:hover td { background: #FFFBFD; }

/* ---------- 文章 ---------- */
.article-card { display: flex; align-items: center; gap: 16px; }
.article-info { flex: 1; min-width: 0; }
.article-title-text { font-weight: 600; }
.article-meta { font-size: 12px; color: var(--text-light); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; }
.badge-on { background: #E3F5EC; color: #3E9E73; }
.badge-off { background: #F1F1F1; color: #999; }

/* ---------- 空状态 / 加载 ---------- */
.empty { text-align: center; color: var(--text-light); padding: 30px 10px; font-size: 13px; }
.loading { text-align: center; color: var(--text-light); padding: 30px 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #3A2E33;
  color: #fff;
  padding: 11px 22px;
  border-radius: 30px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all .3s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #3E9E73; }
.toast.error { background: var(--danger); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(58, 46, 51, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; }
.modal-close { border: none; background: transparent; font-size: 24px; cursor: pointer; color: var(--text-light); }
.modal-body { padding: 20px 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }

/* ---------- 通用 ---------- */
.section-mt { margin-top: 20px; }
.muted { color: var(--text-light); }
.qr-preview { margin-top: 12px; }
.qr-preview img { max-width: 220px; border-radius: 12px; border: 1px solid var(--border); }
