/* ============================================================
   鲲帆 KUNFAN · 全球战区网格系统
   设计语言：测绘作战台 (Tactical Survey Console)
   —— 暖砂纸底 · 宋体标题 · 等宽数据 · 朱红唯一强调 · 真实制图仪器
   ============================================================ */

:root {
  /* 纸与墨 —— 测绘档案纸 */
  --paper: #ECE6D6;          /* 页面暖砂纸 */
  --paper-sunk: #E3DCc9;     /* 凹陷区 */
  --card: #F5F0E3;           /* 卡片纸 */
  --card-hi: #FBF8EF;        /* 高亮纸面 */
  --map-bg: #EAE2CF;         /* 地图图幅（比页面略深） */

  --ink: #16242C;            /* 墨（深青炭，非纯黑） */
  --ink-2: #36454E;
  --ink-3: #69757C;
  --ink-4: #99A29E;

  /* 界线 —— 图纸折痕（暖棕，非冷灰） */
  --line: #CBBC9E;
  --line-soft: #DDD2BB;
  --line-hard: #B3A37E;

  /* 信号 / 状态色 */
  --signal: #C8442E;         /* 朱红：热线索 · 已激活 · 导航（唯一强调色 / 印章色） */
  --signal-dim: #F2DCD4;
  --survey: #0F7B82;         /* 测绘青：已联系 / 已拜访 */
  --survey-dim: #D5E7E8;
  --gold: #B07C1E;           /* 签约金 */
  --gold-dim: #F0E3C2;
  --slate: #4E6472;          /* 已联系 */
  --slate-dim: #DCE3E7;
  --dead: #8A8A82;           /* 已淘汰 */

  --focus: #0B556E;          /* 焦点环（深青，功能色） */
  --grid: rgba(150, 120, 70, .045); /* 全局极淡方格背景 */

  /* 字体 */
  --f-display: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --f-body: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, "Segoe UI", sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "IBM Plex Mono", Consolas, "Courier New", monospace;

  --r: 4px;
  --shadow: 0 1px 2px rgba(22, 36, 44, .07), 0 10px 30px rgba(22, 36, 44, .07);
  --side-w: 236px;
  --top-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--survey); }

