:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --line: #e3e7ee;
  --line-strong: #d3d9e3;
  --text: #1c2333;
  --text-2: #5b6577;
  --text-3: #8c95a6;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --hub: #d90429;
  --hub-soft: #ffe3e6;
  --pt: #2563eb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 6px 18px rgba(16,24,40,.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}

#app { display: flex; height: 100vh; overflow: hidden; }

/* ---------------- 侧栏 ---------------- */
#sidebar {
  width: 336px; min-width: 336px; height: 100%;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 500;
}

.sb-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }

.tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 9px; margin-bottom: 12px; }
.tab {
  flex: 1; height: 30px; border: 0; background: transparent; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { background: #fff; color: var(--accent); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.tab.ev.active { color: #7c3aed; }

.sb-title h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.sb-sub { margin: 4px 0 0; font-size: 12px; color: var(--text-3); }

.sb-filters { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 14px 0; }
.sb-filters[hidden] { display: none; }
.chip {
  height: 24px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: #fff; font-size: 11.5px; color: var(--text-2); cursor: pointer;
}
.chip.active { background: #f3ecff; border-color: #c4a5f7; color: #6d28d9; font-weight: 600; }

.sb-kpis { display: flex; gap: 8px; margin-top: 12px; }
.kpi {
  flex: 1; background: var(--bg); border-radius: 8px; padding: 8px 6px; text-align: center;
}
.kpi b { display: block; font-size: 15px; font-weight: 700; color: var(--accent); }
.kpi span { font-size: 11px; color: var(--text-3); }

.sb-search { display: flex; gap: 6px; padding: 10px 12px 6px; }
.sb-search input {
  flex: 1; min-width: 0; height: 34px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-size: 13px; color: var(--text); background: #fff; outline: none;
}
.sb-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-nation {
  height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); background: #fff;
  border-radius: 8px; cursor: pointer; font-size: 12px; color: var(--text-2); white-space: nowrap;
}
.btn-nation:hover { border-color: var(--accent); color: var(--accent); }

.sb-legend {
  display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 4px 14px 8px;
  font-size: 11px; color: var(--text-3);
}
.lg { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-hub { background: var(--hub); }
.dot-pt { background: var(--pt); width: 7px; height: 7px; }
.dot-ev { background: #7c3aed; width: 10px; height: 10px; }
.dot-ev-run { background: #16a34a; width: 10px; height: 10px; }
.dot-lm-magalu { background: #0086ff; width: 9px; height: 9px; }
.dot-lm-lot { background: #111827; width: 9px; height: 9px; }
.dot-centro { background: #fff; border: 2px solid #d90429; width: 10px; height: 10px; }

.dot-central { background: #ea580c; width: 9px; height: 9px; }
.sb-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }

.st-group { margin-bottom: 2px; }
.st-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  cursor: pointer; border-radius: 8px; user-select: none;
}
.st-head:hover { background: var(--bg); }
.st-head .caret { font-size: 10px; color: var(--text-3); transition: transform .15s; width: 10px; }
.st-group.open .st-head .caret { transform: rotate(90deg); }
.st-head .uf {
  font-weight: 700; font-size: 12.5px; letter-spacing: .3px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 5px; padding: 1px 6px;
}
.st-head .st-name { flex: 1; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-head .cnt { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.st-body { display: none; padding: 2px 0 4px 10px; }
.st-group.open .st-body { display: block; }

.city {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 12.5px;
}
.city:hover { background: var(--bg); }
.city.active { background: var(--accent); color: #fff; }
.city.active .cnt { color: rgba(255,255,255,.85); }
.city .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city .cnt { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.city.nogeo { opacity: .45; cursor: default; }

.sb-foot {
  padding: 9px 14px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--text-3); text-align: center;
}

/* ---------------- 右侧竖向滚动公告栏 ---------------- */
.notice-bar {
  position: absolute; right: 0; top: 58px;
  width: 40px; height: 260px;
  background: linear-gradient(180deg, #fff6e8 0%, #ffeeD6 100%);
  border: 1px solid #ffd8a8; border-right: 0;
  border-radius: 10px 0 0 10px;
  box-shadow: -2px 2px 10px rgba(16,24,40,.10);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 10px; gap: 6px;
  overflow: hidden; z-index: 460;
}
.notice-tag {
  flex: none; width: 20px; padding: 3px 0;
  background: #ff8c33; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1.1;
  border-radius: 5px; text-align: center; letter-spacing: .5px;
}
.notice-viewport { flex: 1; min-height: 0; width: 100%; overflow: hidden; position: relative; }
.notice-track {
  position: absolute; left: 0; top: 0; width: 100%;
  display: flex; flex-direction: column; align-items: center;
  animation: noticeScroll 14s linear infinite;
}
.notice-item {
  display: block; padding: 4px 0; white-space: nowrap;
  writing-mode: vertical-rl; text-orientation: upright;
  font-size: 12.5px; font-weight: 600; color: #a8500a; letter-spacing: 1.5px;
}
@keyframes noticeScroll {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}
.notice-bar:hover .notice-track { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .notice-track { animation: none; }
  .notice-viewport { overflow-y: auto; }
}

/* ---------------- 主区 ---------------- */
#main { flex: 1; position: relative; display: flex; flex-direction: column; min-width: 0; }

#topbar {
  height: 46px; min-height: 46px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; gap: 12px; z-index: 400;
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); min-width: 0; }
.crumb #crumbText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text); }
.btn-back {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 7px;
  height: 26px; padding: 0 9px; cursor: pointer; font-size: 12px; color: var(--text-2);
}
.btn-back:hover { border-color: var(--accent); color: var(--accent); }

.engine { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.engine label[for="engineSel"], .engine #engineSel, .engine #baseSel { display: none !important; }

/* 展会点位常显标签：白底小字，始终可见 */
.leaflet-tooltip.ev-tip {
  background: #fff; color: #1a1f29; border: 1px solid #c9d0da;
  border-radius: 6px; font-size: 11px; font-weight: 600; line-height: 1.35;
  padding: 3px 8px; box-shadow: 0 2px 8px rgba(0,0,0,.15);
  max-width: 240px; white-space: normal;
}
.leaflet-tooltip.ev-tip::before { border-top-color: #fff; }
.engine select {
  height: 28px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: #fff; font-size: 12px; color: var(--text-2); padding: 0 6px; outline: none;
}
.btn-key {
  height: 28px; border: 1px solid var(--accent); color: var(--accent); background: #fff;
  border-radius: 7px; font-size: 12px; cursor: pointer; padding: 0 9px;
}
.btn-key:hover { background: var(--accent-soft); }
.btn-key.off { color: #8c95a6; border-color: #c9d0da; }
.btn-key.off:hover { background: #f1f3f7; }

#map { flex: 1; min-height: 0; background: #dfe4ea; }

.hint {
  position: absolute; left: 50%; top: 60px; transform: translateX(-50%);
  background: #fff5e6; border: 1px solid #ffd8a8; color: #8a5300;
  padding: 8px 14px; border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow);
  z-index: 600; max-width: 80%;
}

.loading {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(255,255,255,.95); border-radius: 8px; padding: 10px 18px;
  font-size: 13px; color: var(--text-2); box-shadow: var(--shadow);
}

/* ---------------- 城市信息面板 ---------------- */
.panel {
  position: absolute; right: 16px; bottom: 16px; width: 300px; max-height: 52%;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 12px 14px 8px; overflow-y: auto; z-index: 450;
}
.panel h2 { margin: 0 0 2px; font-size: 14.5px; font-weight: 700; }
.panel-meta { margin: 0 0 8px; font-size: 11.5px; color: var(--text-3); }
.panel-close {
  position: absolute; right: 8px; top: 8px; border: 0; background: transparent;
  font-size: 18px; line-height: 1; color: var(--text-3); cursor: pointer;
}
.panel-close:hover { color: var(--text); }
.panel-streets { border-top: 1px solid var(--line); }
.prow {
  display: flex; align-items: center; gap: 8px; padding: 5px 0;
  border-bottom: 1px dashed var(--line); font-size: 12px;
}
.prow:last-child { border-bottom: 0; }
.prow .bar { width: 3px; height: 14px; border-radius: 2px; background: var(--hub); flex: none; }
.prow .pn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.prow .pc { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------------- 地图弹窗 ---------------- */
.pop { font-size: 12.5px; line-height: 1.55; min-width: 190px; }
.pop .pt { font-weight: 700; font-size: 13px; margin-bottom: 3px; color: #1c2333; }
.pop .pr { color: #5b6577; }
.pop .pz { color: #8c95a6; font-size: 11.5px; margin-top: 3px; }
.pop .badge {
  display: inline-block; margin-top: 5px; font-size: 10.5px; padding: 1px 6px;
  border-radius: 4px; background: #fff1e6; color: #b6490a;
}
.leaflet-popup-content { margin: 10px 12px; }

/* ---------------- 展会视图 ---------------- */
.ev-row { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ev-row:hover { background: var(--bg); }
.ev-row.active { background: #f3ecff; }
.ev-row.active .ev-city { color: #6d28d9; }
.ev-name { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.35; }
.ev-tag {
  display: inline-block; margin: 4px 6px 0 0; padding: 1px 7px; border-radius: 9px;
  font-size: 10.5px; background: #f3ecff; color: #6d28d9; white-space: nowrap;
}
.ev-when {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 4px; font-variant-numeric: tabular-nums;
}
.ev-when .ev-date {
  font-size: 15px; font-weight: 800; color: #0b1220; letter-spacing: .2px;
}
.ev-when.run .ev-date { color: #15803d; }
.ev-when .ev-tz {
  font-size: 10px; color: #8c95a6; background: #f1f3f7;
  border-radius: 8px; padding: 1px 6px; white-space: nowrap;
}
.ev-when .ev-live { font-size: 11px; color: #15803d; font-weight: 700; white-space: nowrap; }
.ev-city { margin-top: 3px; font-size: 11px; color: var(--text-3); }

.ev-cat > .ev-cat-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px 3px; user-select: none;
}
.ev-cat > .ev-cat-head .caret { font-size: 10px; color: var(--text-3); width: 10px; }
.ev-cat > .ev-cat-head .nm { flex: 1; font-size: 12px; font-weight: 600; color: var(--text-2); }
.ev-cat > .ev-cat-head .cnt { font-size: 11px; color: var(--text-3); }
.ev-cat.closed .ev-body { display: none; }
.ev-body { padding: 2px 0 4px 10px; }

.pop .ev-dates { font-weight: 700; color: #6d28d9; font-size: 13.5px; margin: 4px 0 2px; }
.pop .ev-dates .tz {
  display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 400;
  color: #8c95a6; background: #f1f3f7; border-radius: 8px; padding: 1px 6px; vertical-align: 2px;
}
.pop .ev-badge {
  display: inline-block; margin-top: 6px; margin-right: 4px; font-size: 10.5px;
  padding: 1px 7px; border-radius: 9px; background: #f3ecff; color: #6d28d9;
}
.pop .ev-badge.run { background: #e7f6ec; color: #15803d; font-weight: 600; }
.pop a.ev-link { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--accent); text-decoration: none; word-break: break-all; }
.pop a.ev-link:hover { text-decoration: underline; }

.ev-tag.near { background: #e7f6ec; color: #15803d; }

/* ---------------- 打印 / 导出 PDF ---------------- */
#printSheet { display: none; }

@media print {
  #app { display: none !important; }
  #printSheet { display: block !important; }
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; }
}

.ps-wrap { font-size: 12px; color: #111; }
.ps-wrap h1 { font-size: 19px; margin: 0 0 4px; }
.ps-wrap .ps-meta { margin: 0 0 14px; font-size: 11px; color: #555; }
.ps-wrap h2 {
  font-size: 14px; margin: 16px 0 6px; padding: 4px 8px;
  background: #f1ecfa; border-left: 4px solid #7c3aed; color: #4c1d95;
}
.ps-wrap table { width: 100%; border-collapse: collapse; }
.ps-wrap th, .ps-wrap td {
  border: 1px solid #ccc; padding: 5px 7px; text-align: left; vertical-align: top;
  font-size: 11px; line-height: 1.45;
}
.ps-wrap th { background: #f6f7f9; font-weight: 700; white-space: nowrap; }
.ps-wrap .ps-date { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 700; color: #111; }
.ps-wrap .ps-url { color: #1f6feb; word-break: break-all; }
.ps-wrap .ps-foot { margin-top: 14px; font-size: 10px; color: #777; }

/* ---------------- 小屏 ---------------- */
@media (max-width: 860px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; min-width: 0; height: 46%; border-right: 0; border-bottom: 1px solid var(--line); }
  #main { height: 54%; }
  .panel { display: none; }
  .notice-bar { top: 54px; height: 190px; width: 34px; }
  .notice-item { font-size: 11.5px; letter-spacing: 1px; }
}

/* ===== 提示框 / 通行证付费墙 ===== */
.toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  background: #1c2333; color: #fff; font-size: 13px; padding: 9px 18px;
  border-radius: 8px; box-shadow: 0 6px 18px rgba(16,24,40,.25);
  z-index: 9999; pointer-events: none;
}
#passModal[hidden] { display: none; }
#passModal {
  position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 9998;
  display: flex; align-items: center; justify-content: center;
}
.pm-box {
  background: #fff; border-radius: 12px; padding: 22px 24px; width: 320px;
  box-shadow: 0 10px 30px rgba(16,24,40,.25);
}
.pm-box h3 { font-size: 16px; margin-bottom: 6px; }
.pm-box p { font-size: 12.5px; color: #5b6577; margin-bottom: 12px; }
.pm-box input {
  width: 100%; padding: 9px 11px; border: 1px solid #ccd4e0; border-radius: 8px;
  font-size: 14px; margin-bottom: 6px; box-sizing: border-box;
}
.pm-err { color: #c92a2a; font-size: 12px; min-height: 16px; }
.pm-btns { display: flex; gap: 8px; margin-top: 6px; }
.pm-btns button { flex: 1; padding: 9px; border-radius: 8px; border: 0; cursor: pointer; font-size: 13.5px; }
.pm-ok { background: #1f6feb; color: #fff; font-weight: 700; }
.pm-cancel { background: #eef1f5; color: #1c2333; }
.pw-banner {
  margin-top: 8px; padding: 12px; border: 1px dashed #f1a33c; background: #fff8ec;
  border-radius: 10px; font-size: 12.5px; color: #7a4b0f; line-height: 1.6; text-align: center;
}
.pw-btns { display: flex; gap: 8px; margin-top: 8px; }
.pw-btns button { flex: 1; padding: 8px 6px; border-radius: 8px; border: 0; cursor: pointer; font-size: 12.5px; }
.pw-buy { background: #ff6b35; color: #fff; font-weight: 700; }
.pw-enter { background: #fff; border: 1px solid #ccd4e0 !important; color: #1c2333; }
.pw-note { color: #b45309; }
#promptModal[hidden] { display: none; }
#promptModal {
  position: fixed; inset: 0; background: rgba(10,14,22,.62); z-index: 9998;
  display: flex; align-items: center; justify-content: center;
}
.pm-buy { background: #25d366; color: #fff; font-weight: 700; }
.pm-enter2 { background: #fff; border: 1px solid #ccd4e0; color: #1c2333; }

/* ===== SEO 静态内容块：对访客隐藏，但保留在 DOM 中供搜索引擎抓取 ===== */
/* 不能用 display:none —— 部分引擎会判定为隐藏内容而忽略；用视觉隐藏更稳妥 */
.seo-static {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0 !important; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
