:root {
  --ink: #1a2332;
  --muted: #5c6b7a;
  --paper: #f3efe6;
  --panel: #fffcf7;
  --line: #d5cfc3;
  --accent: #b33a2b;
  --accent-2: #2f6f6a;
  --ok: #2d6a4f;
  --danger: #9b2226;
  --shadow: 0 10px 30px rgba(26, 35, 50, 0.08);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #e8dfd0 0%, transparent 55%),
    linear-gradient(180deg, #ebe4d8 0%, var(--paper) 40%, #e7e2d8 100%);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

a { color: var(--accent-2); }

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1.1rem;
  background: rgba(255, 252, 247, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 50;
}
.topbar-side {
  display: flex;
  align-items: center;
  min-width: 0;
}
.topbar-side--left { justify-content: flex-start; }
.topbar-side--right {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.idraky-topbar-nav {
  display: flex !important;
  flex-shrink: 0;
  align-items: center;
  gap: 0.4rem;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  bottom: auto !important;
  right: auto !important;
  z-index: 2 !important;
  padding: 0.2rem;
  margin: 0;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(147, 197, 253, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.idraky-topbar-nav a,
.idraky-topbar-nav button {
  appearance: none;
  margin: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.2;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(147, 197, 253, 0.45);
  background: rgba(59, 130, 246, 0.32);
  color: #f8fafc;
  text-decoration: none;
  display: inline-block;
}
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 0;
  text-align: center;
  justify-self: center;
  grid-column: 2;
}
.brand-text { min-width: 0; text-align: center; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2f6f6a, #1f4e4a);
  color: #f7f3ea; font-weight: 700; letter-spacing: 0.05em;
  flex-shrink: 0;
  font-size: 1rem;
}
.brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.subtitle { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.8rem; }
.top-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  .brand {
    grid-column: 1;
    order: -1;
    width: 100%;
  }
  .topbar-side--left,
  .topbar-side--right { width: 100%; }
  .brand h1 { white-space: normal; }
}

.btn {
  border: 1px solid #2f6f6a;
  background: #2f6f6a;
  color: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  font: inherit;
}
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.danger { background: transparent; color: var(--danger); border-color: #e3b4b4; }
.danger-text { color: var(--danger) !important; }
.ok-text { color: #2d6a4f !important; }
.dlg-sep {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1rem 0 0.85rem;
}
.dlg-subhead {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}
.pwd-current-row {
  margin: 0.45rem 0 0.7rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.pwd-current {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  color: var(--ink);
  background: #f4f2ed;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  user-select: all;
}
.pwd-field {
  position: relative;
  display: block;
  margin-top: 0.25rem;
}
.pwd-field input {
  width: 100%;
  box-sizing: border-box;
  padding-right: 2.4rem !important;
}
.pwd-eye {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  line-height: 1;
  color: #6b7c85;
  border-radius: 4px;
}
.pwd-eye:hover { background: #eef2f1; color: var(--ink); }
.pwd-eye.is-shown { color: #2f6f6a; }
.btn.sm { padding: 0.25rem 0.55rem; font-size: 0.85rem; }
.btn.tool { flex: 1; }
.btn.tool.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  min-height: 0;
  gap: 0;
}
.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 0.9rem;
}
.panel.right { border-right: none; border-left: 1px solid var(--line); }
.panel h2 { margin: 0 0 0.6rem; font-size: 0.95rem; }
.panel section { margin-bottom: 1.2rem; }
.hint { color: var(--muted); font-size: 0.78rem; line-height: 1.45; margin: 0.35rem 0 0; }
.tool-row { display: flex; gap: 0.35rem; }
.row { display: flex; gap: 0.35rem; }
.row input { flex: 1; }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}
label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.55rem; }
label.check-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  font-size: 0.9rem;
  margin: 0.75rem 0 0.35rem;
}
label.check-row input[type="checkbox"] {
  width: 1rem !important;
  min-width: 1rem;
  max-width: 1rem;
  margin: 0 !important;
  padding: 0 !important;
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}
.layer-section .hint { margin-top: 0.45rem; }

.map-county-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.map-county-tab {
  border: 1px solid #b79a72;
  background: #f7efe2;
  color: #3a2c1c;
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}
.map-county-tab:hover {
  border-color: #c45a2c;
  color: #8a3b22;
}
.map-county-tab.is-active {
  background: #c45a2c;
  border-color: #c45a2c;
  color: #fff7ec;
}
.county-scope-block .hint {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  line-height: 1.4;
}
.map-county-label {
  color: #2c2116;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  text-shadow:
    0 0 4px rgba(255, 248, 235, 0.95),
    0 0 8px rgba(255, 248, 235, 0.85);
}
label.layer-item {
  display: grid !important;
  grid-template-columns: 1.15rem minmax(0, 1fr);
  align-items: center;
  column-gap: 0.55rem;
  width: 100%;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.35;
}
label.layer-item:hover { border-color: #2f6f6a; }
label.layer-item input[type="checkbox"] {
  width: 1rem !important;
  height: 1rem;
  min-width: 1rem;
  max-width: 1rem;
  margin: 0 !important;
  padding: 0 !important;
  border: none;
  border-radius: 0;
  background: transparent;
  accent-color: #2f6f6a;
  justify-self: center;
}
label.layer-item > span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-block {
  margin-top: 0.7rem;
  position: relative;
}
.filter-select-label {
  display: block !important;
  margin: 0 0 0.3rem !important;
  font-size: 0.82rem !important;
  font-weight: 700;
  color: var(--ink) !important;
  width: auto !important;
}
.ms-dropdown { position: relative; width: 100%; }
.ms-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
}
.ms-toggle:hover, .ms-dropdown.is-open .ms-toggle {
  border-color: #2f6f6a;
}
.ms-summary {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-caret { color: #6b7c85; font-size: 0.75rem; flex-shrink: 0; }
.ms-panel {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 28, 36, 0.14);
  max-height: 220px;
  display: flex;
  flex-direction: column;
}
.ms-panel.hidden { display: none !important; }
.ms-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.btn-link {
  border: none;
  background: none;
  color: #2f6f6a;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }
.ms-options {
  overflow: auto;
  padding: 0.25rem;
}
label.ms-option {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
  margin: 0 !important;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--ink);
  cursor: pointer;
  width: auto !important;
  line-height: 1.3;
}
label.ms-option:hover { background: #f0f5f4; }
label.ms-option input[type="checkbox"] {
  width: 0.9rem !important;
  height: 0.9rem;
  min-width: 0.9rem;
  max-width: 0.9rem;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: #2f6f6a;
  flex-shrink: 0;
}
label.ms-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-form.hidden, .hidden { display: none !important; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.media-preview { margin: -0.2rem 0 0.7rem; }
.media-preview img, .media-preview video {
  max-width: 100%; max-height: 160px; border-radius: 8px; border: 1px solid var(--line);
}

.list-head { display: flex; align-items: center; justify-content: space-between; }
#point-count {
  display: inline-block; min-width: 1.4em; padding: 0 0.35em;
  border-radius: 999px; background: #e8f0ef; color: var(--accent-2); font-size: 0.8rem;
}
.point-list { display: flex; flex-direction: column; gap: 0.35rem; max-height: 42vh; overflow: auto; }
.point-item {
  text-align: left; width: 100%;
  display: flex;
  gap: 0.55rem;
  align-items: center;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 0.45rem 0.55rem; cursor: pointer;
}
.point-thumb {
  width: 48px; height: 36px; object-fit: cover; border-radius: 6px;
  background: #e8e2d6; flex-shrink: 0;
}
.point-text { min-width: 0; }
.point-item:hover, .point-item.active { border-color: #2f6f6a; box-shadow: var(--shadow); }
.point-item.active {
  background: #eef6f4;
  border-color: #2f6f6a;
  border-width: 2px;
}
.point-item strong { display: block; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.point-item span { color: var(--muted); font-size: 0.72rem; }

.map-wrap { position: relative; min-height: 0; }
#map { width: 100%; height: 100%; min-height: 520px; }
.map-float {
  position: absolute; left: 12px; bottom: 12px; z-index: 500;
  background: rgba(255,252,247,0.94); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.35rem 0.65rem; font-size: 0.78rem; color: var(--muted);
  pointer-events: none;
}

.attribution {
  font-size: 0.72rem; line-height: 1.45; color: #3d4a57;
  background: #e8e2d6; border-top: 1px solid var(--line);
  padding: 0.55rem 1rem;
}
.attribution .sep { margin: 0 0.4rem; color: #9aa3ad; }

#export-map-dialog,
#tianditu-dialog,
#tianditu-auth-dialog {
  border: none; border-radius: 14px; padding: 0; width: min(560px, 94vw);
  box-shadow: var(--shadow);
}
#analysis-dialog {
  border: none; border-radius: 14px; padding: 0; width: min(960px, 94vw);
  box-shadow: var(--shadow);
}
#export-map-dialog::backdrop,
#tianditu-dialog::backdrop,
#tianditu-auth-dialog::backdrop,
#analysis-dialog::backdrop {
  background: rgba(20, 28, 36, 0.45);
}
.analysis-box { padding: 1rem 1.1rem 1.2rem; }
.analysis-box header { display: flex; justify-content: space-between; align-items: center; }
.analysis-box h2 { margin: 0; font-size: 1.1rem; }
.analysis-box h3 { margin: 0 0 0.4rem; font-size: 0.9rem; color: var(--muted); }
.charts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem; margin: 0.8rem 0 1rem;
}
.analysis-actions { display: flex; gap: 0.5rem; }

.leaflet-container { background: #dfe6e4; font: inherit; }
/* 区县：透明填充仅用于区域内鼠标命中；描边可见；去掉焦点框 */
.leaflet-overlay-pane path.county-bound {
  outline: none !important;
  /* 保证透明 fill 仍可接收指针事件 */
  pointer-events: all !important;
}
.leaflet-interactive:focus,
.leaflet-interactive:focus-visible {
  outline: none !important;
}
.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.72) !important;
  color: #444 !important;
  font-size: 11px !important;
}
body.is-visitor .leaflet-control-attribution {
  /* 展示页仅保留数据版权，不强调实现细节 */
  max-width: 70vw;
}
.ich-marker {
  background: #b33a2b; color: #fff; border: 2px solid #fff;
  border-radius: 50%; width: 28px; height: 28px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.ich-label-wrap { background: transparent !important; border: none !important; }
.ich-label-badge {
  width: 20px; height: 20px; border-radius: 50%;
  background: #b33a2b; color: #fff;
  border: 1.5px solid #fff;
  display: grid; place-items: center;
  font-size: 9px; font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 6px rgba(0,0,0,0.28);
  cursor: pointer;
}
.ich-label-badge:hover { filter: brightness(1.08); transform: scale(1.08); }
.ich-label-badge.is-selected {
  outline: 2px solid #f0c14b;
  outline-offset: 1px;
  transform: scale(1.15);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.ich-drag-handle { background: transparent !important; border: none !important; }
.ich-drag-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(179, 58, 43, 0.45);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(179,58,43,0.55);
  cursor: move;
}
.ich-label-wrap { cursor: grab; }
.ich-label-wrap:active { cursor: grabbing; }
.admin-name-tip {
  background: rgba(255, 252, 247, 0.9) !important;
  border: 1px solid #c5d0cc !important;
  color: #1f4e4a !important;
  font-size: 9px !important;
  font-weight: 600 !important;
  padding: 0 3px !important;
  border-radius: 3px !important;
  box-shadow: none !important;
  white-space: nowrap;
  line-height: 1.35 !important;
}
.admin-name-tip::before { display: none !important; }
.admin-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2f6f6a; border: 1px solid #fff; opacity: 0.85;
}

.ich-hover-tip {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.ich-hover-tip::before { display: none !important; }
.ich-hover-card {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  max-width: 280px;
  padding: 0.4rem 0.5rem;
  background: rgba(255, 252, 247, 0.97);
  border: 1px solid #d5cfc3;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(26, 35, 50, 0.16);
  color: #1a2332;
}
.ich-hover-card img {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #e8e2d6;
}
.ich-hover-card strong { font-size: 0.82rem; }
.ich-hover-card span { font-size: 0.72rem; color: #5c6b7a; }
.ich-popup {
  min-width: 160px;
  max-width: 240px;
}
.ich-popup img {
  display: block;
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.4rem;
}
#view-image img,
#image-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}
body.is-visitor .admin-only { display: none !important; }
body.is-admin .visitor-only { display: none !important; }
body.is-visitor .layout {
  grid-template-columns: 260px 1fr 300px;
}
.detail-view h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  line-height: 1.35;
}
.view-meta {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.view-addr {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
}
.view-intro {
  margin: 0.6rem 0;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
#admin-login-dialog {
  border: none; border-radius: 14px; padding: 0; width: min(420px, 94vw);
  box-shadow: var(--shadow);
}
#admin-login-dialog::backdrop {
  background: rgba(20, 28, 36, 0.45);
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 55vh auto; }
  body.is-visitor .layout { grid-template-columns: 1fr; }
  .panel { max-height: 40vh; }
  .panel.right { border-left: none; border-top: 1px solid var(--line); }
}

/* 手机细节适配 */
@media (max-width: 560px) {
  .topbar { padding: 0.5rem 0.6rem; gap: 0.5rem; }
  .brand h1 { font-size: 1rem; }
  .brand-mark { font-size: 0.85rem; }
  .btn { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
  .idraky-topbar-nav a,
  .idraky-topbar-nav button { font-size: 0.72rem; padding: 0.32rem 0.55rem; }
  .layout { grid-template-rows: auto 60vh auto; }
  .panel { padding: 0.6rem; }
  .panel h2 { font-size: 0.88rem; }
  .map-float { font-size: 0.75rem; }
}
@media (max-width: 420px) {
  .btn { font-size: 0.8rem; padding: 0.36rem 0.5rem; }
  .layout { grid-template-rows: auto 58vh auto; }
}

