* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font: 14px/1.5 "Segoe UI", "Microsoft YaHei", sans-serif; }
body { display: flex; }

.sidebar {
  width: 340px; min-width: 340px; height: 100vh; overflow-y: auto;
  padding: 12px 14px 40px; background: #f7f8fa; border-right: 1px solid #ddd;
}
.sidebar h1 { font-size: 18px; margin: 4px 0 2px; }
.sidebar header p { margin: 0 0 8px; color: #666; font-size: 12px; }
.header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.lang-switch { display: flex; flex: none; margin-top: 4px; border: 1px solid #c5c9d0;
  border-radius: 6px; overflow: hidden; }
.lang-switch button { margin: 0; padding: 2px 8px; border: 0; border-radius: 0;
  background: #fff; color: #555; font-size: 12px; line-height: 20px; }
.lang-switch button + button { border-left: 1px solid #c5c9d0; }
.lang-switch button.active { background: #1a56db; color: #fff; }
.lang-switch button:hover { background: #eef2ff; }
.lang-switch button.active:hover { background: #1a56db; }
.tabs { display: flex; gap: 6px; margin: 4px 0 10px; }
.tab { flex: 1; padding: 8px 0; margin: 0; border: 1px solid #c5c9d0; border-radius: 6px;
  background: #eceff3; font-weight: 600; font-size: 14px; }
.tab.active { background: #1a56db; color: #fff; border-color: #1a56db; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.focus-bar {
  position: sticky; top: 0; z-index: 600; display: flex; align-items: center; gap: 8px;
  margin: 0 0 10px; padding: 8px 10px; font-size: 12px; line-height: 1.35;
  background: #fffbeb; border: 1px solid #f59e0b; border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08); cursor: pointer;
}
.focus-bar[hidden] { display: none; }
.focus-bar .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.3); }
.focus-bar b { color: #111; }
.focus-bar .fb-sub { color: #555; }
.sidebar section { background: #fff; border: 1px solid #e3e5e8; border-radius: 8px;
  padding: 10px 12px; margin: 10px 0; }
.sidebar h2 { font-size: 14px; margin: 2px 0 8px; color: #1a56db; }
label { display: block; margin: 6px 0; font-size: 13px; }
label.check { display: flex; align-items: center; gap: 6px; }
input[type=file] { display: block; width: 100%; font-size: 12px; margin-top: 2px; }
input[type=text], textarea, .search input, select {
  width: 100%; padding: 4px 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px;
}
textarea { resize: vertical; font-family: inherit; }
button {
  padding: 6px 10px; margin: 4px 4px 0 0; border: 1px solid #c5c9d0; border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 13px;
}
button:hover { background: #eef2ff; }
button.primary { background: #1a56db; color: #fff; border-color: #1a56db; }
button.primary:disabled { background: #9db4ec; cursor: not-allowed; }
button.download { background: #047857; color: #fff; border-color: #047857; display: block; width: 100%; margin-top: 6px; }
.hint { font-size: 12px; color: #777; margin: 6px 0 0; }
.tpl-row { font-size: 12px; margin-bottom: 6px; }
.tpl-row a { margin-right: 8px; }
.badge { background: #1a56db; color: #fff; border-radius: 10px; padding: 0 8px; font-size: 12px; }
.actions { margin: 6px 0; }
.search { display: flex; gap: 6px; }
.search button { margin: 0; white-space: nowrap; }
.selected-list { font-size: 12px; max-height: 120px; overflow-y: auto; background: #f1f3f5;
  border-radius: 4px; padding: 4px 6px; margin-top: 6px; white-space: pre-line; }
.sec-table { max-height: 320px; overflow-y: auto; font-size: 12px; }
.sec-table table { width: 100%; border-collapse: collapse; }
.sec-table td, .sec-table th { border-bottom: 1px solid #eee; padding: 3px 4px; text-align: right; }
.sec-table td:first-child, .sec-table th:first-child { text-align: left; }
.sec-table tr:hover { background: #eef2ff; cursor: pointer; }
.dev-bad { color: #dc2626; font-weight: 600; }

.sec-row { display: flex; align-items: center; gap: 6px; padding: 4px 4px;
  border-bottom: 1px solid #eee; cursor: pointer; }
.sec-row:hover { background: #eef2ff; }
.sec-vis { flex: none; margin: 0; }
.sec-arrow { color: #1a56db; width: 12px; flex: none; }
.sec-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.25); }
.stats-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.stats-head .hint { margin: 0; }
.stats-head a { font-size: 12px; color: #1a56db; margin-left: 8px; text-decoration: none; }
.stats-head a:hover { text-decoration: underline; }
.sec-row.off .sec-name, .sec-row.off .sec-cnt { color: #aaa; font-weight: 400; }
.metrics-line { font-size: 12px; color: #444; background: #f1f5ff; border: 1px solid #dbe4ff;
  border-radius: 4px; padding: 4px 6px; margin-bottom: 6px; }
.metrics-line b { color: #111; }
.metrics-line b.bad { color: #dc2626; }
.sec-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-cluster { flex: none; font-size: 11px; line-height: 16px; color: #4b5563; background: #eef1f5;
  border-radius: 3px; padding: 0 4px; max-width: 90px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.sec-row.off .sec-cluster { color: #bbb; background: #f6f6f6; }
.sec-cnt { color: #555; flex: none; }

/* cluster → sector → NAP 分组 */
.cluster-group { margin-top: 6px; border: 1px solid #e3e6ea; border-radius: 6px;
  overflow: hidden; background: #fbfcfe; }
.cluster-group.active { border-color: #1a56db; box-shadow: inset 3px 0 0 #1a56db; }
.cluster-row { display: flex; align-items: center; gap: 6px; padding: 5px 6px;
  background: #eef2f8; cursor: pointer; }
.cluster-row:hover { background: #e3ebff; }
.cluster-arrow { color: #1a56db; width: 12px; flex: none; }
.cluster-name { font-weight: 700; color: #111; flex: none; }
.cluster-meta { color: #666; font-size: 11px; flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.cluster-view { flex: none; margin: 0; padding: 2px 6px; font-size: 11px;
  border-color: #1a56db; color: #1a56db; background: #fff; }
.cluster-view:hover { background: #1a56db; color: #fff; }
.cluster-group.closed .cluster-body { display: none; }
.cluster-body { border-top: 1px solid #e3e6ea; }
.sec-row.in-cluster { padding-left: 14px; }
.nap-list { display: none; max-height: 220px; overflow-y: auto; background: #f1f3f5;
  border-radius: 4px; margin: 2px 0 6px 18px; padding: 2px 4px; }
.nap-list.open { display: block; }
.nap-item { padding: 2px 4px; cursor: pointer; border-bottom: 1px dashed #e2e5e9;
  display: flex; justify-content: space-between; gap: 8px; }
.nap-item:hover { background: #e3ebff; }
.nap-item.active { background: #fde68a; box-shadow: inset 3px 0 0 #d97706; font-weight: 600; }
.nap-attr { color: #888; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pbar { height: 6px; background: #e5e7eb; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.pbar > div { height: 100%; width: 0; background: #1a56db; transition: width .3s; }
input[type=number] { width: 100%; padding: 4px 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }

main { flex: 1; display: flex; flex-direction: column; }
.toolbar { padding: 8px 12px; background: #fff; border-bottom: 1px solid #ddd;
  display: flex; gap: 12px; align-items: center; }
.toolbar #mapInfo { color: #666; font-size: 12px; }
#map { flex: 1; background: #dde5ec; }
.nap-popup { font-size: 12px; line-height: 1.6; }
.nap-popup b { font-size: 13px; }

@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; min-width: 0; height: auto; max-height: 55vh; }
  main { min-height: 45vh; }
}
