/* ============ 后台管理样式 ============ */
:root {
  --green: #0e9f6e;
  --green-d: #057a55;
  --green-l: #ecfdf5;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f7f5;
  --card: #ffffff;
  --danger: #dc2626;
  --radius: 12px;
}

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

body.admin-body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* ---------- 顶栏 ---------- */
.admin-topbar {
  background: linear-gradient(150deg, #0f766e, #0e9f6e);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-topbar .brand { font-size: 15px; font-weight: 600; letter-spacing: 1px; white-space: nowrap; }
.admin-nav { display: flex; gap: 4px; flex: 1; }
.admin-nav a {
  font-size: 13.5px; padding: 6px 12px; border-radius: 8px;
  color: rgba(255,255,255,.85); white-space: nowrap;
}
.admin-nav a:hover { background: rgba(255,255,255,.15); color: #fff; }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.admin-user a { color: rgba(255,255,255,.85); }
.admin-user a:hover { color: #fff; text-decoration: underline; }
.admin-user .logout { opacity: .8; }

/* ---------- 主区 ---------- */
.admin-main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}
.admin-page-title { font-size: 17px; font-weight: 600; }
.admin-footer {
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  display: flex; justify-content: space-between;
  font-size: 12px; color: #9ca3af;
  background: #fff;
}
.admin-footer a { text-decoration: underline; }

/* ---------- 登录页 ---------- */
.login-page { align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 10px 34px rgba(6,78,59,.12);
  width: 100%; max-width: 380px;
  padding: 34px 30px;
}
.login-logo {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(150deg,#0f766e,#10b981);
  color: #fff; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.login-card h1 { font-size: 19px; }
.login-sub { font-size: 13px; color: var(--muted); margin: 6px 0 20px; }
.login-actions { margin-top: 4px; }
.login-actions .btn { padding: 10px 15px; font-size: 14px; }
.login-back { display: block; text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--muted); }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: #374151; font-weight: 500; }
.field > span i { color: var(--danger); font-style: normal; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font-size: 14px; font-family: inherit; color: var(--ink);
  background: #fff; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field-row .field:last-child { flex: 0 0 45%; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 9px; padding: 8px 15px;
  font-size: 13.5px; cursor: pointer; font-family: inherit;
  transition: background .15s;
  white-space: nowrap;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-d); }
.btn-small { padding: 5px 11px; font-size: 12.5px; }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-block { width: 100%; }

.alert { border-radius: 10px; padding: 11px 14px; font-size: 13.5px; margin-bottom: 16px; }
.alert-ok { background: var(--green-l); border: 1px solid #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ---------- 首页 ---------- */
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 26px;
}
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 4px;
}
.stat-card b { font-size: 26px; color: var(--green-d); font-weight: 600; }
.stat-card span { font-size: 12.5px; color: var(--muted); }

.nav-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.nav-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s, transform .15s;
}
.nav-card:hover { border-color: #a7f3d0; transform: translateY(-2px); }
.nav-card b { font-size: 15px; }
.nav-card small { font-size: 12.5px; color: var(--muted); line-height: 1.6; }

/* ---------- 表格 ---------- */
.table-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; overflow-x: auto;
}

/* ---------- 显示设置 ---------- */
.settings-card h3 { font-size: 15px; margin-bottom: 8px; }
.settings-note { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin-bottom: 18px; }
.settings-note b { color: var(--ink); }
.settings-card .field input { max-width: 160px; }
.settings-card .field select { max-width: 340px; }
.settings-card + .settings-card { margin-top: 16px; }

/* 首页初始显示：全部 / 指定 勾选列表 */
.home-group {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px;
}
.hg-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.hg-title { font-size: 13.5px; font-weight: 600; }
.hg-mode { display: flex; gap: 16px; }
.hg-mode label {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 400; cursor: pointer; color: #374151;
}
.hg-mode input[type=radio], .pick-list input[type=checkbox] { accent-color: var(--green); cursor: pointer; }
.pick-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 16px; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; max-height: 220px; overflow: auto;
  transition: opacity .15s;
}
.home-group:not(.mode-pick) .pick-list { opacity: .45; }
.pick-list label {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; padding: 4px 6px; border-radius: 6px;
  cursor: pointer; min-width: 0; white-space: nowrap;
}
.pick-list label:hover { background: var(--green-l); }
.pick-list .pid { color: #9ca3af; font-size: 11.5px; flex-shrink: 0; }
.pick-list .pid.count { margin-left: auto; }
.pick-list .cat-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; display: inline-block;
}
.pick-list .pname { overflow: hidden; text-overflow: ellipsis; }
.pick-empty { font-size: 12.5px; color: #9ca3af; padding: 6px 2px; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 500;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 12px; border-bottom: 1px solid #f3f4f6; font-size: 13.5px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .empty { text-align: center; color: var(--muted); padding: 34px; }
.data-table .col-num { text-align: center; width: 70px; }
.data-table .col-ops { white-space: nowrap; width: 130px; }
.data-table .col-ops .btn { margin-right: 6px; }
.data-table .cell-intro { color: var(--muted); max-width: 220px; }
.data-table .tag { font-size: 11.5px; padding: 2px 9px; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.color-dot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.inline-form { display: inline; }

.editor-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.editor-head .admin-page-title { flex: 1; }

/* ---------- 分类管理布局 ---------- */
.cat-layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.cat-form h3 { font-size: 15px; margin-bottom: 16px; }

.form-card { max-width: 460px; }

/* ---------- 编辑器（地图 + 面板） ---------- */
.editor {
  display: grid;
  grid-template-columns: 370px 1fr;
  gap: 16px;
  align-items: start;
}
.editor-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px;
}
.editor-map { position: relative; min-height: 560px; }
.editor-map #map { position: absolute; inset: 0; border-radius: var(--radius); border: 1px solid var(--line); }
.map-tip {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(15,23,42,.78); color: #fff;
  font-size: 12px; padding: 7px 14px; border-radius: 18px;
  white-space: nowrap; pointer-events: none; z-index: 10;
}
.map-tip.active { background: var(--green); }

.points-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 0 8px; font-size: 13.5px; font-weight: 500; color: #374151;
}
.points-head .pts-actions { display: flex; gap: 6px; }
.points-tip { font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 10px; }