::selection { background: var(--signal); color: #fff; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- 通用零件 ---------- */
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  background: var(--card-hi);
  border: 1px solid var(--line-hard);
  border-radius: var(--r);
  color: var(--ink);
  font-size: 13px;
  transition: background .12s, border-color .12s, transform .1s, box-shadow .12s;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(22,36,44,.04);
}
.btn:hover { background: #fff; border-color: var(--ink-3); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #233640; }
.btn.signal { background: var(--signal); color: #fff; border-color: var(--signal); }
.btn.signal:hover { background: #ad3a26; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--paper-sunk); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
/* 管理员已登录态：按钮高亮，提示当前拥有导出/导入/清空权限 */
.btn.on { background: var(--signal); color: #fff; border-color: var(--signal); }
.btn.on:hover { background: #ad3a26; }

.field {
  padding: 7px 10px;
  background: var(--card-hi);
  border: 1px solid var(--line-hard);
  border-radius: var(--r);
  outline: none;
  min-width: 0;
  transition: border-color .12s, box-shadow .12s;
}
.field:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(11,85,110,.12); }
textarea.field { font-family: var(--f-mono); font-size: 12px; line-height: 1.55; resize: vertical; }

.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 11px;
  font-family: var(--f-mono);
  letter-spacing: .02em;
  background: var(--slate-dim);
  color: var(--ink-2);
  border: 1px solid transparent;
}

/* 状态徽标 */
.st { font-family: var(--f-mono); font-size: 11px; padding: 1px 7px; border-radius: 2px; border: 1px solid; white-space: nowrap; }
.st-0 { color: var(--ink-3); border-color: var(--line-hard); background: #fff; }                /* 待接触 */
.st-1 { color: var(--survey); border-color: var(--survey); background: var(--survey-dim); }      /* 已联系 */
.st-2 { color: #fff; border-color: var(--survey); background: var(--survey); }                   /* 已拜访 */
.st-3 { color: #fff; border-color: var(--signal); background: var(--signal); }                   /* 有意向 */
.st-4 { color: #fff; border-color: var(--gold); background: var(--gold); }                       /* 已签约 */
.st-5 { color: var(--dead); border-color: var(--line-hard); background: var(--paper-sunk); text-decoration: line-through; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 18px;
  background: var(--ink);
  color: #e8ecef;
  z-index: 40;
  border-bottom: 2px solid var(--signal);   /* 战线 */
}
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand .mark {
  font-family: var(--f-display);
  font-size: 20px; font-weight: 700; letter-spacing: .06em; color: #fff;
}
.brand .sub {
  font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .22em;
  color: #7f8d98; text-transform: uppercase;
}
.topbar .spacer { flex: 1; }
.topstat {
  display: flex; align-items: baseline; gap: 5px;
  font-family: var(--f-mono); font-size: 11px; color: #93a1ac;
}
.topstat b { font-size: 15px; color: #fff; font-weight: 600; }
.topbar .divider-v { width: 1px; height: 22px; background: #2e3a44; }
.sync-badge {
  font-family: var(--f-mono); font-size: 11px; color: #93a1ac;
  border: 1px solid #2e3a44; border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.sync-badge.on { color: #7ee0a8; border-color: #2f6b4a; background: rgba(46, 160, 100, .12); }

/* 顶栏「业务员」选择器：深色顶栏上保证高对比、原生下拉也能看清 */
.topbar .topstat { color: #cdd6dd; }
.topbar #meSelect {
  background: #fff;
  color: #16242c;
  border-color: rgba(255,255,255,.3);
  font-weight: 600;
  color-scheme: light;            /* 强制原生下拉用浅色面板，避免深色系统下看不清 */
}
.topbar #meSelect:hover { border-color: rgba(255,255,255,.6); }
.topbar #meSelect:focus { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(200,68,46,.3); }

/* ---------- 侧栏 ---------- */
.sidebar {
  position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--side-w);
  background: var(--paper-sunk);
  border-right: 1px solid var(--line);
  padding: 16px 0;
  overflow-y: auto;
  z-index: 30;
}
.nav-group { padding: 0 12px; margin-bottom: 18px; }
.nav-group > .eyebrow { padding: 0 8px 7px; display: block; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px;
  background: transparent; border: 0; border-radius: var(--r);
  color: var(--ink-2); font-size: 13.5px; text-align: left;
  transition: background .12s, color .12s;
  position: relative;
}
.nav-item .idx { font-family: var(--f-mono); font-size: 10px; color: var(--ink-4); width: 16px; }
.nav-item:hover { background: #d7cdb6; color: var(--ink); }
.nav-item.on { background: var(--ink); color: #fff; box-shadow: inset 3px 0 0 var(--signal); }
.nav-item.on .idx { color: #8b98a3; }
.nav-item .badge {
  margin-left: auto; font-family: var(--f-mono); font-size: 10px;
  background: var(--signal); color: #fff; border-radius: 9px; padding: 0 6px;
}

/* ---------- 主区 ---------- */
.main {
  margin-left: var(--side-w);
  margin-top: var(--top-h);
  min-height: calc(100vh - var(--top-h));
  padding: 0;
}
.view { display: none; padding: 24px 28px 64px; }
.view.on { display: block; }

.page-head { margin-bottom: 20px; }
.page-head h1 {
  font-family: var(--f-display); font-weight: 700;
  font-size: 26px; margin: 3px 0 5px; letter-spacing: .01em;
}
.page-head .lede { color: var(--ink-3); font-size: 13px; max-width: 780px; margin: 0; }

/* ---------- 城市选择条 ---------- */
.citybar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 13px; margin-bottom: 15px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow);
}
.citybar label { font-size: 12px; color: var(--ink-3); }
.citybar .grow { flex: 1; }

.citypick { position: relative; }
.citypick input { width: 190px; }
.citypick .list {
  position: absolute; top: 100%; left: 0; width: 340px; max-height: 340px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line-hard); border-radius: var(--r);
  box-shadow: var(--shadow); z-index: 20; display: none;
}
.citypick .list.on { display: block; }
.citypick .list .row {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
}
.citypick .list .row:hover, .citypick .list .row.sel { background: var(--signal-dim); }
.citypick .list .row .c { font-family: var(--f-mono); font-size: 10px; color: var(--ink-4); }
.citypick .list .row .n { font-weight: 600; }
.citypick .list .row .r { margin-left: auto; font-size: 11px; color: var(--ink-3); }

/* ---------- 城市作战图头部 ---------- */
.cityhead {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: stretch;
  padding: 0; margin-bottom: 15px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--card-hi);
  box-shadow: var(--shadow);
}
.cityhead > div:first-child {
  padding: 16px 18px 16px 20px;
  border-left: 3px solid var(--signal);
}
.cityhead .code {
  font-family: var(--f-mono); font-size: 11px; color: var(--signal); letter-spacing: .1em;
}
.cityhead h2 { font-family: var(--f-display); font-size: 28px; margin: 0 0 2px; font-weight: 700; }
.cityhead .meta { font-size: 12.5px; color: var(--ink-3); }
.cityhead .meta b { color: var(--ink-2); font-weight: 600; }

.kpis {
  display: flex; align-items: stretch;
  border-left: 1px solid var(--line);
}
.kpi {
  display: flex; flex-direction: column; justify-content: center;
  padding: 12px 22px; border-right: 1px solid var(--line); min-width: 86px;
}
.kpi:last-child { border-right: 0; }
.kpi .k { font-family: var(--f-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.kpi .v { font-family: var(--f-mono); font-size: 24px; font-weight: 600; line-height: 1.1; }
.kpi.sig .v { color: var(--signal); }
.kpi.sur .v { color: var(--survey); }
.kpi.gld .v { color: var(--gold); }

/* ---------- 200 格矩阵（签名元素） ---------- */
.gridwrap {
  background: var(--card-hi);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.gridhead { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.gridhead .t { font-family: var(--f-display); font-size: 15px; font-weight: 700; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.legend .li { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-3); }
.legend .sw { width: 10px; height: 10px; border-radius: 1px; border: 1px solid rgba(0,0,0,.15); }

/* （200 格速查 / 区块网格样式已移除：地图现以真实地图 + 客户点位呈现） */

/* 图层开关标签 */
.lyr { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.lyr input { accent-color: var(--signal); width: 14px; height: 14px; }

/* （区块详情面板 .dpanel 样式已移除） */

.clist { width: 100%; border-collapse: collapse; }
.clist th {
  text-align: left; font-weight: 600; font-size: 11px; color: var(--ink-3);
  padding: 9px 12px; background: var(--paper-sunk); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.clist td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.clist tbody tr { cursor: pointer; transition: background .1s; }
.clist tbody tr:hover { background: #f3f7f4; }
.clist .cseq { font-family: var(--f-mono); font-size: 11.5px; color: var(--signal); white-space: nowrap; }
.clist .cname { font-weight: 600; }
.clist .caddr { color: var(--ink-2); font-size: 12.5px; max-width: 340px; }
.clist .num { font-family: var(--f-mono); font-size: 12px; text-align: right; white-space: nowrap; }
.clist .acts { white-space: nowrap; text-align: right; }
.clist .prods { font-size: 11.5px; color: var(--ink-3); max-width: 220px; }

.empty {
  padding: 34px 20px; text-align: center; color: var(--ink-3); font-size: 13px;
}
.empty .big { font-family: var(--f-display); font-size: 17px; color: var(--ink-2); margin-bottom: 6px; }

/* ---------- 看板 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.statcard {
  background: var(--card-hi); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.statcard .k { font-size: 11.5px; color: var(--ink-3); font-family: var(--f-mono); letter-spacing: .04em; }
.statcard .v { font-family: var(--f-mono); font-size: 26px; font-weight: 600; line-height: 1.15; }
.statcard .d { font-size: 11px; color: var(--ink-4); }

.pivot { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card-hi);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pivot th {
  text-align: left; padding: 9px 12px; background: var(--paper-sunk);
  border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--ink-2); font-weight: 600;
  position: sticky; top: 0;
}
.pivot td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.pivot tbody tr:hover { background: #f3f7f4; }
.pivot .num { font-family: var(--f-mono); text-align: right; }
.pivot tr.lvl-region { background: #ece5d3; font-weight: 600; }
.pivot tr.lvl-region td:first-child { border-left: 3px solid var(--ink); }
.pivot tr.lvl-mid td:first-child { padding-left: 24px; border-left: 3px solid var(--line-hard); }
.pivot tr.lvl-country td:first-child { padding-left: 40px; }
.pivot .barwrap { width: 130px; }
.bar { height: 7px; background: var(--paper-sunk); border-radius: 1px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar i.v { background: var(--survey); }
.bar i.s { background: var(--gold); }
.pivot .pct { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); }

/* ---------- 导入 / 提示词 ---------- */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }

.panel {
  background: var(--card-hi); border: 1px solid var(--line); border-radius: var(--r);
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.panel > .ph {
  padding: 12px 15px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.panel > .ph .t { font-family: var(--f-display); font-size: 15px; font-weight: 700; }
.panel > .ph .grow { flex: 1; }
.panel > .pb { padding: 15px; }
.panel > .pb.tight { padding: 0; }

.hint { font-size: 12px; color: var(--ink-3); line-height: 1.65; }
.hint code {
  font-family: var(--f-mono); font-size: 11px; background: var(--paper-sunk);
  padding: 1px 4px; border-radius: 2px;
}

.preview { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fafbfc; }
.preview table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.preview th, .preview td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.preview th { background: var(--paper-sunk); position: sticky; top: 0; font-size: 11px; }
.preview tr.bad { background: #fdeceb; }

.msg { padding: 8px 12px; border-radius: var(--r); font-size: 12.5px; margin-top: 10px; border: 1px solid; }
.msg.ok { background: #e7f2ea; border-color: #b6d7bf; color: #1e5c31; }
.msg.err { background: #fdeceb; border-color: #eeb7b0; color: #8f2a1d; }
.msg.info { background: var(--survey-dim); border-color: #9cc4c7; color: #0a5b62; }

/* ---------- 导入冲突对比报告 ---------- */
.conflict { border: 1px solid #f0c9a3; border-radius: var(--r); background: #fff8f1; overflow: hidden; }
.conflict-h { padding: 9px 12px; font-size: 13px; font-weight: 600; color: #9a5212; background: #fdeede; border-bottom: 1px solid #f0c9a3; }
.conflict-g { padding: 10px 12px; border-bottom: 1px solid #f3ddc6; }
.conflict-g:last-child { border-bottom: none; }
.conflict-t { font-size: 13px; font-weight: 600; color: #16242e; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conflict-tag { font-size: 11px; font-weight: 600; color: #9a5212; background: #fbe3c8; border-radius: 999px; padding: 1px 8px; }
.conflict-tb { width: 100%; border-collapse: collapse; font-size: 12px; background: #fff; border: 1px solid #f0c9a3; border-radius: 6px; overflow: hidden; }
.conflict-tb th { background: #fdeede; text-align: left; padding: 5px 8px; font-weight: 600; color: #9a5212; width: 90px; vertical-align: top; }
.conflict-tb td { padding: 5px 8px; vertical-align: top; color: #16242e; }
.conflict-tb .cv { display: inline-block; margin-right: 10px; }
.conflict-note { font-size: 11.5px; color: #9a6a3a; margin-top: 6px; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(22, 36, 44, .46);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto; z-index: 60;
  backdrop-filter: blur(2px);
}
.modal.on { display: flex; }
.sheet {
  width: 100%; max-width: 660px;
  background: var(--card-hi); border-radius: 6px; box-shadow: 0 24px 60px rgba(0,0,0,.3);
  overflow: hidden; border: 1px solid var(--line-hard);
}
.sheet .sh {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--paper-sunk);
}
.sheet .sh .seq { font-family: var(--f-mono); font-size: 13px; color: var(--signal); font-weight: 600; }
.sheet .sh h3 { font-family: var(--f-display); font-size: 20px; margin: 1px 0 3px; font-weight: 700; }
.sheet .sh .x { margin-left: auto; background: none; border: 0; font-size: 20px; color: var(--ink-3); line-height: 1; padding: 2px 6px; }
.sheet .sb { padding: 16px 20px; }
.sheet .sf { padding: 12px 20px; border-top: 1px solid var(--line); background: var(--card); display: flex; gap: 8px; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--ink-3); font-size: 12px; }
.kv dd { margin: 0; word-break: break-word; }
.kv dd.big { font-family: var(--f-mono); }
.kv a { word-break: break-all; }

.stepper { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.stepper .s {
  padding: 3px 9px; border: 1px solid var(--line-hard); background: #fff;
  border-radius: 2px; font-size: 12px; color: var(--ink-2);
}
.stepper .s:hover { border-color: var(--ink-3); }
.stepper .s.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 9px 18px; border-radius: 3px;
  font-size: 13px; z-index: 80; opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
  box-shadow: var(--shadow);
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.scroll-x { overflow-x: auto; }

.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  padding: 3px 9px; border: 1px solid var(--line-hard); background: #fff;
  border-radius: 11px; font-size: 12px; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }

/* ---------- 地图作战 ---------- */
.maplayout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
  align-items: stretch;
}
@media (max-width: 1180px) { .maplayout { grid-template-columns: 1fr; } }

.mapwrap { position: relative; }
#mapRoot {
  position: relative;
  width: 100%;
  height: 660px;
  background: var(--map-bg);
  border: 1px solid var(--ink-2);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), var(--shadow);
  /* 移动端：禁用浏览器默认触摸滚动/缩放，改由 JS 处理平移与双指缩放 */
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 1180px) { #mapRoot { height: 520px; } }

/* ---------- 零依赖原生瓦片地图引擎 ---------- */
.kt-tiles, .kt-ovl, .kt-popup { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.kt-tiles { z-index: 1; background: #aadaff; will-change: transform; }
.kt-ovl { will-change: transform; }
.kt-tile { position: absolute; display: block; user-select: none; -webkit-user-drag: none; }
.kt-ovl { z-index: 2; pointer-events: none; }
.kt-dot {
  position: absolute; width: 13px; height: 13px; margin: -7px 0 0 -7px;
  border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45);
  cursor: pointer; pointer-events: auto; transition: transform .1s;
}
.kt-dot:hover { transform: scale(1.35); z-index: 3; }
.kt-popup { z-index: 6; width: 268px; pointer-events: none; }
.kt-popup-in {
  position: relative; background: #fff; border: 1px solid var(--line-hard); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(22,36,44,.28); padding: 10px 12px; pointer-events: auto;
}
.kt-popup-x { position: absolute; top: 3px; right: 6px; border: 0; background: none; font-size: 19px; line-height: 1; color: #8a98a3; cursor: pointer; }
.kt-popup-x:hover { color: #16242c; }

/* 导出兜底弹窗（file:// 下浏览器会拦截 Blob 下载，用此保证一定能拿到数据） */
.export-modal { position: fixed; inset: 0; background: rgba(20,32,40,.5); z-index: 60; display: flex; align-items: center; justify-content: center; }
.export-modal .em-box { width: min(720px, 92vw); max-height: 84vh; display: flex; flex-direction: column; background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; }
.export-modal .em-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
.export-modal .em-h .em-x { margin-left: auto; border: 0; background: none; font-size: 20px; line-height: 1; color: #8a98a3; cursor: pointer; }
.export-modal .em-ta { flex: 1; min-height: 280px; margin: 0; border: 0; padding: 12px 14px; font-family: var(--f-mono); font-size: 12px; resize: none; outline: none; }
.export-modal .em-act { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.export-modal .em-tip { font-size: 11px; color: var(--ink-4); }

.mapfallback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 30px; text-align: center;
  background: var(--map-bg); border: 1px solid var(--ink-2); border-radius: var(--r);
  color: var(--ink-2); font-size: 13px; z-index: 5;
}
.mapfallback .big { font-family: var(--f-display); font-size: 18px; font-weight: 700; color: var(--ink); }

/* 底图加载失败时的角落提示 */
.maphint {
  position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%);
  background: rgba(178, 44, 28, .94); color: #fff; font-size: 12px; line-height: 1.4;
  padding: 7px 12px; border-radius: 8px; box-shadow: 0 6px 18px rgba(22,36,44,.3);
  z-index: 12; max-width: 86%; text-align: center; display: none;
}

.maplegend {
  position: absolute; left: 14px; top: 52px; z-index: 6;
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 7px 11px; max-width: calc(100% - 28px);
  background: rgba(251, 248, 239, .94);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 1px 4px rgba(22, 36, 44, .12);
}
.maplegend .li { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-2); }
.maplegend .sw { width: 9px; height: 9px; border-radius: 1px; border: 1px solid rgba(0, 0, 0, .18); }

.mapside {
  display: flex; flex-direction: column;
  background: var(--card-hi); border: 1px solid var(--line); border-radius: var(--r);
  max-height: 660px; overflow: hidden; box-shadow: var(--shadow);
}
.mapside-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 12px; background: var(--paper-sunk); border-bottom: 1px solid var(--line);
  font-family: var(--f-display); font-size: 14px; font-weight: 700;
}
.mapside-head .btn { margin-left: auto; }
.mapside-body { overflow-y: auto; padding: 4px 0; flex: 1; }

.mrow {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; background: none; border: 0; border-bottom: 1px solid var(--line-soft);
  transition: background .1s;
}
.mrow:hover { background: #f3f7f4; }
.mrow.on { background: var(--signal-dim); }
.mrow .l1 { display: flex; align-items: baseline; gap: 7px; }
.mrow .seq { font-family: var(--f-mono); font-size: 11px; color: var(--signal); }
.mrow .nm { font-weight: 600; font-size: 13.5px; }
.mrow .l2 { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.mrow .l3 { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.mrow .cnt { margin-left: auto; font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); }

/* 地图信息窗 */
.iw { min-width: 250px; max-width: 310px; font-family: var(--f-body); font-size: 13px; color: #16242C; }
.iw .h { font-family: var(--f-display); font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.iw .s { font-size: 11px; color: #69757C; font-family: var(--f-mono); margin-bottom: 6px; }
.iw dl { display: grid; grid-template-columns: 52px 1fr; gap: 3px 8px; margin: 0 0 8px; font-size: 12.5px; }
.iw dt { color: #69757C; }
.iw dd { margin: 0; word-break: break-word; }
.iw .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.iw .acts a, .iw .acts button {
  padding: 4px 10px; border-radius: 3px; font-size: 12px; text-decoration: none;
  border: 1px solid var(--line-hard); background: #fff; color: #16242C; cursor: pointer;
}
.iw .acts .go { background: var(--signal); border-color: var(--signal); color: #fff; }
.iw .acts .go:hover { background: #ad3a26; }

.pinmode #mapRoot { cursor: crosshair; }

.mapstat {
  position: absolute; right: 14px; bottom: 14px; z-index: 6;
  padding: 5px 11px; font-size: 11.5px; color: var(--ink-2);
  background: rgba(251, 248, 239, .94); border: 1px solid var(--line);
  border-radius: 4px; box-shadow: 0 1px 4px rgba(22, 36, 44, .12);
  font-family: var(--f-mono);
}
.pinbar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 7;
  padding: 6px 14px; background: var(--signal); color: #fff; border-radius: 3px;
  font-size: 13px; box-shadow: var(--shadow);
}

/* （离线 SVG 作战地图样式已移除：现改用零依赖原生瓦片地图） */

.mapctl {
  position: absolute; top: 14px; right: 14px; z-index: 7;
  display: flex; flex-direction: column; gap: 6px;
}
.mapctl button {
  width: 34px; height: 34px; font-size: 18px; line-height: 1;
  background: var(--card-hi); border: 1px solid var(--line-hard); border-radius: 6px;
  color: var(--ink); cursor: pointer; box-shadow: 0 1px 4px rgba(22,36,44,.14);
  transition: background .12s, border-color .12s;
}
.mapctl button:hover { background: #fff; border-color: var(--ink-3); }

.mapbadge {
  position: absolute; top: 14px; left: 14px; z-index: 7;
  padding: 5px 11px; font-size: 11.5px; color: #fff;
  background: var(--ink); border-radius: 4px; box-shadow: var(--shadow);
  font-family: var(--f-mono); letter-spacing: .04em;
}
.basemap-switch {
  position: absolute; top: 14px; right: 60px; z-index: 7;
  display: flex; gap: 4px; background: rgba(255,255,255,.92);
  border: 1px solid var(--line); border-radius: 5px; padding: 3px; box-shadow: var(--shadow);
}
.basemap-switch button {
  border: 1px solid transparent; background: #fff; color: var(--ink-2);
  font-size: 12px; padding: 4px 10px; border-radius: 3px; cursor: pointer; font-family: var(--f-body);
}
.basemap-switch button:hover { background: var(--paper-sunk); }
.basemap-switch button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* （离线弹层 .mappop / .iwx 已移除：客户信息现由原生 popup 呈现 .iw） */

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper-sunk); }
::-webkit-scrollbar-thumb { background: #bdb09a; border-radius: 5px; border: 2px solid var(--paper-sunk); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .gcell:hover { transform: none; }
}

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .kpis { gap: 12px; }
}
