/* ============================================
   站点维护管理模块 - 样式表（明亮主题，与主系统统一）
   ============================================ */
:root {
    --primary: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --accent: #0f766e;
    --accent-light: #14b8a6;
    --success: #0f766e;
    --warn: #b45309;
    --danger: #dc2626;

    --bg: #f4f6f9;
    --bg-panel: #ffffff;
    --bg-elev: #f1f5f9;
    --bg-subtle: #f8fafc;
    --bg-card-hover: #e8eef5;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-secondary: #334155;
    --text-dim: #64748b;
    --text-muted: #94a3b8;

    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.14);
    --radius: 10px;
    --radius-sm: 8px;
    --font: 'Noto Sans SC', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    --ju: #c2410c;
    --ju-bg: #fff7ed;
    --ju-border: #fdba74;
    --ju-ok: #0f766e;
    --ju-ok-bg: #f0fdfa;
    --ju-ok-border: #5eead4;
    --drawer-w: 400px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 顶部栏 */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 48px;
    background: #1e3a8a;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset;
    flex-shrink: 0;
}
.admin-header h1 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.admin-header .logo {
    width: 30px; height: 30px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    color: #fff;
}
.header-actions { display: flex; gap: 10px; align-items: center; }
.admin-header .btn,
.admin-header .btn-ghost {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
}
.admin-header .btn:hover,
.admin-header .btn-ghost:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }

.header-settings { position: relative; }
.admin-header .btn-settings {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
}
.admin-header .btn-settings[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}
.settings-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 1200;
}
.settings-menu[hidden] { display: none !important; }
.settings-menu a {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
}
.settings-menu a:hover {
    background: var(--bg-elev);
    color: var(--primary);
}
.settings-menu-group {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}
.settings-menu-label {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
}
.settings-menu { min-width: 280px; }
.settings-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
}
.settings-item:hover { background: var(--bg-elev); }
.settings-item b {
    display: block;
    font-size: 13px;
    font-weight: 600;
}
.settings-item span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--text-muted);
    white-space: normal;
}

/* 按钮 */
.btn {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none;
    font-family: var(--font);
}
.btn:hover { background: var(--bg-card-hover); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-success:hover { background: var(--primary-dark); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-commit { min-width: 140px; font-weight: 700; padding: 10px 18px; }

/* 常驻顶栏 */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.toolbar-find {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.toolbar-actions { flex-shrink: 0; }
.tb-label { display: none; }

/* 导入侧栏抽屉 */
.import-backdrop {
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
}
.import-backdrop[hidden] { display: none !important; }
.import-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(var(--drawer-w), 100vw);
    z-index: 8010;
    background: #fff;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    padding: 0;
    transform: translateX(0);
}
.import-drawer[hidden] { display: none !important; }
.import-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.import-drawer-head h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}
.import-drawer-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}
.import-drawer .import-seg {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin: 16px 20px 0;
    padding: 4px;
    background: var(--bg-elev);
    border-radius: 10px;
    max-width: none;
    flex-shrink: 0;
}
.seg-btn {
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    padding: 9px 8px;
    border-radius: 8px;
    cursor: pointer;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: var(--shadow);
}
.import-drawer-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
}
.import-pane[hidden] { display: none !important; }
.import-pane {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.import-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    max-width: none;
    flex: none;
}
.if-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
}
.btn-import-go {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    font-size: 14px;
    font-weight: 700;
    margin-top: 4px;
}
.import-hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}
.import-hint code {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 11px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}
.import-body, .import-fields, .import-actions, .import-field-wide, .import-row,
.import-bar, .import-group, .import-or, .group-tag, .group-main, .group-label,
.filter-field, .group-row { display: none !important; }
#importToggleBtn .caret { display: none; }

