:root {
  --bg: #f3f5fa;
  --card: #ffffff;
  --text: #16202e;
  --muted: #6b7a90;
  --line: #e7ecf5;
  --primary: #3b6ef6;
  --primary-dk: #2c57d0;
  --violet: #6d4df6;
  --ok: #10b981;
  --warn: #f59f00;
  --danger: #ef4444;
  --shadow: 0 6px 24px rgba(23, 43, 99, .07);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; overflow-x: hidden; }

/* ---------- 常规登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, .14) 0, transparent 34%),
    radial-gradient(circle at 88% 82%, rgba(255, 255, 255, .1) 0, transparent 38%),
    linear-gradient(150deg, #3b6ef6 0%, #5b52f0 52%, #6d4df6 100%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 20px;
  padding: 36px 30px 26px;
  box-shadow: 0 18px 48px rgba(21, 33, 82, .28);
  text-align: center;
}

.login-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: linear-gradient(140deg, #eef2ff, #e6e9ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.login-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text);
}

.login-sub {
  margin: 8px 0 26px;
  font-size: 13px;
  color: var(--muted);
}

.login-field {
  text-align: left;
}

.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.pwd-wrap {
  position: relative;
}

.pwd-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 46px 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #f8f9fd;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, background .15s;
}

.pwd-wrap input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 110, 246, .12);
}

.pwd-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .75;
}

.pwd-eye:active { background: rgba(0, 0, 0, .05); }

.login-btn {
  width: 100%;
  height: 48px;
  margin-top: 22px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(70, 90, 240, .32);
  transition: transform .12s, box-shadow .12s;
}

.login-btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(70, 90, 240, .28);
}

.login-btn[disabled] {
  opacity: .7;
}

.login-foot {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: #a3adc2;
  letter-spacing: 1px;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; border: none; background: none; }

.shell {
  max-width: 460px;
  margin: 0 auto;
  padding: 0 0 calc(28px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.shell.wide { max-width: 680px; }

/* ---------- 顶部 ---------- */
.hero {
  position: relative;
  padding: calc(30px + env(safe-area-inset-top)) 22px 30px;
  background: linear-gradient(140deg, #3b6ef6 0%, #5b52f0 55%, #6d4df6 100%);
  color: #fff;
  border-radius: 0 0 28px 28px;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}

.hero::before {
  content: "";
  position: absolute;
  left: -50px;
  bottom: -90px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}

.hero-inner { position: relative; z-index: 1; }

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(6px);
  margin-bottom: 14px;
  letter-spacing: .3px;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -.3px;
}

.hero p {
  margin: 0;
  font-size: 13px;
  opacity: .82;
  line-height: 1.5;
}

.hero .back-btn {
  position: absolute;
  right: 18px;
  top: calc(22px + env(safe-area-inset-top));
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 16px;
}

.card.tight { padding: 14px 16px; }

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .3px;
  margin-bottom: 12px;
}

