/* 管理后台样式 · 深色侧边栏 + 浅色内容区 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f0f2f5;
  color: #23262f;
  font-size: 14px;
}

.hidden { display: none !important; }

/* ===== 登录 ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1f6ff2, #4a9bff);
}

.login-card {
  width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: #1f6ff2;
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  line-height: 64px;
}

.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-sub { color: #9aa0aa; font-size: 13px; margin-bottom: 24px; }

.login-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 14px;
  outline: none;
}
.login-input:focus { border-color: #1f6ff2; }

.login-btn {
  width: 100%;
  padding: 12px 0;
  background: #1f6ff2;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.login-btn:hover { background: #185fd0; }

.login-err { color: #ff5f5f; font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ===== 主框架 ===== */
.app-wrap { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: #161d29;
  color: #cfd6e2;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #1f6ff2;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 34px;
  text-align: center;
}

.side-nav { flex: 1; padding: 10px 0; }

.nav-item {
  display: block;
  padding: 13px 22px;
  color: #cfd6e2;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: #1e2636; color: #fff; }
.nav-item.active { background: #1e2636; color: #4a9bff; border-left-color: #1f6ff2; }

.side-foot {
  padding: 16px 20px;
  border-top: 1px solid #262e3d;
  font-size: 13px;
  color: #9aa0aa;
}

.logout-btn {
  float: right;
  background: none;
  border: 1px solid #4a5568;
  color: #cfd6e2;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
}

.main {
  flex: 1;
  margin-left: 220px;
  padding: 0 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  border-bottom: 1px solid #e3e7ee;
}

.topbar h2 { font-size: 18px; }
.topbar-tip { color: #9aa0aa; font-size: 12px; }

.content { padding: 20px 0 40px; }

/* ===== 卡片与统计 ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border-left: 4px solid #1f6ff2;
}

.stat-card.green { border-left-color: #2bb673; }
.stat-card.orange { border-left-color: #f5a623; }
.stat-card.red { border-left-color: #ff5f5f; }

.stat-label { color: #9aa0aa; font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-sub { color: #9aa0aa; font-size: 12px; margin-top: 4px; }

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.card h3 { font-size: 15px; margin-bottom: 16px; }

/* ===== 表格 ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f0f2f5;
  white-space: nowrap;
}

th { color: #9aa0aa; font-weight: 600; background: #fafbfc; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
}
.tag-blue { background: #e8f3ff; color: #1f6ff2; }
.tag-green { background: #e8f8ef; color: #2bb673; }
.tag-gray { background: #f0f2f5; color: #8a8f99; }
.tag-orange { background: #fff7e6; color: #b8860b; }
.tag-red { background: #ffecec; color: #ff5f5f; }

/* ===== 表单与按钮 ===== */
.btn {
  padding: 7px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn-primary { background: #1f6ff2; color: #fff; }
.btn-plain { background: #f0f2f5; color: #3a3f47; }
.btn-danger { background: #ffecec; color: #ff5f5f; }

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

.input, .select {
  padding: 8px 12px;
  border: 1px solid #dfe3ea;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #fff;
}
.input:focus, .select:focus { border-color: #1f6ff2; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; color: #9aa0aa; font-size: 13px; }

/* ===== 趋势条形 ===== */
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bar-label { width: 100px; color: #9aa0aa; font-size: 12px; }
.bar-track { flex: 1; height: 14px; background: #f0f2f5; border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; background: #1f6ff2; border-radius: 7px; min-width: 2px; }

/* ===== 模板编辑 ===== */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.tpl-card { background: #fff; border-radius: 12px; padding: 18px; }
.tpl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tpl-script { background: #fafbfc; border-radius: 8px; padding: 10px; font-size: 12px; color: #5a6068; margin-bottom: 8px; line-height: 1.6; }
.tpl-form label { display: block; font-size: 12px; color: #9aa0aa; margin: 10px 0 4px; }
.tpl-form textarea { width: 100%; height: 70px; border: 1px solid #dfe3ea; border-radius: 6px; padding: 8px; font-size: 13px; }
.tpl-form input { width: 100%; padding: 8px; border: 1px solid #dfe3ea; border-radius: 6px; font-size: 13px; }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 520px;
  max-width: 92vw;
  max-height: 86vh;
  overflow: auto;
  padding: 24px;
}

.modal h3 { margin-bottom: 16px; }
.modal .btn { margin-top: 16px; margin-right: 8px; }
