/* ============ 设计系统（消防指挥深色主题） ============ */
:root {
  --bg: #070d18;
  --bg-2: #0a1524;
  --panel: #0e1a2c;
  --panel-2: #132341;
  --panel-3: #182b4a;
  --line: #1c2f4d;
  --line-2: #263d61;
  --txt: #dce8f7;
  --txt-2: #a8bcd8;
  --sub: #7f96b8;
  --acc: #ff6b3d;
  --acc-2: #ffa726;
  --blue: #3d8bff;
  --cyan: #2ec5ce;
  --green: #00d68f;
  --red: #ff3b5c;
  --purple: #7c5cff;
  --yellow: #ffca28;
  --shadow: 0 6px 24px rgba(0, 0, 0, .45);
  --radius: 10px;
  --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: #6aa8ff; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #24395c; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #33507d; }

/* ============ 通用组件 ============ */
.panel {
  background: linear-gradient(180deg, rgba(19, 35, 65, .75), rgba(14, 26, 44, .9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .5px; }
.panel-head .sub { font-size: 12px; color: var(--sub); }
.panel-body { padding: 12px 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  color: var(--txt);
  border-radius: 7px;
  font-size: 13px; cursor: pointer;
  font-family: var(--font);
  transition: all .16s;
  white-space: nowrap;
}
.btn:hover { background: #1f3760; border-color: #375a8c; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #ff6b3d, #ff8f4d); border-color: #ff8f4d; color: #fff; font-weight: 700; }
.btn-primary:hover { background: linear-gradient(135deg, #ff7f52, #ffa163); }
.btn-blue { background: linear-gradient(135deg, #2f6fe0, #4d8bff); border-color: #4d8bff; color: #fff; }
.btn-blue:hover { background: linear-gradient(135deg, #3f7ce8, #5f97ff); }
.btn-danger { background: rgba(255, 59, 92, .15); border-color: rgba(255, 59, 92, .5); color: #ff8095; }
.btn-danger:hover { background: rgba(255, 59, 92, .28); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-ghost { background: transparent; }

input, select, textarea {
  width: 100%;
  padding: 8px 11px;
  background: #0b1424;
  border: 1px solid var(--line-2);
  color: var(--txt);
  border-radius: 7px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, .13);
}
textarea { resize: vertical; min-height: 78px; line-height: 1.65; }
select option { background: #0e1a2c; }

.field { margin-bottom: 13px; }
.field > label { display: block; margin-bottom: 5px; font-size: 12.5px; color: var(--txt-2); }
.field .hint { margin-top: 4px; font-size: 11.5px; color: var(--sub); }
.field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field-row > .field { flex: 1 1 200px; min-width: 0; margin-bottom: 0; }
.field-row > .field.span-2 { flex: 2 1 320px; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}
table.grid th { color: var(--sub); font-weight: 600; background: rgba(10, 21, 36, .6); white-space: nowrap; }
table.grid tbody tr:hover { background: rgba(30, 60, 100, .28); }
table.grid td .ops { display: flex; gap: 6px; }

.tag {
  display: inline-block; padding: 1.5px 8px; border-radius: 10px;
  font-size: 11.5px; line-height: 1.6;
  background: rgba(61, 139, 255, .16); color: #8fbcff; border: 1px solid rgba(61, 139, 255, .3);
}
.tag.l1 { background: rgba(255, 59, 92, .16); color: #ff8095; border-color: rgba(255, 59, 92, .35); }
.tag.l2 { background: rgba(255, 167, 38, .16); color: #ffc16f; border-color: rgba(255, 167, 38, .35); }
.tag.l3 { background: rgba(77, 208, 225, .16); color: #7fe3ea; border-color: rgba(77, 208, 225, .35); }
.tag.ok { background: rgba(0, 214, 143, .15); color: #4fe3ae; border-color: rgba(0, 214, 143, .32); }
.tag.no { background: rgba(255, 59, 92, .14); color: #ff8095; border-color: rgba(255, 59, 92, .3); }
.tag.gray { background: rgba(140, 160, 190, .14); color: var(--sub); border-color: rgba(140, 160, 190, .28); }

.empty { padding: 46px 20px; text-align: center; color: var(--sub); font-size: 13px; }
.empty::before { content: "📭"; display: block; font-size: 30px; margin-bottom: 10px; opacity: .65; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 11px 0 2px; font-size: 12.5px; color: var(--sub); }
.pager button {
  padding: 4px 11px; background: var(--panel-2); border: 1px solid var(--line-2);
  color: var(--txt-2); border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.pager button:hover:not(:disabled) { background: var(--panel-3); color: var(--txt); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ============ 弹窗 ============ */
.mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(3, 8, 16, .74);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.mask[hidden] { display: none; }
.modal {
  width: 100%; max-width: 560px;
  max-height: 88vh; display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.modal.wide { max-width: 880px; }
.modal.full { max-width: 1180px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-close { background: none; border: 0; color: var(--sub); font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--txt); }
.modal-body { padding: 16px 18px; overflow: auto; flex: 1; }
.modal-foot {
  padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 9px;
}

/* ============ 提示 ============ */
#toastWrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 9px 18px; border-radius: 8px; font-size: 13.5px;
  background: rgba(20, 36, 60, .96); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); animation: toastIn .22s ease;
  max-width: 80vw;
}
.toast.success { border-color: rgba(0, 214, 143, .5); color: #6fe8bb; }
.toast.error { border-color: rgba(255, 59, 92, .5); color: #ff8095; }
.toast.info { border-color: rgba(61, 139, 255, .5); color: #9cc4ff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ============ 地图组件 ============ */
.xffa-map { position: relative; overflow: hidden; border-radius: var(--radius); }
.xffa-map-svg { touch-action: none; user-select: none; }
.xffa-map-controls { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 5px; }
.xffa-map-controls button {
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(14, 26, 44, .9); border: 1px solid var(--line-2);
  color: var(--txt-2); cursor: pointer; font-size: 15px; line-height: 1;
}
.xffa-map-controls button:hover { background: var(--panel-3); color: #fff; }
.xffa-map-tip {
  position: absolute; left: 10px; top: 10px; display: none;
  background: rgba(7, 14, 26, .93); border: 1px solid var(--line-2);
  padding: 5px 10px; border-radius: 6px; font-size: 12.5px; color: var(--txt);
  pointer-events: none; max-width: 70%; z-index: 5;
}
.xffa-map-note {
  position: absolute; left: 10px; bottom: 8px;
  font-size: 11px; color: rgba(160, 185, 215, .62);
  pointer-events: none; letter-spacing: .3px;
}
.xffa-map-note b { color: rgba(200, 220, 245, .8); font-weight: 600; }
.ffa-pulse { animation: ffaPulse 2.2s ease-out infinite; transform-origin: center; }
@keyframes ffaPulse {
  0% { transform: scale(.6); opacity: .5; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}
/* 定位高亮圈：虚线外圈轻微旋转/呼吸，提示「已定位到该元素」 */
.ffa-locate circle { transform-origin: center; }
.ffa-locate circle:first-child { animation: ffaLocate 2.4s ease-out infinite; }
@keyframes ffaLocate {
  0% { transform: scale(.85); opacity: .9; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}
/* 比例尺 / 指北针 / 回退提示 */
.xffa-scale { position: absolute; right: 10px; bottom: 8px; display: flex; align-items: center; gap: 6px; font-size: 11px; color: rgba(200,220,245,.82); pointer-events: none; }
.xffa-scale .bar { display: inline-block; height: 6px; border: 1px solid rgba(200,220,245,.7); border-top: none; background: rgba(200,220,245,.14); }
.xffa-north { position: absolute; right: 12px; top: 46px; width: 34px; height: 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #ffce4d; pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.xffa-north .arr { font-size: 15px; line-height: 1; }
.xffa-north .lab { font-size: 11px; font-weight: 700; color: #eaf2ff; }
.xffa-banner { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); background: rgba(120,40,20,.92); border: 1px solid rgba(255,120,80,.5); color: #ffd9c9; padding: 5px 12px; border-radius: 7px; font-size: 12px; z-index: 8; pointer-events: none; max-width: 92%; text-align: center; }

/* ---- 地图主题（离线示意图配色，由容器 class 切换） ---- */
.xffa-map {
  --xffa-sea-1: #0c2438; --xffa-sea-2: #050e1a;
  --xffa-land-1: #1d456a; --xffa-land-2: #102a42;
  --xffa-region-fill: #26557d; --xffa-region-stroke: rgba(95,208,255,.85);
  --xffa-grid: rgba(120,170,230,.10); --xffa-river: #1f6fc4;
  --xffa-label: #eaf2ff; --xffa-label-stroke: #0a1626; --xffa-note: rgba(160,185,215,.62);
  --xffa-road: rgba(159,180,207,.42);
}
.xffa-map.xffa-light {
  --xffa-sea-1: #eef3f8; --xffa-sea-2: #d8e3ef;
  --xffa-land-1: #ffffff; --xffa-land-2: #eef3f8;
  --xffa-region-fill: #cfe0f0; --xffa-region-stroke: rgba(30,90,140,.7);
  --xffa-grid: rgba(80,120,170,.12); --xffa-river: #2f7fc4;
  --xffa-label: #15395c; --xffa-label-stroke: #ffffff; --xffa-note: rgba(40,70,100,.7);
  --xffa-road: rgba(120,140,170,.5);
}
.xffa-sea-stop-1 { stop-color: var(--xffa-sea-1); }
.xffa-sea-stop-2 { stop-color: var(--xffa-sea-2); }
.xffa-land-stop-1 { stop-color: var(--xffa-land-1); }
.xffa-land-stop-2 { stop-color: var(--xffa-land-2); }
.xffa-sea { fill: url(#xffaSea); }
.xffa-land { fill: url(#xffaLand); }
.xffa-grid-line { stroke: var(--xffa-grid); }
.xffa-road { stroke: var(--xffa-road); }
.xffa-river { stroke: var(--xffa-river); }
.xffa-river-hi { opacity: .7; stroke-width: 1; }
.xffa-region-poly { fill: transparent; stroke: transparent; stroke-width: 0; pointer-events: none; }
.xffa-region-poly.xffa-region-hover { fill: transparent; }
.xffa-region-hl { stroke: transparent !important; stroke-width: 0 !important; }
.xffa-region-ov { fill: transparent; stroke: transparent; stroke-width: 0; pointer-events: none; }
.xffa-region-ov.xffa-region-hover { fill: transparent !important; }
.xffa-region-ov.xffa-region-hl { stroke: transparent !important; stroke-width: 0 !important; }
.xffa-label { fill: var(--xffa-label); paint-order: stroke; stroke: var(--xffa-label-stroke); stroke-width: 3; }
.xffa-map-note { color: var(--xffa-note); }

/* 地图模式切换控件（浅色/深色、标准/卫星/深色） */
.xffa-map-modes { position: absolute; left: 10px; bottom: 12px; z-index: 7; display: flex; gap: 6px; }
.xffa-map-modes button {
  padding: 4px 11px; font-size: 12px; border-radius: 14px; cursor: pointer;
  background: rgba(10,20,36,.88); border: 1px solid var(--line-2); color: var(--sub);
}
.xffa-map-modes button:hover { color: #fff; border-color: var(--sub); }
.xffa-map-modes button.on { color: #fff; border-color: currentColor; background: rgba(30,60,100,.9); }

/* 首页一张图：标记信息卡片 */
.map-info-card {
  position: absolute; left: 10px; top: 52px; z-index: 9; width: 252px; max-width: calc(100% - 20px);
  display: none; pointer-events: auto;
  background: rgba(9, 18, 33, .96); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 12px 13px 13px; color: var(--txt);
  box-shadow: 0 8px 26px rgba(0,0,0,.45);
}
.map-info-card.show { display: block; animation: micIn .15s ease-out; }
@keyframes micIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.map-info-card .mic-close {
  position: absolute; right: 7px; top: 6px; width: 22px; height: 22px; border: 0; cursor: pointer;
  background: transparent; color: var(--sub); font-size: 17px; line-height: 1; border-radius: 5px;
}
.map-info-card .mic-close:hover { background: rgba(255,255,255,.08); color: #fff; }
.map-info-card .mic-tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-bottom: 7px; }
.map-info-card .mic-tag.unit { background: rgba(255,107,61,.18); color: #ff9466; }
.map-info-card .mic-tag.hyd { background: rgba(46,197,206,.18); color: #5fe0e6; }
.map-info-card .mic-tag.org { background: rgba(255,202,40,.18); color: #ffce4d; }
.map-info-card h4 { margin: 0 0 8px; font-size: 15px; color: #fff; padding-right: 20px; }
.map-info-card .mic-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 3px 0; border-bottom: 1px dashed rgba(120,150,190,.16); }
.map-info-card .mic-row:last-child { border-bottom: 0; }
.map-info-card .mic-row span { color: var(--sub); }
.map-info-card .mic-row b { color: #fff; font-weight: 600; text-align: right; }
.map-info-card .mic-note { margin-top: 8px; font-size: 12px; line-height: 1.6; color: var(--txt-2); background: rgba(255,255,255,.04); border-radius: 6px; padding: 7px 9px; }

/* ============ 移动端适配 ============ */
.mobile-only { display: none !important; }
@media (max-width: 768px) {
  .mobile-only { display: inline-flex !important; }
  .hide-sm { display: none !important; }
  .field-row { flex-direction: column; gap: 0; }
  .modal { max-height: 92vh; }
  table.grid th, table.grid td { padding: 7px 8px; font-size: 12.5px; }
}
