/* 建筑面板里的周边查询工具 */
.panel-nearby-radius select { border: 0; background: transparent; color: #1d4ed8; font: inherit; }
#reportWorkspace .panel-life-circle { flex: 1 0 100%; margin: 0; }
#reportWorkspace .rw-toolbar { flex-wrap: wrap; }
.nb-coverage-link { margin-top: 8px; font-size: 12px; color: #1d4ed8; }
#nbCoverage { position: relative; min-width: 0; min-height: 0; overflow: auto; padding: 12px; box-sizing: border-box;
  color: #334155; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 8px 30px #0003; font-size: 13px; }
#nbCoverage header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
#nbCoverage header b { font-size: 16px; color: #166534; }
#nbCoverage header p { margin: 6px 0 12px; }
#nbCoverage button, #nbCoverage select { padding: 4px 8px; background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 5px; color: #334155; cursor: pointer; }
#nbCoverage [data-result] { margin-top: 12px; }
.nb-coverage-count { display: block; font-size: 20px; color: #166534; }
.nb-coverage-basis { font-size: 11px; color: #64748b; line-height: 1.6; }
.nb-coverage-warning { background: #fffbeb; color: #92400e; padding: 8px; }
.nb-coverage-table { overflow: auto; }
#nbCoverage table { width: 100%; border-collapse: collapse; font-size: 12px; }
#nbCoverage th, #nbCoverage td { padding: 8px 5px; border-bottom: 1px solid #e2e8f0; text-align: left; }
#nbCoverage th { background: #f1f5f9; white-space: nowrap; }
#nbCoverage small { display: block; color: #64748b; }
.nb-card:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.panel-nearby-tools { display: flex; align-items: center; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.panel-life-circle { padding: 9px; border: 1px solid #d8e5de; border-radius: 8px;
  background: #eef5f1; }
.panel-life-copy { flex: 1 0 100%; display: flex; flex-direction: column; gap: 2px; }
.panel-life-copy b { color: #264c3d; font-size: 13px; }
.panel-life-copy span { color: #66776f; font-size: 11px; line-height: 1.45; }
.panel-nearby-radius { height: 28px; display: inline-flex; align-items: center; gap: 4px; padding: 0 7px;
  border: 1px solid #cbd5e1; background: #fff; color: #475569; border-radius: 6px; font-size: 12px; }
.panel-nearby-radius input { width: 62px; border: none; border-bottom: 1px solid #cbd5e1; padding: 2px 1px;
  background: transparent; color: #0f172a; font: inherit; font-weight: 700; text-align: right; outline: none; }
.panel-nearby-radius input:focus { border-bottom-color: #2563eb; }
.panel-nearby-radius span { color: #64748b; }
.panel-nearby { height: 28px; display: inline-flex; align-items: center; padding: 0 9px;
  border: 1px solid #93c5fd; background: #eff6ff;
  color: #1d4ed8; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s; }
.panel-nearby:hover { background: #dbeafe; box-shadow: 0 2px 8px rgba(37,99,235,.2); }
.panel-nearby:active { transform: translateY(1px); }

/* 底部横向抽屉(定位参考 #statPanel) */
#nearbyDrawer { position: absolute; left: calc(var(--sb) + (100% - var(--sb)) / 2); transform: translateX(-50%);
  bottom: 44px; width: min(980px, calc(100% - var(--sb) - 40px)); max-height: 40vh; z-index: 24;
  background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.24);
  display: flex; flex-direction: column; transition: left .25s; }
#nearbyDrawer.hidden { display: none; }
#nearbyDrawer.nb-slide-up { animation: nbSlideUp .3s cubic-bezier(.22,1,.36,1); }
@keyframes nbSlideUp { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.nb-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px 9px; border-bottom: 1px solid #eef0ee; }
.nb-head b { font-size: 14px; color: #1f2937; }
.nb-hint { font-size: 11px; color: #9aa3a0; }
#nbClose { margin-left: auto; border: none; background: none; font-size: 20px; cursor: pointer; color: #888; border-radius: 6px; width: 28px; height: 28px; }
#nbClose:hover { background: #f3f6f4; color: #333; }
.nb-summary { display: grid; grid-template-columns: 112px minmax(180px, 1fr) minmax(260px, 1.7fr);
  align-items: center; gap: 12px; margin: 10px 14px 0; padding: 9px 11px; border: 1px solid #dbe5df;
  border-radius: 8px; background: #f7faf8; color: #475569; }
.nb-summary > div { display: flex; flex-direction: column; }
.nb-summary b { color: #166534; font-size: 20px; line-height: 1; }
.nb-summary span, .nb-summary p, .nb-summary small { font-size: 11px; line-height: 1.45; }
.nb-summary p { margin: 0; color: #334155; }
.nb-summary small { color: #64748b; }

/* 分类切换 tab —— 每个分类一个色 chip，--c 由 JS 注入 */
.nb-cats { display: flex; gap: 6px; padding: 9px 14px 0; flex-wrap: wrap; }
.nb-cat { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px;
  border: 1px solid var(--c, #cbd5e1); background: #fff; color: #334155;
  border-radius: 16px; font-size: 12.5px; cursor: pointer; transition: background .12s, color .12s; }
.nb-cat i { font-style: normal; }
.nb-cat em { font-style: normal; font-size: 11px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
  padding: 0 7px; border-radius: 9px; font-weight: 700; }
.nb-cat:hover { background: color-mix(in srgb, var(--c) 10%, #fff); }
.nb-cat.on { background: var(--c); color: #fff; border-color: var(--c); }
.nb-cat.on em { color: #fff; background: rgba(255,255,255,.25); }

/* 横向卡片栏 */
.nb-cards { display: flex; gap: 10px; padding: 10px 14px 12px; overflow-x: auto; overflow-y: hidden; }
.nb-cards::-webkit-scrollbar { height: 8px; }
.nb-cards::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
.nb-card { flex: 0 0 auto; width: 218px; display: flex; gap: 8px; padding: 9px 10px 9px 0;
  border: 1px solid #e5e7eb; border-radius: 10px; background: #fafbfc; cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s; }
.nb-card:hover { transform: translateY(-2px); border-color: var(--c); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.nb-card-bar { width: 6px; flex: none; border-radius: 10px 0 0 10px; background: var(--c); }
.nb-card-main { flex: 1; min-width: 0; }
.nb-card-name { font-size: 13px; font-weight: 600; color: #1f2937; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nb-card-addr { margin-top: 3px; font-size: 11px; color: #9aa3a0; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.nb-dist { font-size: 11px; font-weight: 700; color: var(--c); }
.nb-type { font-size: 10px; color: #6b7280; background: #f3f4f6; padding: 1px 7px; border-radius: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.nb-empty { padding: 18px; font-size: 13px; color: #9aa3a0; text-align: center; width: 100%; }

/* 查询动画遮罩(雷达扫描，复刻 #smartScanModal 风格) */
.nb-scan-overlay { position: absolute; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 46%, rgba(14,165,233,.16), rgba(15,23,42,.36) 42%, rgba(15,23,42,.55));
  backdrop-filter: blur(2px); pointer-events: none; transition: opacity .3s; }
.nb-scan-overlay.nb-fade-out { opacity: 0; }
.nb-scan-card { width: 320px; padding: 24px 26px 22px; border-radius: 14px; text-align: center; color: #ecfeff;
  background: linear-gradient(180deg, rgba(8,47,73,.9), rgba(14,116,144,.82));
  border: 1px solid rgba(125,211,252,.32); box-shadow: 0 24px 80px rgba(2,6,23,.45), inset 0 1px 0 rgba(255,255,255,.16); }
.nb-scan-orbit { position: relative; width: 110px; height: 110px; margin: 0 auto 16px; border-radius: 50%;
  background: radial-gradient(circle, rgba(236,254,255,.22) 0 18%, rgba(56,189,248,.1) 19% 42%, transparent 43%); }
.nb-scan-orbit::before, .nb-scan-orbit::after, .nb-scan-orbit i { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(125,211,252,.32); }
.nb-scan-orbit::before { inset: 12px; animation: nbScanPulse 1.35s ease-out infinite; }
.nb-scan-orbit::after { inset: 24px; border-style: dashed; animation: nbScanSpin 5s linear infinite; }
.nb-scan-orbit i:nth-child(1) { inset: 4px; border-color: rgba(45,212,191,.4); animation: nbScanSpin 3.2s linear infinite; }
.nb-scan-orbit i:nth-child(2) { inset: 18px; border-color: rgba(125,211,252,.3); animation: nbScanSpin 4.4s linear infinite reverse; }
.nb-scan-orbit i:nth-child(3) { inset: 34px; border-color: rgba(240,253,250,.26); }
.nb-scan-orbit b { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: #7dd3fc; box-shadow: 0 0 18px #7dd3fc, 0 0 40px rgba(56,189,248,.8); }
.nb-scan-title { font-size: 17px; font-weight: 800; }
.nb-scan-sub { margin-top: 7px; font-size: 12px; line-height: 1.5; color: #cffafe; min-height: 18px; }
.nb-scan-bar { height: 4px; margin-top: 16px; border-radius: 99px; overflow: hidden; background: rgba(236,254,255,.18); }
.nb-scan-bar span { display: block; width: 42%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, transparent, #7dd3fc, #a7f3d0); animation: nbScanBar 1.1s ease-in-out infinite; }
@keyframes nbScanSpin { to { transform: rotate(360deg); } }
@keyframes nbScanPulse { 0% { transform: scale(.78); opacity: .95; } 100% { transform: scale(1.18); opacity: 0; } }
@keyframes nbScanBar { 0% { transform: translateX(-105%); } 100% { transform: translateX(245%); } }

/* 生活圈与属性面板分区；台账放入结果抽屉，不再覆盖右侧属性。 */
#nearbyDrawer {
  left: calc(var(--sb) + 16px); right: 16px; width: auto; transform: none;
  max-height: min(460px, calc(100dvh - 130px)); overflow: auto;
  transition: left .25s, right .25s;
}
#nearbyDrawer.nb-slide-up { animation: none; }
body:has(#panel.open) #nearbyDrawer { right: 450px; }
#nearbyDrawer:has(#nbCoverage) {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 36%);
  grid-template-rows: auto auto auto minmax(0, 1fr); gap: 0 12px;
}
#nearbyDrawer > :not(#nbCoverage) { min-width: 0; grid-column: 1; }
#nearbyDrawer #nbCoverage {
  grid-column: 2; grid-row: 1 / 5; margin: 10px 10px 10px 0;
  border-radius: 8px; box-shadow: none; background: #f8fafc;
}
#nearbyDrawer .nb-summary { grid-template-columns: 90px minmax(0, 1fr); }
#nearbyDrawer .nb-summary small { grid-column: 1 / -1; }
#nearbyDrawer .nb-head { flex-wrap: wrap; }
#nearbyDrawer .nb-hint { overflow-wrap: anywhere; }
#nearbyDrawer .nb-cards { min-height: 110px; }
#nbCoverage header p { overflow-wrap: anywhere; }
#nbCoverage > label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
/* 覆盖报告工具栏的通用 select 样式，保持半径控件在 28px 高度内。 */
.panel-nearby-radius select,
#reportWorkspace .rw-toolbar .panel-nearby-radius select,
#nbCoverage > label select {
  box-sizing: border-box; flex: 0 0 78px; width: 78px; min-width: 0; max-width: 78px;
  height: 26px; min-height: 0; margin: 0; padding: 2px 4px;
  font: 12px/1.3 'Microsoft YaHei', sans-serif; border-radius: 4px;
}
#reportWorkspace .rw-toolbar .panel-nearby-radius select { border: 0; background: transparent; }
#reportWorkspace .panel-life-circle .panel-nearby { height: 28px; padding: 0 9px; font-size: 12px; }
@media (max-width: 1450px) {
  #nearbyDrawer:has(#nbCoverage) { display: flex; }
  #nearbyDrawer #nbCoverage { flex: 0 0 auto; max-height: 240px; margin: 0 12px 12px; }
  #nearbyDrawer .nb-cats { flex-wrap: nowrap; overflow-x: auto; flex-shrink: 0; }
  #nearbyDrawer .nb-cat { flex-shrink: 0; }
  #nearbyDrawer .nb-cards { flex-shrink: 0; }
}
@media (max-width: 900px) {
  /* 窄屏上下分区，保留属性内容的独立滚动。 */
  body:has(#nearbyDrawer:not(.hidden)) #panel.open { bottom: 50dvh; }
  body:has(#panel.open) #nearbyDrawer { right: 12px; }
  #nearbyDrawer { left: calc(var(--sb) + 12px); right: 12px; max-height: calc(50dvh - 54px); }
  #nearbyDrawer .nb-summary { grid-template-columns: 1fr; }
}

#nbCoverage .nb-zone-link { padding: 0; border: 0; background: transparent; color: #1d4ed8;
  font: inherit; text-align: left; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; }
#nbCoverage .nb-zone-link:hover { text-decoration: underline; color: #1e40af; }
#nbCoverage .nb-zone-link:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
#nbCoverage .nb-zone-link:disabled { opacity: .6; cursor: wait; }

/* 紧凑结果栏：台账内部滚动，不用整页高度拉伸设施卡片。 */
#nearbyDrawer { max-height: min(280px, 32dvh); }
#nearbyDrawer:has(#nbCoverage) { grid-template-rows: auto auto auto minmax(0, 1fr); }
#nearbyDrawer .nb-head { min-height: 38px; padding: 6px 12px; gap: 8px; box-sizing: border-box; }
#nearbyDrawer .nb-head b { font-size: 13px; }
#nearbyDrawer .nb-summary { margin: 5px 12px 0; padding: 5px 8px; gap: 3px 10px; }
#nearbyDrawer .nb-summary > div { flex-direction: row; align-items: baseline; gap: 6px; }
#nearbyDrawer .nb-summary b { font-size: 17px; }
#nearbyDrawer .nb-summary small { font-size: 10px; line-height: 1.3; }
#nearbyDrawer .nb-cats { flex-wrap: nowrap; overflow-x: auto; padding: 6px 12px 0; }
#nearbyDrawer .nb-cat { flex-shrink: 0; padding: 3px 8px; font-size: 11px; }
#nearbyDrawer .nb-cards { align-items: flex-start; min-height: 0; padding: 6px 12px 9px; flex-shrink: 0; }
#nearbyDrawer .nb-card { box-sizing: border-box; width: 218px; min-height: 100px; padding-top: 7px; padding-bottom: 7px; }
#nearbyDrawer .nb-card-bar { align-self: stretch; }
#nearbyDrawer .nb-coverage-link { margin-top: 4px; }
#nearbyDrawer #nbCoverage { max-height: 258px; margin-top: 6px; margin-bottom: 6px; padding: 8px 10px; }
#nbCoverage header b { font-size: 14px; }
#nbCoverage header p { margin: 2px 0 5px; font-size: 11px; }
#nbCoverage [data-result] { margin-top: 6px; }
#nbCoverage .nb-coverage-count { font-size: 17px; }
#nbCoverage .nb-coverage-basis { margin: 4px 0; font-size: 10px; line-height: 1.3; }
#nbCoverage .nb-coverage-warning { margin: 5px 0; padding: 4px 6px; font-size: 11px; }
#nbCoverage th, #nbCoverage td { padding: 5px; }
#nbCollapse { margin-left: auto; flex-shrink: 0; border: 1px solid #cbd5e1; border-radius: 4px;
  background: #f8fafc; color: #475569; font: 12px sans-serif; padding: 4px 8px; cursor: pointer; }
#nearbyDrawer #nbClose { margin-left: 0; flex-shrink: 0; }
#nearbyDrawer.nb-collapsed { display: block; }
#nearbyDrawer.nb-collapsed > :not(.nb-head) { display: none; }
@media(max-width: 1450px) {
  #nearbyDrawer #nbCoverage { max-height: 220px; }
}
