:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e3e6ea;
  --text: #1f2733;
  --muted: #7a8594;
  --primary: #2f6fed;
  --primary-dark: #2559c9;
  --danger: #e04a4a;
  --danger-dark: #c23a3a;
  --on: #1f9d55;
  --off: #9aa4b2;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .06), 0 1px 2px rgba(20, 30, 50, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ===== 顶栏 ===== */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.mainnav { display: flex; gap: 6px; }
.mainnav a {
  padding: 7px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
}
.mainnav a:hover { background: #f0f3f8; color: var(--text); }
.mainnav a.active { background: #eaf1ff; color: var(--primary); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user { color: var(--muted); font-size: 13px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.badge-mock { background: #fff4e0; color: #b7791f; }
.badge-live { background: #e6f6ec; color: var(--on); }

/* ===== 容器 ===== */
.container { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.page-head h1 { font-size: 20px; margin: 0; }

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  transition: all .12s ease;
}
.btn:hover { background: #f0f3f8; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fff; border-color: #f2c4c4; color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: #fff; }
.btn-block { width: 100%; }
.inline { display: inline; margin: 0; }

/* ===== 筛选 ===== */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--card);
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.filters select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  min-width: 130px;
}

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; min-width: 720px; }
table.grid th, table.grid td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.grid th {
  background: #fafbfc;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: none;
}
table.grid tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: #fafbfd; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.col-actions { white-space: nowrap; text-align: right; }
.col-actions .btn, .col-actions form { margin-left: 4px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.count { color: var(--muted); font-size: 12px; margin-top: 12px; }

.tag { background: #eef1f5; color: #4a5566; padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.status { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 20px; }
.status-on { background: #e6f6ec; color: var(--on); }
.status-off { background: #f0f2f5; color: var(--off); }

/* ===== 表单 ===== */
.form { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.form-grid { max-width: 860px; }
.form label { display: block; margin-bottom: 16px; font-weight: 600; font-size: 13px; }
.form input, .form select, .form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  background: #fff;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.12);
}
.form-row { display: flex; gap: 18px; }
.form-row > label { flex: 1; }
.req { color: var(--danger); }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

.sections { border: 1px solid var(--border); border-radius: 6px; padding: 16px; margin-bottom: 16px; }
.sections legend { font-weight: 600; padding: 0 6px; color: var(--muted); }
.section-item { border: 1px dashed var(--border); border-radius: 6px; padding: 12px; margin-bottom: 12px; background: #fafbfc; }
.section-item input, .section-item textarea { margin-top: 0; margin-bottom: 8px; }

/* 图片预览缩略图 */
.img-preview { margin: -4px 0 12px; }
.img-preview img { max-height: 120px; max-width: 220px; border-radius: 8px; border: 1px solid var(--border); object-fit: cover; }

/* 图片上传组件（点击上传网格） */
.uploader { margin: 4px 0 14px; }
.uploader-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.up-cell { position: relative; width: 96px; height: 96px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.up-cell--cover { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.25); }
.up-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-cover-badge { position: absolute; top: 4px; left: 4px; background: #2563eb; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 999px; }
.up-ops { position: absolute; inset: 0; background: rgba(0,0,0,.42); opacity: 0; transition: opacity .15s; display: flex; align-items: center; justify-content: center; gap: 4px; }
.up-cell:hover .up-ops { opacity: 1; }
.up-ops button { width: 24px; height: 24px; border-radius: 6px; border: none; background: rgba(255,255,255,.85); color: #111; font-size: 14px; line-height: 1; cursor: pointer; }
.up-ops button[data-act="del"]:hover { background: #dc2626; color: #fff; }
.up-add { width: 96px; height: 96px; border: 2px dashed var(--border); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; color: var(--muted); background: #fafbfc; }
.up-add:hover { border-color: #2563eb; color: #2563eb; background: #eff4ff; }
.up-plus { font-size: 24px; line-height: 1; }
.up-add-text { font-size: 12px; }

/* 高德地图选点组件 */
.mappicker { position: relative; }
.mp-search { position: relative; display: flex; gap: 8px; margin-bottom: 8px; }
.mp-kw { flex: 1; margin: 0; }
.mp-sug { position: absolute; top: 100%; left: 0; right: 90px; margin-top: 4px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(20,30,50,.12); z-index: 50; max-height: 260px; overflow-y: auto; }
.mp-sug:empty { display: none; }
.mp-sug-item { display: block; width: 100%; text-align: left; border: none; background: none; padding: 8px 12px; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
.mp-sug-item:hover { background: #f8fafc; }
.mp-sug-name { font-size: 14px; color: #0f172a; }
.mp-sug-addr { font-size: 12px; color: var(--muted); }
.mp-map { width: 100%; height: 420px; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }
.mp-fail { display: flex; align-items: center; justify-content: center; height: 100%; padding: 20px; color: var(--muted); font-size: 13px; text-align: center; }
.mp-coord { display: flex; gap: 16px; align-items: center; margin-top: 8px; font-size: 13px; color: #334155; }
.mp-coord b { font-family: ui-monospace, monospace; }

/* 攻略：分天行程块 + 已选地点标签 + 添加下拉 */
.day-block { border: 1px dashed var(--border); border-radius: 8px; padding: 12px; margin-bottom: 12px; background: #fafbfc; }
.day-block > input[name="dayLabel"] { margin-bottom: 8px; }
.picker-row { display: flex; gap: 8px; align-items: center; }
.picker-row select { flex: 1; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #eef2ff; color: #1e3a8a; border: 1px solid #c7d2fe; border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.chip b { cursor: pointer; font-weight: 700; color: #64748b; }
.chip b:hover { color: #dc2626; }

/* 加盟商：覆盖城市多选网格 */
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px 14px; margin: 4px 0 8px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; cursor: pointer; }
.checkbox-item input { width: auto; margin: 0; }

/* ===== 登录 ===== */
.login-wrap { min-height: 82vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 34px 30px; box-shadow: 0 8px 30px rgba(20,30,50,.08); }
.login-title { font-size: 20px; margin: 0 0 4px; text-align: center; }
.login-sub { color: var(--muted); text-align: center; margin: 0 0 22px; font-size: 13px; }
.login-hint { color: var(--muted); font-size: 12px; text-align: center; margin-top: 16px; }

/* ===== 提示 ===== */
.alert { padding: 11px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fdecec; color: var(--danger-dark); border: 1px solid #f5c6c6; }

@media (max-width: 640px) {
  .form-row { flex-direction: column; gap: 0; }
  .topbar-inner { gap: 14px; padding: 0 14px; }
  .brand { font-size: 14px; }
}

/* 云存储图片(cloud:// 文件ID)在浏览器里无法直接预览时的占位块。
   接上真实 AppSecret 后服务端会换成临时链接，这里就会显示真图。 */
.up-cloud {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: #eef2ff; color: #4a5b8c;
}
.up-cloud-icon { font-size: 26px; line-height: 1; }
.up-cloud-txt { font-size: 11px; }