.card-title .sub { font-weight: 400; font-size: 12px; color: #9aa7ba; }

/* ---------- 小区信息 ---------- */
.site-name {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 6px;
}

.site-addr {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: flex-start;
  line-height: 1.5;
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 6px 11px;
  border-radius: 10px;
  background: #f0f4fd;
  color: #445a80;
  font-weight: 500;
}

.pill.ok { background: #e8f8f1; color: #0b8a63; }
.pill.warn { background: #fff4e0; color: #a86b00; }
.pill.bad { background: #feecec; color: #c03434; }

/* ---------- 定位区 ---------- */
.loc-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0 4px;
}

.radar {
  position: relative;
  width: 108px;
  height: 108px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #dbe4f5;
}

.radar .core {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #eef3fd;
  color: #5a76a8;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background .25s, color .25s;
}

.radar.state-ok .core { background: #e6f9f1; color: var(--ok); }
.radar.state-bad .core { background: #feecec; color: var(--danger); }
.radar.state-busy .core { background: #eef3fd; color: var(--primary); }

.radar.state-busy .ring {
  border-color: var(--primary);
  opacity: .5;
  animation: pulse 1.5s ease-out infinite;
}

.radar.state-busy .ring:nth-child(2) { animation-delay: .6s; }

@keyframes pulse {
  0% { transform: scale(.72); opacity: .65; }
  100% { transform: scale(1.12); opacity: 0; }
}

.loc-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.loc-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 280px;
}

.range-bar {
  width: 100%;
  margin-top: 16px;
}

.range-track {
  height: 8px;
  border-radius: 999px;
  background: #edf1f9;
  overflow: hidden;
}

.range-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width .5s cubic-bezier(.4, 0, .2, 1);
}

.range-fill.bad { background: linear-gradient(90deg, #f87171, #ef4444); }

.range-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #9aa7ba;
  margin-top: 6px;
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3c4a5e;
  margin-bottom: 7px;
}

.field .hint {
  font-size: 11.5px;
  font-weight: 400;
  color: #9aa7ba;
  margin-left: 6px;
}

.input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fbfcfe;
  outline: none;
  transition: border-color .18s, background .18s;
}

.input:focus {
  border-color: var(--primary);
  background: #fff;
}

.input::placeholder { color: #b3bdcc; }

textarea.input { resize: vertical; min-height: 64px; }

.btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 15.5px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  transition: transform .12s, box-shadow .18s, opacity .18s;
  box-shadow: 0 6px 18px rgba(59, 110, 246, .26);
}

.btn:active { transform: scale(.985); }

.btn[disabled] {
  background: #dde3ef;
  color: #96a2b6;
  box-shadow: none;
  cursor: not-allowed;
}

.btn.ghost {
  background: #f2f5fc;
  color: #3c4a5e;
  box-shadow: none;
}

.btn.outline {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid #cddafc;
  box-shadow: none;
}

.btn.danger-btn {
  background: #fff;
  color: var(--danger);
  border: 1.5px solid #fad2d2;
  box-shadow: none;
}

.btn.small {
  width: auto;
  padding: 9px 14px;
  font-size: 13px;
  border-radius: 11px;
  box-shadow: none;
}

.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

/* ---------- 成功页 ---------- */
.success-card {
  text-align: center;
  padding: 30px 20px 24px;
}

.check-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, #10b981, #34d399);
  color: #fff;
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px rgba(16, 185, 129, .3);
  animation: pop .45s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes pop {
  0% { transform: scale(.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.success-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.success-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }

.receipt {
  text-align: left;
  border: 1px dashed #d8e0ef;
  border-radius: 14px;
  padding: 14px 16px;
  background: #fbfcff;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  padding: 7px 0;
}

.receipt-row .k { color: var(--muted); flex-shrink: 0; }
.receipt-row .v { font-weight: 600; text-align: right; word-break: break-all; }

/* ---------- 提示条 ---------- */
.alert {
  display: flex;
  gap: 9px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  margin: 0 16px 14px;
  align-items: flex-start;
}

.alert.info { background: #eef3fd; color: #33518a; }
.alert.warn { background: #fff6e6; color: #8a5a00; }
.alert.bad { background: #fdeeee; color: #a83232; }
.alert .ico { flex-shrink: 0; }

/* ---------- 后台 ---------- */
.tabbar {
  display: flex;
  gap: 6px;
  background: #eaeff8;
  padding: 4px;
  border-radius: 14px;
  margin: 14px 16px;
}

.tabbar button {
  flex: 1;
  padding: 10px 8px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  color: #6b7a90;
  transition: all .2s;
}

.tabbar button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(23, 43, 99, .08);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 16px;
}

.stat {
  background: #fff;
  border-radius: 16px;
  padding: 15px 12px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat .num {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat .lbl { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 96px;
  padding-top: 8px;
}

.mini-chart .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
}

.mini-chart .bar {
  width: 100%;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #7ea2ff, #3b6ef6);
  min-height: 3px;
  transition: height .4s;
}

.mini-chart .bar.zero { background: #e8edf7; }
.mini-chart .cap { font-size: 10px; color: #9aa7ba; }

.site-item {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 16px 12px;
}

.site-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.site-item-head h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.35;
}

.code-chip {
  flex-shrink: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 9px;
  border-radius: 8px;
  background: #f0f4fd;
  color: #3d5a94;
}

.site-item .addr {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.site-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 13px;
}

.site-stats b { color: var(--text); font-size: 15px; margin-right: 2px; }

.site-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.site-actions button {
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f2f5fc;
  color: #3c4a5e;
}

.site-actions button.primary-act {
  background: #eef3ff;
  color: var(--primary);
}

.site-actions button.del-act {
  background: #fdeeee;
  color: var(--danger);
}

.empty {
  text-align: center;
  padding: 44px 30px;
  color: var(--muted);
}

.empty .big { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.empty p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.6; }

/* ---------- 记录列表 ---------- */
.rec-item {
  display: flex;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #f0f3f9;
  align-items: center;
}

.rec-item:last-child { border-bottom: none; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #e8efff, #dbe6ff);
  color: #3b6ef6;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rec-main { flex: 1; min-width: 0; }
.rec-main .nm { font-size: 14.5px; font-weight: 600; margin-bottom: 2px; }

.rec-main .meta {
  font-size: 11.5px;
  color: #9aa7ba;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-dist {
  font-size: 12px;
  font-weight: 600;
  color: var(--ok);
  background: #e9f9f2;
  padding: 4px 8px;
  border-radius: 8px;
  flex-shrink: 0;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(18, 28, 45, .45);
  backdrop-filter: blur(2px);
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .2s;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: #fff;
  width: 100%;
  max-width: 460px;
  border-radius: 22px 22px 0 0;
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp .28s cubic-bezier(.3, 1, .5, 1);
}

@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: #dfe5f0;
  margin: 8px auto 16px;
}

.sheet h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
}

.qr-wrap {
  text-align: center;
  padding: 8px 0 14px;
}

.qr-wrap svg, .qr-wrap canvas, .qr-wrap img {
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  border: 1px solid var(--line);
  width: 216px;
  height: 216px;
}

.qr-link {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.qr-link input {
  flex: 1;
  font-size: 11.5px;
  color: var(--muted);
  padding: 11px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fbfcfe;
  min-width: 0;
}

/* ---------- 地图 ---------- */
/* ---------- 地图位置搜索 ---------- */
.map-search {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.map-search .input {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.map-search .btn {
  flex-shrink: 0;
  height: 44px;
}

.search-results {
  margin-bottom: 10px;
}

.search-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 6px;
  background: #fff;
  cursor: pointer;
  transition: background .12s;
}

.search-item:active {
  background: #eef3fd;
}

.search-item .si-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.search-item .si-addr {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.search-item.muted {
  font-size: 13px;
  color: var(--muted);
  cursor: default;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-box {
  height: 220px;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  background: #eef2f9;
}

.map-fallback {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  padding: 20px;
  line-height: 1.6;
}

.coord-line {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- 加载 ---------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
  vertical-align: -3px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.center-load {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 80px 20px;
  color: var(--muted);
  font-size: 13.5px;
}

.center-load .spinner {
  border-color: #dbe4f5;
  border-top-color: var(--primary);
  width: 26px;
  height: 26px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(40px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(22, 32, 46, .92);
  color: #fff;
  font-size: 13.5px;
  padding: 11px 18px;
  border-radius: 12px;
  z-index: 200;
  max-width: 84vw;
  text-align: center;
  line-height: 1.5;
  animation: toastIn .25s;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.footer-note {
  text-align: center;
  font-size: 11.5px;
  color: #a6b1c2;
  padding: 18px 24px 0;
  line-height: 1.7;
}

.footer-note a { color: #8fa1bd; text-decoration: none; }

/* 桌面端轻微优化 */
@media (min-width: 620px) {
  body { background: #eef1f8; }
  .shell {
    background: var(--bg);
    box-shadow: 0 0 60px rgba(23, 43, 99, .08);
    min-height: 100vh;
  }
}
