* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #222;
}
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff4d6a 0%, #ff8a65 100%);
}
.login-card {
  width: 340px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px 28px;
  box-shadow: 0 12px 40px rgba(0,0,0,.15);
  text-align: center;
}
.login-logo { font-size: 26px; font-weight: 700; color: #ff2e4d; }
.login-sub { font-size: 13px; color: #999; margin: 6px 0 24px; }
.login-card input {
  width: 100%;
  height: 44px;
  border: 1px solid #e3e4e8;
  border-radius: 10px;
  padding: 0 14px;
  outline: none;
}
.login-card input:focus { border-color: #ff6b81; }
.login-card button {
  width: 100%;
  height: 44px;
  margin-top: 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff4d6a, #ff6b81);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}
.login-msg { color: #e0243f; font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- 主框架 ---------- */
.topbar {
  height: 56px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid #eceef1;
}
.brand { font-weight: 700; font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar select {
  height: 34px;
  border: 1px solid #dcdfe5;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  max-width: 220px;
}
.ghost-btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid #dcdfe5;
  border-radius: 8px;
  background: #fff;
  color: #444;
}
.ghost-btn:hover { border-color: #ff6b81; color: #ff2e4d; }
.primary-btn {
  height: 36px;
  padding: 0 18px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff4d6a, #ff6b81);
  color: #fff;
  font-weight: 600;
}
.primary-btn:hover { opacity: .92; }

.tabs {
  display: flex;
  gap: 4px;
  background: #fff;
  padding: 0 24px;
  border-bottom: 1px solid #eceef1;
}
.tab {
  padding: 13px 20px;
  font-size: 15px;
  color: #666;
  border-bottom: 2px solid transparent;
}
.tab.active { color: #ff2e4d; border-bottom-color: #ff2e4d; font-weight: 600; }

.content { max-width: 960px; margin: 24px auto; padding: 0 24px; }

/* ---------- 数据卡片 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.stat-num { font-size: 32px; font-weight: 700; }
.stat-label { color: #888; font-size: 13px; margin-top: 6px; }
.stat-card.blue .stat-num { color: #2f7cf6; }
.stat-card.red .stat-num { color: #ff2e4d; }
.panel-title { margin: 28px 0 12px; font-size: 16px; }
.notes-list { background: #fff; border-radius: 12px; overflow: hidden; }
.note-row {
  padding: 14px 18px;
  border-bottom: 1px solid #f2f3f5;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.note-row:last-child { border-bottom: none; }
.note-row .time { color: #999; font-size: 12px; white-space: nowrap; margin-left: 16px; }
.empty-tip { text-align: center; color: #aaa; padding: 40px 0; font-size: 14px; }

/* ---------- 面板头部 ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 16px; }
.panel-tip { color: #888; font-size: 13px; flex: 1; }
.panel-tip b { color: #ff2e4d; }
.panel-t { font-size: 16px; font-weight: 600; }

/* ---------- 文案列表 ---------- */
.tpl-list { display: flex; flex-direction: column; gap: 12px; }
.tpl-item {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.tpl-item.off { opacity: .55; }
.tpl-item-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tpl-item-title { font-weight: 600; font-size: 15px; }
.tpl-item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.link-btn { border: none; background: none; color: #2f7cf6; font-size: 13px; }
.link-btn.danger { color: #e0243f; }
.tpl-item-desc {
  color: #555; font-size: 13px; line-height: 1.7; margin: 8px 0;
  white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tpl-item-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { background: #fff0f3; color: #ff2e4d; font-size: 12px; padding: 2px 10px; border-radius: 20px; }

/* ---------- 图片 ---------- */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.img-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #eee;
}
.img-cell img { width: 100%; height: 100%; object-fit: cover; }
.img-del {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.55); color: #fff;
  font-size: 15px; line-height: 1;
}

/* ---------- 商家表格 ---------- */
.mch-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.mch-table th, .mch-table td { padding: 13px 14px; font-size: 14px; text-align: left; border-bottom: 1px solid #f2f3f5; }
.mch-table th { background: #fafbfc; color: #888; font-weight: 500; font-size: 13px; }
.status-badge { font-size: 12px; padding: 2px 10px; border-radius: 20px; }
.status-on { background: #e6f7ec; color: #18a058; }
.status-off { background: #f3f4f6; color: #999; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-mask[hidden] { display: none !important; }
.modal { width: 520px; max-width: 92vw; background: #fff; border-radius: 16px; max-height: 88vh; display: flex; flex-direction: column; }
.modal-head {
  padding: 18px 22px; font-size: 16px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #f2f3f5;
}
.modal-close { font-size: 22px; color: #999; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid #f2f3f5; display: flex; justify-content: flex-end; gap: 10px; }
.field { display: block; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 13px; color: #666; margin-bottom: 7px; }
.field-label em { color: #999; font-style: normal; float: right; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid #dcdfe5;
  border-radius: 9px;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: #ff6b81; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: 38%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.78); color: #fff;
  padding: 11px 22px; border-radius: 10px;
  font-size: 14px; z-index: 200;
  max-width: 80vw;
}

@media (max-width: 640px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .brand { display: none; }
  .content { padding: 0 14px; }
}
