:root {
  --water: #0a3d4d;
  --water-deep: #062830;
  --fish: #1aa6a6;
  --fish-soft: #3ec1c1;
  --lure: #f0a202;
  --lure-dark: #d48900;
  --ink: #12303a;
  --muted: #5b7780;
  --line: rgba(10, 61, 77, 0.1);
  --bg: #e8f1f3;
  --card: #fff;
  --danger: #c23b3b;
  --ok: #1b7a4a;
  --shadow: 0 12px 32px rgba(6, 40, 48, 0.1);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(26,166,166,.12), transparent 50%),
    var(--bg);
}
button, input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 70% 50% at 10% 0%, rgba(26,166,166,.28), transparent 50%),
    linear-gradient(165deg, #062830, #0a3d4d 55%, #0e5a5a);
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 20px; padding: 28px 24px 24px;
  box-shadow: var(--shadow);
}
.login-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.login-brand .mark {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(145deg, var(--water), var(--fish));
  display: grid; place-items: center; font-size: 24px; color: #fff;
}
.login-card h1 { font-size: 22px; }
.login-card .sub { margin-top: 4px; color: var(--muted); font-size: 13px; }

.field { margin-bottom: 12px; }
.field label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; margin-bottom: 6px; color: var(--muted);
}
.field label .req { color: var(--danger); font-size: 12px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; font-size: 15px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--fish);
  box-shadow: 0 0 0 3px rgba(26,166,166,.15);
}
.field .hint { margin-top: 6px; font-size: 12px; color: #8aa0a8; }

.btn {
  border: 0; border-radius: 11px; padding: 10px 14px; font-size: 14px; font-weight: 650;
  cursor: pointer; background: #e7eef0; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--water); color: #fff; }
.btn.primary.block { width: 100%; height: 46px; }
.btn.lure { background: var(--lure); color: #2a1c00; }
.btn.soft { background: #e8f6f6; color: var(--water); }
.btn.danger { background: #fdecec; color: var(--danger); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 7px 10px; font-size: 12px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.err { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }

.admin { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr; }
.nav {
  background: linear-gradient(135deg, #062830, #0a3d4d 60%, #0e4e58);
  color: #fff;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.nav-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-left .mark {
  width: 36px; height: 36px; border-radius: 11px;
  background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 18px;
}
.nav-left b { font-size: 16px; }
.nav-left span { display: block; font-size: 12px; color: rgba(255,255,255,.65); margin-top: 1px; }
.nav-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.nav .btn { padding: 7px 11px; font-size: 13px; }
.nav .btn.ghost { color: #fff; border-color: rgba(255,255,255,.28); }

.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 14px 0;
  scrollbar-width: none; background: transparent;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; border: 0; background: #fff; border-radius: 999px;
  padding: 9px 15px; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 10px rgba(6,40,48,.06); color: var(--ink);
}
.tab.on { background: var(--water); color: #fff; }

.wrap {
  padding: 14px 14px calc(24px + var(--safe-bottom));
  max-width: 1180px; margin: 0 auto; width: 100%;
}

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px;
}
.stat {
  background: #fff; border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -10px; top: -10px;
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(26,166,166,.1);
}
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat strong { display: block; margin-top: 4px; font-size: 24px; font-weight: 750; }
.stat.online strong { color: var(--ok); }
.stat.offline strong { color: var(--danger); }

.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center;
}
.toolbar input, .toolbar select {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font-size: 14px; background: #fff;
}
.toolbar input { flex: 1; min-width: 160px; }
.toolbar .grow { margin-left: auto; }

.shop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.shop-card {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow);
  overflow: hidden; display: grid; grid-template-columns: 108px 1fr;
  cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.shop-card:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(6,40,48,.14); }
.shop-card .cover {
  background: linear-gradient(145deg, var(--water), var(--fish));
  min-height: 108px; display: grid; place-items: center; color: #fff; font-size: 32px;
  position: relative;
}
.shop-card .cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.shop-card .body { padding: 12px 14px; min-width: 0; }
.shop-card .title {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.shop-card h3 {
  font-size: 16px; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.shop-card .meta {
  margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.5;
}
.shop-card .meta div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-card .tags { margin-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.tag {
  font-size: 11px; color: var(--water); background: #e6f4f4;
  padding: 2px 7px; border-radius: 999px;
}
.shop-card .actions {
  margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap;
}
.st {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; flex-shrink: 0;
}
.st.on { background: #e5f7ee; color: var(--ok); }
.st.off { background: #fdecec; color: var(--danger); }

.empty-box {
  background: #fff; border-radius: 16px; padding: 36px 16px; text-align: center;
  color: var(--muted); box-shadow: var(--shadow);
}
.empty-box .emoji { font-size: 36px; margin-bottom: 8px; }
.empty-box p { margin-bottom: 14px; }

.panel {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.panel-hd {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.panel-hd h2 { font-size: 16px; }
.panel-hd p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel-bd { padding: 16px; }
.section-title {
  font-size: 13px; font-weight: 700; color: var(--water);
  margin: 4px 0 12px; padding-left: 8px; border-left: 3px solid var(--fish);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.editor-layout {
  display: grid; gap: 14px;
}
.map-box {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.map-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.map-toolbar h3 { font-size: 14px; }
#admin-map { height: 300px; background: #c5d9de; }
.map-hint {
  padding: 10px 14px 12px; font-size: 12px; color: var(--muted); line-height: 1.5;
}
.coord-pill {
  display: inline-flex; gap: 8px; flex-wrap: wrap; font-size: 12px;
}
.coord-pill span {
  background: #eef6f7; border-radius: 999px; padding: 4px 10px; color: var(--water); font-weight: 650;
}

.imgs { display: flex; gap: 10px; flex-wrap: wrap; }
.imgs .pic {
  width: 96px; height: 96px; border-radius: 12px; overflow: hidden; position: relative;
  background: #dce8ea; border: 2px solid transparent;
}
.imgs .pic.is-cover { border-color: var(--lure); }
.imgs img { width: 100%; height: 100%; object-fit: cover; }
.imgs .pic .tools {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: 2px; background: rgba(6,40,48,.55); padding: 3px;
}
.imgs .pic .tools button {
  flex: 1; border: 0; background: transparent; color: #fff; font-size: 10px;
  cursor: pointer; padding: 3px 0;
}
.imgs .pic .del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
}
.imgs .cover-badge {
  position: absolute; top: 4px; left: 4px; font-size: 10px; font-weight: 700;
  background: var(--lure); color: #2a1c00; padding: 2px 6px; border-radius: 6px;
}
.upload {
  width: 96px; height: 96px; border-radius: 12px; border: 1px dashed #b7cbcf;
  display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 12px;
  background: #f7fbfc; text-align: center; line-height: 1.4;
}
.upload:hover { border-color: var(--fish); color: var(--water); }

.sticky-actions {
  position: sticky; bottom: 0; z-index: 8;
  margin: 0 -16px -16px; padding: 12px 16px calc(12px + var(--safe-bottom));
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.sticky-actions .btn.primary { flex: 1; min-width: 120px; height: 44px; }

.cat-grid { display: grid; gap: 10px; }
.cat-card {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow);
  padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.cat-card .ico {
  width: 42px; height: 42px; border-radius: 12px; background: #e8f6f6;
  display: grid; place-items: center; font-size: 20px; margin-right: 10px;
}
.cat-card .left { display: flex; align-items: center; min-width: 0; }
.cat-card h3 { font-size: 15px; }
.cat-card p { font-size: 12px; color: var(--muted); margin-top: 2px; }

.set-grid { display: grid; gap: 14px; }
@media (min-width: 900px) {
  .set-grid { grid-template-columns: 1.2fr .8fr; align-items: start; }
}

.drawer-mask {
  position: fixed; inset: 0; background: rgba(6,40,48,.45); z-index: 60;
  display: flex; justify-content: flex-end;
}
.drawer {
  width: min(440px, 100%); height: 100%; background: #fff;
  display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(6,40,48,.2);
  animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-hd {
  padding: calc(12px + var(--safe-top)) 16px 12px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.drawer-hd h2 { font-size: 17px; }
.drawer-bd { flex: 1; overflow-y: auto; padding: 16px; }
.drawer-hero {
  height: 180px; border-radius: 14px; overflow: hidden; margin-bottom: 14px;
  background: linear-gradient(145deg, var(--water), var(--fish));
  display: grid; place-items: center; color: #fff; font-size: 42px; position: relative;
}
.drawer-hero img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.kv { margin-bottom: 14px; }
.kv h4 { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.kv p { font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.drawer-ft {
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.drawer-ft .btn { flex: 1; }

.preview-card {
  border: 1px dashed #c5d8dc; border-radius: 14px; padding: 12px; background: #f7fbfc;
}
.preview-card .ph {
  height: 96px; border-radius: 10px; background: linear-gradient(145deg, var(--water), var(--fish));
  display: grid; place-items: center; color: #fff; font-size: 28px; overflow: hidden; position: relative;
}
.preview-card .ph img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.preview-card h4 { margin-top: 10px; font-size: 15px; }
.preview-card p { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.5; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(6,40,48,.92); color: #fff; padding: 9px 16px;
  border-radius: 999px; font-size: 13px; z-index: 80;
  box-shadow: var(--shadow);
}

.yuju-pin { background: none !important; border: 0 !important; }
.yuju-pin-body {
  width: 36px; height: 36px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); background: var(--water);
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(6,40,48,.35);
}
.yuju-pin-body span { transform: rotate(45deg); font-size: 16px; }
.yuju-pin.is-active .yuju-pin-body { background: var(--lure); }
.yuju-me { background: none !important; border: 0 !important; }
.yuju-me i {
  width: 18px; height: 18px; border-radius: 50%;
  background: #1a73e8; border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(26,115,232,.22); display: block;
}

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .shop-card { grid-template-columns: 88px 1fr; }
  .shop-card .cover { min-height: 88px; }
}
@media (min-width: 720px) {
  .shop-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 980px) {
  .editor-layout { grid-template-columns: 1.05fr .95fr; align-items: start; }
  #admin-map { height: 460px; }
  .shop-grid { grid-template-columns: 1fr 1fr; }
}
