:root {
  --brand: #ef4428;
  --brand-dark: #c1361f;
  --bg: #fff8f3;
  --surface: #ffffff;
  --line: #f0e4dc;
  --text: #1d2633;
  --muted: #8c939d;
  --ok: #1d9e75;
  --warn: #ba7517;
  --danger: #e24b4a;
  --radius: 12px;
}

* { box-sizing: border-box; }

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

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 18px 44px rgba(153, 66, 37, 0.08);
}
.login-brand { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.login-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfb;
}
.login-card input:focus { outline: none; border-color: var(--brand); }
.login-hint { font-size: 12px; color: var(--muted); margin-top: 16px; }

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  transition: all .15s ease;
}
.btn:hover { border-color: #e3cfc4; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-block { width: 100%; padding: 11px; margin-top: 24px; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-ok { color: var(--ok); border-color: #cfe9df; }
.btn-warn { color: var(--warn); border-color: #f2e0c2; }
.btn-danger { color: var(--danger); border-color: #f6d5d5; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 主界面 ---------- */
.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; }
.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 4px; margin-left: 22px; }
.tab { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; color: var(--muted); font-size: 13px; }
.tab:hover { background: #fffbf8; color: var(--text); }
.tab.active { background: #fdeee9; color: var(--brand); font-weight: 500; }

.container { max-width: 1240px; margin: 0 auto; padding: 22px 24px 60px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 24px; font-weight: 600; margin-top: 4px; }
.card .v.brand { color: var(--brand); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar select, .toolbar input[type="text"] { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fffdfb; }
.toolbar input[type="text"] { min-width: 200px; }
.toolbar .grow { flex: 1; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #fffbf8; color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr:hover { background: #fffbf8; }
td.name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
td.phone { font-family: ui-monospace, Menlo, Consolas, monospace; }
.actions { display: flex; gap: 6px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.tag.published { background: #e1f5ee; color: var(--ok); }
.tag.draft { background: #faeeda; color: var(--warn); }
.tag.offline { background: #f1efe8; color: #5f5e5a; }

.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--muted); font-size: 13px; }
.pager .spacer { flex: 1; }
/* 手动跳页输入框：隐藏数字微调箭头，宽度固定为 3 位页码 */
.page-jump { width: 64px; min-height: 28px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fffdfb; color: var(--text); font-size: 13px; text-align: center; }
.page-jump:focus { outline: none; border-color: var(--brand, #d85a3a); }
.page-jump::-webkit-outer-spin-button, .page-jump::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.page-jump[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.community-help { padding: 0 18px; color: var(--muted); font-size: 12px; }
.community-form-field { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }
.community-form-field input, .community-form-field select, .community-form-field textarea { width: 100%; min-height: 36px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fffdfb; color: var(--text); }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(29, 38, 51, .38); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 640px; max-height: 88vh; display: flex; flex-direction: column; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; align-items: center; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.field { display: flex; flex-direction: column; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fffdfb; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); }
.field input, .field select, .field textarea,
.toolbar input, .toolbar select, .toolbar textarea { min-height: 36px; line-height: 1.4; }
.field textarea { min-height: 92px; resize: vertical; }
input[type="checkbox"] { min-height: 0; width: auto; accent-color: var(--brand); }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: #f5f1ed; color: var(--muted); cursor: not-allowed; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.toolbar input:focus-visible, .toolbar select:focus-visible, .toolbar textarea:focus-visible {
  outline: 3px solid rgba(239, 68, 40, .14); border-color: var(--brand);
}
.close-x { border: 0; background: transparent; font-size: 20px; color: var(--muted); line-height: 1; padding: 0 4px; }

/* ---------- 运营配置 ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; padding: 18px; }
.settings-section { border-top: 1px solid var(--line); padding: 18px; }
.settings-section h3 { margin: 0 0 4px; font-size: 14px; }
.settings-section .section-help { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.settings-actions { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.settings-actions .grow { flex: 1; }
.banner-list { display: grid; gap: 12px; }
.banner-row { display: grid; grid-template-columns: 1fr 1fr 90px 72px; gap: 10px; padding: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.banner-row .full { grid-column: 1 / -1; }
.banner-row .banner-row-head { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.banner-row .banner-row-head strong { color: var(--text); font-size: 13px; }
.banner-preview { width: 100%; height: 88px; border-radius: 8px; object-fit: cover; background: #f2e8e2; }
.settings-inline { display: flex; align-items: center; gap: 8px; }
.lowcode-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; }
.lowcode-editor { min-width: 0; }
.mini-preview-wrap { position: sticky; top: 18px; padding: 18px 0 18px 4px; }
.mini-preview-label { color: var(--muted); font-size: 12px; margin-bottom: 8px; text-align: center; }
.mini-preview { overflow: hidden; border: 8px solid #202832; border-radius: 26px; background: #fffaf7; box-shadow: 0 14px 32px rgba(29,38,51,.16); }
.mini-preview-hero { padding: 22px 14px 16px; background: linear-gradient(155deg,#fff6ed 0%,#ffe4d8 47%,#fff9f5 100%); }
.mini-preview-brand { display: flex; gap: 9px; align-items: center; }
.mini-preview-brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; object-fit: contain; }
.mini-preview-brand > #brandPreviewLogoFallback { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(145deg,#ff6a3c,#ef2f25); color: #fff; font-size: 11px; font-weight: 700; }
.mini-preview-brand strong, .mini-preview-brand span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-preview-brand strong { color: #d93621; font-size: 14px; }
.mini-preview-brand span { margin-top: 3px; color: #777f89; font-size: 10px; }
.mini-preview-search { height: 30px; margin-top: 13px; padding: 0 5px 0 9px; display: flex; align-items: center; gap: 6px; border-radius: 11px; background: rgba(255,255,255,.82); color: #a39b96; font-size: 10px; }
.mini-preview-search em { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal; }
.mini-preview-search b { padding: 7px 9px; border-radius: 9px; background: #ef3d28; color: #fff; font-size: 10px; }
.mini-preview-banner { min-height: 94px; margin-top: 10px; padding: 14px; border-radius: 12px; background: linear-gradient(115deg,rgba(255,255,255,.9),rgba(255,241,233,.62)); background-size: cover; background-position: center; box-sizing: border-box; }
.mini-preview-banner small, .mini-preview-banner strong, .mini-preview-banner span { display: block; }
.mini-preview-banner small { color: #b14d38; font-size: 9px; }
.mini-preview-banner strong { margin-top: 4px; color: #d63c24; font-size: 17px; }
.mini-preview-banner span { margin-top: 8px; color: #8a817a; font-size: 9px; }
.preview-image-label { color: #8a817a; font-size: 11px; }
.mini-preview-dots { display: flex; justify-content: center; gap: 4px; padding-top: 7px; }
.mini-preview-dot { width: 6px; height: 6px; padding: 0; border: 0; border-radius: 50%; background: #e4b7aa; cursor: pointer; }
.mini-preview-dot.active { width: 16px; border-radius: 4px; background: #ef4428; }
.mini-preview-block { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; padding: 14px; }
.mini-preview-block.wide { grid-template-columns: 1fr; padding-top: 0; }
.mini-preview-block i { display: block; height: 24px; border-radius: 8px; background: #fff0e8; }
.placeholder-list { display: grid; gap: 8px; }
.placeholder-row { display: flex; align-items: center; gap: 8px; }
.placeholder-row input { flex: 1; min-width: 0; }
.placeholder-index { width: 22px; color: var(--muted); font-size: 12px; text-align: center; }
.interval-field { max-width: 240px; margin: 14px 18px 0; }
@media (max-width: 760px) {
  .lowcode-layout { grid-template-columns: 1fr; }
  .mini-preview-wrap { position: static; max-width: 290px; margin: 0 auto; padding-top: 0; }
  .settings-grid, .banner-row { grid-template-columns: 1fr; }
  .banner-row .full, .banner-row .banner-row-head { grid-column: auto; }
}

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1d2633; color: #fff; padding: 9px 18px; border-radius: 20px; font-size: 13px; opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }

/* ---------- 地图相关 ---------- */
.btn-map { color: var(--ok); border-color: #cfe9df; }
.coord { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.coord.ok { background: #e1f5ee; color: var(--ok); }
.coord.no { background: #f1efe8; color: #8a8f98; }
.coord-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.coord-state { font-size: 12px; padding: 3px 10px; border-radius: 6px; }
.coord-state.ok { background: #e1f5ee; color: var(--ok); }
.coord-state.no { background: #faeeda; color: var(--warn); }
.coord-state.empty { background: #f1efe8; color: #8a8f98; }

/* ---------- 反馈审核 ---------- */
.tab { position: relative; }
.tab-badge { display: inline-block; min-width: 17px; height: 17px; line-height: 17px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; text-align: center; vertical-align: 1px; }
.tag.pending { background: #faeeda; color: var(--warn); }
.tag.approved { background: #e1f5ee; color: var(--ok); }
.tag.rejected { background: #fcebeb; color: var(--danger); }
/* 邻里动态审核状态 */
.tag.visible { background: #e1f5ee; color: var(--ok); }
.tag.removed { background: #fcebeb; color: var(--danger); }
.cm-thumb { display: block; width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.fb-type { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.fb-type.correction { background: #faeeda; color: #854f0b; }
.fb-type.comment { background: #e1f5ee; color: #0f6e56; }
.fb-type.search { background: #e6f1fb; color: #185fa5; }
.fb-stars { color: #d9d5d1; letter-spacing: 1px; }
.fb-stars i { font-style: normal; }
.fb-stars i.on { color: #ef9f27; }
.fb-detail { display: grid; grid-template-columns: 92px 1fr; gap: 10px 14px; font-size: 13px; }
.fb-detail dt { color: var(--muted); }
.fb-detail dd { margin: 0; color: var(--text); word-break: break-word; white-space: pre-wrap; }
.fb-note { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--bg); font-size: 12px; color: var(--muted); }
.fb-note strong { color: var(--text); }

/* ---------- 用户台账详情 ---------- */
.ud-section { margin-bottom: 20px; }
.ud-section:last-child { margin-bottom: 0; }
.ud-section h3 { font-size: 13px; font-weight: 600; margin: 0 0 10px; color: var(--text); }
.ud-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.ud-metrics > div { background: var(--bg); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.ud-metrics span { font-size: 11px; color: var(--muted); }
.ud-metrics b { font-size: 17px; font-weight: 600; }
.ud-table { font-size: 12px; }
.ud-table th, .ud-table td { padding: 6px 8px; }
.ud-ua { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* ---------- 右侧地图选点抽屉 ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(29, 38, 51, .28); opacity: 0; visibility: hidden; transition: opacity .24s ease, visibility .24s; z-index: 55; }
.drawer-mask.open { opacity: 1; visibility: visible; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 94vw); background: var(--surface); z-index: 60; display: flex; flex-direction: column; box-shadow: -14px 0 44px rgba(20, 30, 45, .18); transform: translateX(102%); visibility: hidden; transition: transform .24s ease, visibility .24s; }
.drawer.open { transform: translateX(0); visibility: visible; }
.drawer-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; align-items: center; }
.drawer-head .spacer { flex: 1; }
.drawer-tools { padding: 12px 18px; display: flex; gap: 8px; border-bottom: 1px solid var(--line); }
.map-tool-note { flex: 1; align-self: center; color: var(--muted); font-size: 12px; line-height: 1.5; }
.map-canvas { flex: 1; min-height: 320px; background: #eef1f4; position: relative; }
.map-canvas .map-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 28px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.map-canvas .map-fallback b { color: var(--danger); }
.drawer-foot { padding: 14px 18px; border-top: 1px solid var(--line); }
.map-coord { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.map-coord > div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.map-coord span { display: block; font-size: 11px; color: var(--muted); }
.map-coord b { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.map-hint { margin-top: 10px; font-size: 12px; color: var(--muted); }
.map-hint.err { color: var(--danger); }
.drawer-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.drawer-actions .grow { flex: 1; }
body.drawer-open { overflow: hidden; }

.drawer-tools button:disabled { opacity: .45; cursor: not-allowed; }
.leaflet-container { font-family: inherit; }