/* 当前站点上下文（身份 + 管辖方） */
.station-context {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.station-identity {
    min-width: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}
.station-identity-title {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.station-name-lg {
    font-size: 16px; font-weight: 700; color: var(--text);
}
.station-mode-badge {
    font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 999px;
    background: rgba(14, 116, 144, 0.1);
    border: 1px solid rgba(14, 116, 144, 0.25);
    color: #0e7490;
}
.station-identity-sub {
    font-size: 12px; color: var(--text-dim);
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.station-identity-sub .mono { font-family: ui-monospace, Consolas, monospace; color: var(--text-secondary); }
.dot-sep { opacity: 0.45; }

.jurisdiction-panel {
    flex: 1;
    min-width: 280px;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--ju-bg);
    border: 1px solid var(--ju-border);
}
.jurisdiction-panel.is-set {
    background: var(--ju-ok-bg);
    border-color: var(--ju-ok-border);
}
.jurisdiction-panel.is-dirty {
    box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.25);
    animation: juPulse 1.2s ease-in-out infinite;
}
@keyframes juPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.18); }
    50% { box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.35); }
}
.jp-label { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.jp-label-main {
    font-size: 13px; font-weight: 700; color: var(--ju);
}
.jurisdiction-panel.is-set .jp-label-main { color: var(--ju-ok); }
.jp-label-hint { font-size: 11px; color: var(--text-muted); }
.jp-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.jp-select {
    min-width: 120px; padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: #fff; color: var(--text);
    font-size: 14px; font-weight: 600; font-family: var(--font);
    cursor: pointer;
}
.jp-select:focus { outline: none; border-color: var(--ju); box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.15); }
#saveJurisdictionBtn {
    min-width: 96px; font-weight: 700; padding: 8px 16px;
}
#saveJurisdictionBtn:disabled {
    opacity: 0.55; cursor: not-allowed;
    box-shadow: none;
}
#saveJurisdictionBtn.needs-save {
    background: var(--ju); border-color: var(--ju);
    box-shadow: 0 4px 12px rgba(194, 65, 12, 0.28);
    opacity: 1;
}
#saveJurisdictionBtn.needs-save:hover { filter: brightness(1.05); }
.jp-save-status {
    font-size: 12px; font-weight: 600;
}
.jp-save-status.pending { color: #c2410c; }
.jp-save-status.ok { color: var(--ju-ok); }

.station-context-actions {
    margin-left: auto;
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.dirty-flag {
    font-size: 12px; font-weight: 700;
    color: #fff; background: var(--warn);
    padding: 4px 10px; border-radius: 999px;
}

/* 兼容旧类名（若残留） */
.meta-bar { display: none; }

.station-search {
    width: 140px;
    min-width: 120px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
}
.station-search:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.station-search::-webkit-search-cancel-button { cursor: pointer; }

.station-select {
    min-width: 280px; max-width: 560px; flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
}
.station-select:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.station-list-count {
    font-size: 12px; color: var(--text-muted); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 420px;
}
.jurisdiction-select,
.collect-status-select {
    min-width: 110px; padding: 8px 10px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: #fff; color: var(--text); font-size: 13px; font-family: var(--font);
    cursor: pointer;
}
.collect-status-select { min-width: 118px; }
.toolbar-find .field-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.toolbar-find .field-check input {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}
.jurisdiction-select:focus,
.collect-status-select:focus { outline: none; border-color: var(--primary-light); }
.btn-danger {
    background: #fff; border-color: #fca5a5; color: #dc2626;
}
.btn-danger:hover { background: #fef2f2; border-color: #f87171; color: #b91c1c; }

.file-pill {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    background: var(--bg-subtle); border: 1px dashed var(--border-strong);
    font-size: 13px; cursor: pointer; color: var(--text-dim);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.file-pill span {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-pill:hover { border-color: var(--primary-light); color: var(--text-secondary); background: #fff; }
.file-pill.has-file { border-style: solid; color: var(--primary-dark); border-color: var(--primary-light); background: rgba(29, 78, 216, 0.04); }
input[type="file"] { display: none; }

.batch-check {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-secondary); cursor: pointer; white-space: nowrap;
    user-select: none;
    padding: 4px 0;
}
.batch-check input { display: inline-block; margin: 0; cursor: pointer; }

.batch-progress {
    padding: 8px 20px 10px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.batch-progress-head {
    display: flex; align-items: center; gap: 12px;
    font-size: 12px; color: var(--text-secondary);
    margin-bottom: 6px;
}
.batch-progress-head span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-progress-bar {
    height: 6px; border-radius: 999px; background: var(--bg-subtle); overflow: hidden;
}
.batch-progress-fill {
    height: 100%; width: 0; background: var(--primary); transition: width 0.2s ease;
}
.batch-log {
    margin-top: 8px; max-height: 120px; overflow: auto;
    font-size: 12px; line-height: 1.5;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 6px 10px;
}
.batch-log-line { color: var(--text-dim); }
.batch-log-line.ok { color: var(--accent); }
.batch-log-line.err { color: #dc2626; }
.batch-log-line.warn { color: var(--warn); }

/* 孤儿区域提示横幅（紧凑） */
.orphan-banner {
    background: rgba(217, 119, 6, 0.06);
    border: 1px solid rgba(217, 119, 6, 0.3);
    border-radius: var(--radius-sm);
    margin: 6px 20px 0;
    padding: 6px 12px;
    flex-shrink: 0;
}
.orphan-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.orphan-title { font-size: 12px; color: var(--warn); font-weight: 600; }
.orphan-title b { color: var(--text); }
.orphan-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    margin-left: auto;
}
.orphan-toggle input { cursor: pointer; }
.orphan-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-top: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.orphan-item {
    font-size: 11px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.orphan-coord { color: var(--danger); font-size: 10px; }
.orphan-nocoord { color: var(--text-muted); font-size: 10px; }
.orphan-tip { margin-left: 8px; font-size: 10px; color: var(--text-muted); font-weight: 400; }

/* 主体 */
.admin-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 12px;
    min-height: 0;
    padding: 12px 16px;
}
.pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
    overflow: hidden;
}
body.is-idle .pane-right {
    opacity: 0.72;
}
.pane-title {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: transparent;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.pane-title::before { display: none; }
.pane-title > span:first-child { flex: 1; }
.pane-title .hint { font-weight: 400; font-size: 11px; color: var(--text-muted); }
body.is-idle #collectHint { display: none; }

.view-seg {
    display: inline-flex;
    padding: 3px;
    background: var(--bg-elev);
    border-radius: 8px;
    gap: 2px;
    margin-right: 10px;
    flex-shrink: 0;
}
.view-btn {
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}
.view-btn:hover { color: var(--text); }
.view-btn.active {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: var(--shadow);
}
.main-viewport {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}
.main-viewport .image-stage,
.main-viewport .map-stage,
.main-viewport .connectivity-stage {
    flex: 1;
    min-height: 0;
}
.map-stage {
    position: relative;
    background: #e8eef5;
}
/* display:flex 会盖掉原生 [hidden]，必须强制隐藏 */
.image-stage[hidden],
.map-stage[hidden],
.connectivity-stage[hidden] {
    display: none !important;
}
#adminMap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    background: var(--bg-elev);
}

.image-stage {
    flex: 1;
    position: relative;
    background: #f8fafc;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
body:not(.is-idle) .image-stage {
    background:
        linear-gradient(45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef2f7 75%),
        linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
    background-size: 22px 22px;
    background-position: 0 0, 0 11px, 11px -11px, -11px 0;
    background-color: #f8fafc;
}
.image-empty {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 40px 24px;
    max-width: 360px;
}
.image-empty .ie-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.image-empty .ie-sub {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 14px;
}
.image-empty .ie-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.side-empty {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 32px 16px;
}

.image-tools {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
    margin-right: 12px;
}
.image-tools .btn-sm { padding: 4px 10px; font-size: 12px; }
body.view-map .image-tools { display: none !important; }
body.view-map #collectHint { display: none !important; }
body.view-schematic #mapHint { display: none !important; }

/* 左：图片采集 */
.image-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    box-shadow: var(--shadow-lg);
}
.image-stage.collectable { cursor: crosshair; }

.point-layer { position: absolute; inset: 0; pointer-events: none; }
.cp-marker {
    position: absolute;
    width: 19px; height: 19px;
    background: var(--primary);
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(37,130,246,0.4), 0 2px 6px rgba(0,0,0,0.25);
    z-index: 10;
    display: flex; align-items: center; justify-content: center;
}
.cp-marker .cp-num {
    font-size: 10px; font-weight: 700; color: #fff;
    pointer-events: none; line-height: 1; user-select: none;
}
.cp-marker.selected {
    background: var(--warn);
    box-shadow: 0 0 0 3px rgba(217,119,6,0.35), 0 2px 8px rgba(0,0,0,0.3);
    width: 24px; height: 24px;
    z-index: 25;
}
.cp-marker.selected .cp-num { font-size: 11px; }
.cp-marker.pending {
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(5,150,105,0.3);
    animation: cp-pulse 1.2s infinite;
}
@keyframes cp-pulse { 0%,100%{transform:translate(-50%,-50%) scale(1);} 50%{transform:translate(-50%,-50%) scale(1.25);} }
.cp-marker .cp-label {
    position: absolute;
    bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(30,41,59,0.92);
    color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 4px;
    white-space: nowrap; pointer-events: none;
    opacity: 0; transition: opacity 0.12s; z-index: 1;
}
/* 默认隐藏标签，悬停/选中时显示，避免密集点位标签重叠 */
.cp-marker:hover .cp-label,
.cp-marker.selected .cp-label { opacity: 1; z-index: 20; }
.cp-marker:hover { z-index: 30; }

/* 右：区域列表 + 经纬度 */
.area-list { flex: 1; min-height: 200px; overflow-y: auto; padding: 8px; }
.area-row {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.12s;
    margin-bottom: 4px;
}
.area-row:hover { background: var(--bg-elev); }
.area-row.selected { background: rgba(37, 99, 235, 0.08); border-color: var(--primary-light); }
.area-row .ar-idx {
    width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px;
    border-radius: 6px; background: var(--bg-elev);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--text-dim);
}
.area-row .ar-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.area-row .ar-body { min-width: 0; }
.area-row .ar-name {
    font-size: 13px; font-weight: 500; line-height: 1.35;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: text;
    border-radius: 4px;
    padding: 1px 2px;
    margin: -1px -2px;
}
.area-row .ar-name:hover {
    background: rgba(37, 99, 235, 0.08);
    outline: 1px dashed rgba(37, 99, 235, 0.35);
}
.area-row .ar-name-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--primary, #2563eb);
    border-radius: 4px;
    padding: 2px 6px;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.area-row .ar-full {
    font-size: 11px; color: var(--text-muted); line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.area-row .ar-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.area-row .ar-type {
    font-size: 10px; padding: 2px 6px; border-radius: 4px;
    background: var(--bg-elev); color: var(--text-dim); flex-shrink: 0;
}
.area-row .ar-status { flex-shrink: 0; font-size: 12px; }
.ar-status.done { color: var(--accent); }
.ar-status.todo { color: var(--text-muted); }
.area-row.closed {
    opacity: 0.72;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 6px,
        rgba(148, 163, 184, 0.08) 6px,
        rgba(148, 163, 184, 0.08) 12px
    );
}
.area-row .ar-open {
    flex-shrink: 0;
    font-size: 11px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-dim);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    white-space: nowrap;
}
.area-row .ar-open.on { color: var(--accent); border-color: rgba(16, 185, 129, 0.35); }
.area-row .ar-open.off { color: #b45309; border-color: rgba(180, 83, 9, 0.35); background: rgba(251, 191, 36, 0.12); }
.open-flag-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
    cursor: pointer;
    user-select: none;
}
.open-flag-check input { margin: 0; }
.open-flag-check.is-closed span { color: #b45309; font-weight: 600; }
.station-mode-badge.closed-badge {
    background: rgba(251, 191, 36, 0.2);
    color: #b45309;
}
.ar-geo {
    flex-shrink: 0; font-size: 10px; padding: 2px 6px; border-radius: 4px;
    white-space: nowrap;
}
.area-row .ar-del { margin-top: 1px; }
.ar-geo.inherit { background: var(--bg-elev); color: var(--text-muted); }
.ar-geo.custom { background: rgba(14, 116, 144, 0.12); color: #0e7490; cursor: pointer; }
.ar-geo.custom:hover { background: rgba(220, 38, 38, 0.12); color: var(--danger); }

/* 地图标记（编号 + 颜色区分 + 当前编辑高亮） */
.geo-pin {
    display: flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 10px; border: 2px solid #fff;
    font-size: 11px; font-weight: 700; color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    white-space: nowrap; transform: translate(-50%, -50%);
}
.geo-pin-station { background: var(--primary); }
.geo-pin-area { background: #0e7490; }
.geo-pin-active {
    background: var(--warn);
    min-width: 24px; height: 24px; font-size: 12px;
    box-shadow: 0 0 0 3px rgba(217,119,6,0.3), 0 2px 6px rgba(0,0,0,0.4);
}
.geo-pin-ghost { background: rgba(217,119,6,0.85); border-style: dashed; }

/* 经纬度标题状态行（常驻，区分已设置/未设置） */
.geo-status { font-weight: 600; font-size: 11px; margin-left: 4px; }
.geo-status.ok { color: var(--accent); }
.geo-status.warn { color: var(--danger); }

/* 经纬度：工具条 + 手填坐标常显；仅地图可折叠 */
.geo-lightbox-shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.geo-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 12px 4px;
}
.geo-scope {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}
.gs-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.gs-check input {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
}
.gs-check:has(input:disabled) {
    opacity: 0.45;
    cursor: not-allowed;
}
.gs-check:has(input:checked) {
    color: var(--primary);
    font-weight: 600;
}
.gs-area-select {
    width: 160px;
    max-width: 42%;
    height: 28px;
    box-sizing: border-box;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font);
}
.gs-area-select:disabled {
    color: var(--text-muted);
    background: var(--bg-elev, #f1f5f9);
    cursor: not-allowed;
}
.gs-help {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: #fff;
    color: var(--text-muted);
    font-size: 12px; font-weight: 700;
    line-height: 1;
    cursor: help;
    display: inline-flex; align-items: center; justify-content: center;
    position: relative;
    font-family: var(--font);
    padding: 0;
    flex-shrink: 0;
}
.gs-help:hover { color: var(--primary); border-color: var(--primary-light); }
.gs-help[data-tip]:hover::after,
.gs-help[data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: max-content;
    max-width: 260px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.45;
    white-space: normal;
    text-align: left;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
    z-index: 130;
    pointer-events: none;
}
.geo-lightbox-only { display: none !important; }

.geo-section {
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-subtle);
}
.geo-section .pane-title { border-bottom: 1px solid var(--border); }

.geo-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 10px;
}
.geo-controls .btn { width: 100%; justify-content: center; }
.geo-field {
    display: flex; align-items: center; gap: 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 8px;
    min-height: 32px;
}
.geo-field:focus-within { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.geo-field .geo-label { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.geo-controls input {
    flex: 1; min-width: 0;
    padding: 7px 0;
    background: transparent; border: none;
    color: var(--text); font-size: 12px;
}
.geo-controls input:focus { outline: none; }

/* 底部栏 */
.admin-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.progress-text { font-size: 12px; color: var(--text-dim); }
.progress-text b { color: var(--accent); }
.footer-right { display: flex; align-items: center; gap: 14px; }
.commit-summary { font-size: 12px; color: var(--text-secondary); }
.commit-summary b { color: var(--text); font-weight: 600; }
.commit-summary .cs-del { color: var(--danger); font-weight: 600; }
.commit-summary .cs-keep { color: var(--text-dim); }

/* Toast（右上角，避免遮挡示意图） */
.toast {
    position: fixed; top: 72px; right: 24px; left: auto; bottom: auto;
    background: var(--bg-panel); color: var(--text);
    padding: 10px 18px; border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 13px; z-index: 9999;
    opacity: 0; pointer-events: none;
    transform: translateY(-8px); transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: var(--accent); }
.toast.error { border-color: var(--danger); }

/* 区域列表操作 / 删除 */
.area-list-actions { margin-left: auto; display: inline-flex; gap: 6px; }
.area-row .ar-del {
    flex-shrink: 0;
    width: 24px; height: 24px;
    border: none; border-radius: 6px;
    background: transparent; color: var(--text-muted);
    font-size: 16px; line-height: 1; cursor: pointer;
}
.area-row .ar-del:hover { background: rgba(220, 38, 38, 0.12); color: var(--danger); }

/* 新建站点弹窗 */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(15, 23, 42, 0.45);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-card {
    width: min(420px, 100%);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 20px 22px;
}
.modal-card h3 { font-size: 16px; margin: 0 0 4px; }
.modal-sub { font-size: 12px; color: var(--text-muted); margin: 0 0 14px; }
.modal-field {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 12px; color: var(--text-dim);
    margin-bottom: 10px;
}
.modal-field input,
.modal-field select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 13px;
    background: var(--bg);
    color: var(--text);
}
.modal-actions {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 14px;
}

#connectivitySidePanel {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
}
#connectivitySidePanel[hidden] { display: none !important; }
#areaSidePanel {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
}
#areaSidePanel[hidden] { display: none !important; }
body.view-connectivity .image-tools { display: none !important; }
body.view-connectivity #collectHint,
body.view-connectivity #mapHint { display: none !important; }
.connectivity-tools { display: flex; gap: 6px; align-items: center; margin-left: 8px; }
.connectivity-tools[hidden] { display: none !important; }
.connectivity-stage {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    background: #fbfcfe;
}
.connectivity-stage[hidden] { display: none !important; }
.main-viewport .connectivity-stage { position: relative; width: 100%; height: 100%; }
.conn-toolbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 8px 10px; border-bottom: 1px solid var(--border); background: #fff; flex-shrink: 0;
}
.conn-subtabs {
    display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.conn-subtab {
    font-family: inherit; font-size: 12px; font-weight: 600;
    border: 0; background: #fff; color: var(--text-dim);
    padding: 5px 12px; border-right: 1px solid var(--border); cursor: pointer;
}
.conn-subtab:last-child { border-right: 0; }
.conn-subtab.active { background: var(--ju-ok-bg); color: var(--accent); }
.conn-dirty {
    font-size: 12px; color: var(--warn); background: #fffbeb;
    border: 1px solid #fde68a; border-radius: 8px; padding: 3px 8px;
}
.conn-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.conn-pane[hidden] { display: none !important; }
.conn-legend {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-dim);
    padding: 6px 12px 0;
    line-height: 1.4;
}
.conn-matrix-scroll { flex: 1; overflow: auto; padding: 10px; }
.conn-empty {
    color: var(--text-muted); font-size: 13px; padding: 24px; text-align: center;
}
.conn-matrix {
    border-collapse: separate; border-spacing: 0; font-size: 12px;
}
.conn-matrix th, .conn-matrix td {
    border: 1px solid var(--border);
    text-align: center; vertical-align: middle; background: #fff;
}
.conn-matrix td {
    min-width: 52px; width: 52px; height: 32px;
}
.conn-matrix th {
    background: var(--bg-elev); color: var(--text-secondary); font-weight: 600;
    position: sticky; top: 0; z-index: 2;
    height: auto; min-height: 36px;
    padding: 6px 4px;
    line-height: 1.25; font-size: 11px;
    white-space: normal; overflow: visible;
    vertical-align: bottom;
}
.conn-hlabel {
    display: inline-block;
    width: 4.2em;
    white-space: normal;
    word-break: break-all;
    overflow-wrap: anywhere;
    line-height: 1.25;
    text-align: center;
}
.conn-hlabel-row {
    width: auto;
    max-width: 8em;
    text-align: left;
}
.conn-matrix th.conn-corner {
    left: 0; z-index: 3; min-width: 100px; max-width: 140px; width: 100px;
    text-align: left; padding-left: 8px; color: var(--text-dim); font-weight: 500;
    vertical-align: middle; word-break: normal;
}
.conn-matrix th.conn-rowhead {
    position: sticky; left: 0; z-index: 1; text-align: left;
    padding: 6px 8px; min-width: 88px; width: auto;
    height: auto; white-space: normal; overflow: visible;
    vertical-align: middle;
}
.conn-matrix th.conn-closed {
    background: #fef3c7;
    color: #b45309;
}
.conn-matrix th.conn-rowhead.conn-closed {
    background: #fef3c7;
    color: #b45309;
}
body.view-connectivity .admin-footer .btn-commit,
body.view-connectivity .admin-footer .commit-summary {
    display: none !important;
}
body.view-connectivity .admin-footer .progress-text::after {
    content: ' · 联通边仅存数据库；批量导入/导出见「设置 → 区域联通性」';
    color: var(--text-dim);
}
.conn-matrix td.conn-diag { background: #e2e8f0; cursor: default; }
.conn-matrix td.conn-cell { cursor: pointer; user-select: none; }
.conn-matrix td.conn-cell:hover { background: #f1f5f9; }
.conn-matrix td.conn-cell.on {
    background: var(--ju-ok-bg); color: var(--accent); font-weight: 700; font-size: 13px;
}
.conn-cross-note {
    margin: 10px 12px 0; font-size: 12px; line-height: 1.5; color: var(--warn);
    background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 10px;
}
.conn-cross-form {
    display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 8px; align-items: end;
    padding: 12px; border-bottom: 1px solid var(--border);
}
.conn-cross-form label {
    display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-dim);
}
.conn-cross-form select {
    font-family: inherit; font-size: 12px; border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 8px; background: #fff; color: var(--text);
}
.conn-cross-list { flex: 1; overflow: auto; padding: 10px 12px; }
.conn-cross-empty { font-size: 12px; color: var(--text-muted); text-align: center; padding: 16px; }

.conn-stats { display: flex; gap: 8px; padding: 10px 12px 0; }
.conn-stat {
    flex: 1; background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 10px;
}
.conn-stat b { display: block; font-size: 16px; font-weight: 700; }
.conn-stat span { font-size: 11px; color: var(--text-dim); }
.conn-edge-list { flex: 1; overflow: auto; padding: 10px 12px; min-height: 120px; }
.conn-edge {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
    margin-bottom: 6px; font-size: 12px; background: #fff;
}
.conn-edge.cross { border-color: #fdba74; background: #fff7ed; }
.conn-edge .pair { font-weight: 500; color: var(--text); }
.conn-edge .pair small { color: var(--text-muted); font-weight: 400; }
.conn-tag {
    display: inline-block; font-size: 10px; font-weight: 700; color: #c2410c;
    background: #ffedd5; border-radius: 4px; padding: 1px 5px; margin-right: 6px;
}
.conn-edge-del {
    border: 0; background: transparent; color: var(--text-muted);
    font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.conn-edge-del:hover { color: var(--danger); }
.conn-side-foot { border-top: 1px solid var(--border); padding: 10px 12px; }
.conn-side-actions { display: flex; gap: 8px; }
.conn-side-actions .btn { flex: 1; justify-content: center; }
.conn-side-note { font-size: 11px; color: var(--text-muted); margin: 8px 0 0; line-height: 1.45; }

@media (max-width: 1100px) {
    .conn-cross-form { grid-template-columns: 1fr 1fr; }
}