.pt-list { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto; }
.pt-empty { color: var(--muted); font-size: 12.5px; padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: 9px; }
.pt-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px;
}
.pt-row.detail-open { border-color: var(--green); }
.pt-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; }
.pt-has-intro { color: var(--green); font-style: normal; font-size: 10px; flex-shrink: 0; }
/* 途经点介绍展开区 */
.pt-detail {
  width: 100%; border-top: 1px dashed var(--line);
  padding-top: 8px; margin-top: 2px;
  display: flex; flex-direction: column; gap: 8px;
}
.pt-intro {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 9px; font-size: 13px; font-family: inherit; resize: vertical;
}
.pt-intro:focus { outline: none; border-color: var(--green); }
.pt-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.pt-img-cell { position: relative; width: 64px; height: 48px; }
.pt-img-cell img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.pt-img-del {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.pt-img-del:hover { background: var(--danger); }
.pt-img-empty { font-size: 12px; color: #9ca3af; }
.pt-img-tip { font-size: 11.5px; color: #9ca3af; }
.pt-detail .upload-btn { align-self: flex-start; }
.pt-no {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background: var(--green); color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.pt-name {
  flex: 1; min-width: 0; border: 1px solid transparent; border-radius: 6px;
  padding: 4px 6px; font-size: 13px; font-family: inherit;
}
.pt-name:focus { outline: none; border-color: var(--green); }
.pt-dist { font-size: 11.5px; color: var(--green-d); font-weight: 600; white-space: nowrap; }
.pt-dist-line { color: #9ca3af; font-weight: 500; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.list-tip {
  font-size: 12.5px; color: var(--green-d); background: #ecfdf5;
  border: 1px solid #a7f3d0; border-radius: 9px;
  padding: 8px 12px; margin-bottom: 14px; line-height: 1.5;
}
/* 线路颜色选择 */
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] {
  width: 46px; height: 34px; padding: 2px; border: 1px solid #e5e7eb;
  border-radius: 8px; background: #fff; cursor: pointer;
}
.field-note { font-style: normal; font-weight: 400; color: #9ca3af; font-size: 12px; margin-left: 6px; }
/* 路线列表自定义颜色色点 */
.route-color-dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  vertical-align: -1px; margin-left: 2px; border: 1px solid rgba(0,0,0,.12);
}
.pt-ops { display: flex; gap: 2px; }
.mini {
  border: none; background: #f3f4f6; color: #4b5563;
  font-size: 11px; padding: 3px 6px; border-radius: 5px; cursor: pointer;
}
.mini:hover { background: #e5e7eb; }
.mini.danger:hover { background: #fef2f2; color: var(--danger); }

.pt-pin {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.35);
  box-sizing: border-box;
}
.spot-mk {
  width: 26px; height: 26px; border-radius: 50% 50% 50% 0;
  background: #ea580c; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.35);
  box-sizing: border-box;
}

/* ---------- 图片管理 ---------- */
.upload-btn { cursor: pointer; }
.img-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px; margin-bottom: 16px;
}
.img-tile { position: relative; aspect-ratio: 4/3; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.img-tile img { width: 100%; height: 100%; object-fit: cover; display: block; background: #f3f4f6; }
.tile-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.55); color: #fff; font-size: 13px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.tile-del:hover { background: var(--danger); }
.img-grid:empty::after {
  content: "暂无图片"; grid-column: 1 / -1;
  text-align: center; color: var(--muted); font-size: 12.5px;
  padding: 16px; border: 1px dashed var(--line); border-radius: 9px;
}

.editor-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .editor { grid-template-columns: 1fr; }
  .editor-map { min-height: 420px; }
  .cat-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .admin-topbar { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .admin-nav { order: 3; width: 100%; overflow-x: auto; }
  .field-row { flex-direction: column; gap: 0; }
  .field-row .field:last-child { flex: 1; }
  .data-table .cell-intro { max-width: 120px; }
  .pick-list { grid-template-columns: 1fr; }
}
