
:root{
  --panel:#ffffff;
  --ink:#18212f;
  --muted:#6b7280;
  --line:#e8ebef;
  --soft:#f7f8fa;
  --shadow:0 8px 30px rgba(22,29,37,.10);
  --radius:14px;
}
*{box-sizing:border-box}
html,body,#app{width:100%;height:100%;margin:0}
body{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--ink);overflow:hidden;background:#f4f5f6}
button,input{font:inherit}
button{cursor:pointer}
#app{display:flex}
.sidebar{
  width:284px;min-width:284px;height:100%;background:rgba(255,255,255,.97);
  border-right:1px solid var(--line);z-index:20;display:flex;flex-direction:column;
}
.brand{height:80px;padding:15px 16px;display:flex;align-items:center;gap:12px;border-bottom:1px solid var(--line)}
.brand-mark{width:42px;height:42px;border:2px solid #253140;border-radius:50%;display:grid;place-items:center}
.brand-mark svg{width:25px;height:25px}
.brand h1{font-size:16px;line-height:1.15;margin:0;font-weight:750}
.brand p{margin:4px 0 0;color:var(--muted);font-size:12px}
.sidebar-toolbar{display:none;padding:10px 14px;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}
.soft-btn,.text-btn,.action-btn,.round-btn,.icon-btn,.control-btn{
  border:0;background:none;color:var(--ink)
}
#infoBtn{display:none}
#refreshBtn{display:none}
.soft-btn{background:#fff;border:1px solid var(--line);box-shadow:0 2px 7px rgba(0,0,0,.06);padding:8px 12px;border-radius:10px;font-size:12px;display:flex;gap:7px;align-items:center}
.soft-btn svg,.text-btn svg{width:14px;height:14px}
.text-btn{color:#68707c;font-size:12px;display:flex;gap:5px;align-items:center}
.filters-panel{overflow:auto;padding-bottom:30px}
.filter-section{padding:16px;border-bottom:1px solid var(--line)}
.section-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:9px}
.section-title strong{font-size:12px}
.check-all{font-size:9px;color:#7a818c;display:flex;gap:5px;align-items:center}
.category-row,.subcategory-row{display:flex;align-items:center;gap:7px;padding:7px 2px;border-radius:8px}
.category-row:hover,.subcategory-row:hover{background:var(--soft)}
.category-row input,.subcategory-row input{accent-color:#1f2937}
.category-label{display:flex;align-items:center;gap:7px;min-width:0;flex:1;font-size:11px}
.category-dot{width:20px;height:20px;border-radius:7px;color:#fff;display:grid;place-items:center;flex:none}
.category-dot svg{width:12px;height:12px}
.count{font-size:10px;color:#737b86;background:#f0f2f5;border-radius:8px;padding:2px 6px}
.expand-btn{width:22px;height:22px;display:grid;place-items:center;border:0;background:none;color:#7b838e}
.expand-btn svg{width:14px;height:14px}
.subcategory-list{padding-left:29px}
.subcategory-row .category-dot{width:18px;height:18px;border-radius:6px}
.subcategory-row .category-dot svg{width:11px;height:11px}
.map-area{position:relative;flex:1;min-width:0;height:100%}
#map{position:absolute;inset:0}
.top-search{
  position:absolute;z-index:10;top:18px;left:50%;transform:translateX(-50%);
  width:min(520px,calc(100% - 520px));min-width:320px;
  background:#fff;border:1px solid rgba(0,0,0,.06);border-radius:28px;
  box-shadow:0 8px 25px rgba(0,0,0,.12);height:44px;display:flex;align-items:center;padding:0 14px;gap:8px
}
.top-search>svg{width:17px;color:#69717d}
.top-search input{border:0;outline:0;flex:1;min-width:0;font-size:12px}
.top-search input::placeholder{color:#9097a1}
.map-actions{position:absolute;right:16px;top:18px;z-index:10;display:flex;gap:8px}
.action-btn,.round-btn{background:#fff;border:1px solid rgba(0,0,0,.06);box-shadow:0 5px 18px rgba(0,0,0,.10);height:38px;border-radius:10px;padding:0 12px;display:flex;align-items:center;gap:7px;font-size:11px}
.action-btn svg,.round-btn svg{width:15px;height:15px}
.round-btn{width:38px;padding:0;justify-content:center;border-radius:50%}
.card{display:none; background:rgba(255,255,255,.97);border:1px solid rgba(0,0,0,.06);box-shadow:var(--shadow);border-radius:14px}
.legend{position:absolute;z-index:10;right:16px;top:76px;width:164px;max-height:calc(100% - 280px);overflow:auto}
.legend-header{height:43px;padding:0 12px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}
.legend-header strong{font-size:11px}
.legend-title{font-size:9px;color:#6d7480;font-weight:650;margin-bottom:8px}
#legendBody{padding:11px}
#categoryLegend{display:grid;gap:6px}
.legend-item{display:flex;align-items:center;gap:7px;font-size:9px}
.legend-color{width:10px;height:10px;border-radius:50%;flex:none}
.legend-divider{height:1px;background:var(--line);margin:11px 0}
.icon-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:5px}
.icon-item{height:31px;border:1px solid #eceef1;border-radius:7px;display:grid;place-items:center;background:#fafafa}
.icon-item svg{width:14px;height:14px;color:#65707e}
.legend-hint{border-top:1px solid var(--line);margin:11px -11px -1px;padding:10px 0 0;display:flex;gap:6px;align-items:flex-start;color:#737b85;font-size:8px;line-height:1.3}
.legend-hint svg{width:12px;height:12px;flex:none}
.map-controls{position:absolute;right:17px;top:25px;z-index:10;display:grid;gap:1px}
.control-btn{width:38px;height:38px;background:#fff;border:1px solid var(--line);display:grid;place-items:center;font-size:20px}
.control-btn:first-child{border-radius:10px 10px 0 0}
.control-btn:last-child{border-radius:0 0 10px 10px}
.control-btn svg{width:16px}
.bottom-panel{
  position:absolute;z-index:9;left:16px;right:16px;bottom:12px;background:rgba(255,255,255,.97);
  border:1px solid rgba(0,0,0,.06);box-shadow:var(--shadow);border-radius:14px;padding:10px 10px 9px;
}
.stats-row{display:grid;grid-template-columns:repeat(11,minmax(0,1fr));gap:7px}
.stat-card{background:#fff;border:1px solid #edf0f3;border-radius:10px;padding:7px 8px;min-width:0}
.stat-card .stat-top{display:flex;align-items:center;gap:6px;font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stat-card .stat-icon{width:18px;height:18px;border-radius:6px;color:#fff;display:grid;place-items:center;flex:none}
.stat-card .stat-icon svg{width:10px;height:10px}
.stat-value{font-size:20px;line-height:1.1;font-weight:650;margin:3px 0 0}
.stat-sub{font-size:7px;color:#858c95}
.total-card .stat-value{font-size:21px}
.results-header{display:none;align-items:center;justify-content:space-between;padding:9px 5px 5px}
.results-header strong{font-size:11px}
.results-list{display:none;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;max-height:112px;overflow:hidden}
.result-card{border:1px solid #e9edf1;border-radius:9px;padding:9px;display:flex;gap:8px;min-width:0;background:#fff}
.result-card .result-icon{width:29px;height:29px;border-radius:8px;display:grid;place-items:center;color:#fff;flex:none}
.result-icon svg{width:15px;height:15px}
.result-main{min-width:0}
.result-name{font-size:10px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.result-meta{font-size:8px;margin-top:2px;font-weight:600}
.result-address{font-size:8px;color:#737a84;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.result-phone{font-size:8px;color:#737a84;margin-top:2px}
.marker{
  width:34px;height:34px;border-radius:50%;border:3px solid #fff;color:#fff;
  display:grid;place-items:center;box-shadow:0 3px 9px rgba(0,0,0,.20);cursor:pointer;
}
.marker svg{width:16px;height:16px;stroke-width:2.5}
.cluster-marker{
  width:40px;height:40px;border-radius:50%;border:3px solid rgba(255,255,255,.95);color:#fff;
  display:grid;place-items:center;font-weight:750;font-size:12px;box-shadow:0 3px 10px rgba(0,0,0,.20);cursor:pointer;
}
.cluster-marker::after{content:"";position:absolute;width:48px;height:48px;border-radius:50%;border:3px solid currentColor;opacity:.18}
.search-results{position:absolute;top:50px;left:0;right:0;background:#fff;border-radius:12px;border:1px solid var(--line);box-shadow:var(--shadow);overflow:hidden;max-height:320px}
.search-result{padding:10px 12px;border-bottom:1px solid #f0f1f3;display:flex;gap:8px;align-items:center}
.search-result:last-child{border-bottom:0}
.search-result:hover{background:#fafafa}
.search-result-icon{width:26px;height:26px;border-radius:7px;color:#fff;display:grid;place-items:center;flex:none}
.search-result-icon svg{width:13px}
.search-result-text{min-width:0}
.search-result-name{font-size:10px;font-weight:700}
.search-result-meta{font-size:8px;color:#737b86}
.loading-overlay{position:absolute;inset:0;z-index:50;background:rgba(255,255,255,.72);backdrop-filter:blur(3px);display:flex;align-items:center;justify-content:center;gap:12px}
.spinner{width:28px;height:28px;border:3px solid #e4e7eb;border-top-color:#26323f;border-radius:50%;animation:spin .8s linear infinite}
.loading-overlay strong{font-size:12px}.loading-overlay p{font-size:9px;color:#727a84;margin:3px 0 0}
@keyframes spin{to{transform:rotate(360deg)}}
.loading-box{
  width:min(440px,calc(100vw - 40px));max-height:min(620px,calc(100vh - 80px));
  background:rgba(255,255,255,.97);border:1px solid rgba(0,0,0,.07);
  border-radius:16px;padding:20px;box-shadow:0 16px 50px rgba(0,0,0,.14)
}
.loading-main{display:flex;align-items:center;gap:12px}
.loading-progress-track{height:5px;background:#eef0f2;border-radius:99px;overflow:hidden;margin:15px 0 11px}
.loading-progress{height:100%;width:0;background:#26323f;border-radius:99px;transition:width .2s ease}
.diagnostic-row{
  display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px;margin-bottom:6px
}
.diagnostic-row span{
  border:1px solid #e9edf0;background:#fafbfc;border-radius:7px;padding:6px 7px;
  font-size:8px;text-align:center;color:#59636f
}
.diagnostic-detail{
  font-size:8px;color:#8a919a;margin:0 0 7px 1px
}
.loading-sources{
  max-height:390px;overflow:auto;border:1px solid #edf0f2;border-radius:10px;
  background:#fafbfc
}
.loading-source{
  display:grid;grid-template-columns:20px 1fr auto;align-items:center;gap:7px;
  min-height:27px;padding:4px 9px;border-bottom:1px solid #eef0f2;font-size:9px
}
.loading-source:last-child{border-bottom:0}
.loading-status{font-weight:800;text-align:center}
.loading-source-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#424b57}
.loading-source-count{font-variant-numeric:tabular-nums;color:#7a828c}
.loading-source.is-ok .loading-status{color:#3b8a55}
.loading-source.is-error .loading-status{color:#c83d3d}
.loading-source.is-loading .loading-source-name{font-weight:700;color:#202832}
.toast{position:absolute;z-index:60;left:50%;bottom:18px;transform:translateX(-50%);background:#202832;color:#fff;border-radius:9px;padding:9px 13px;font-size:10px;box-shadow:var(--shadow)}
.hidden{display:none!important}
.mapboxgl-popup-content{padding:0;border-radius:14px;box-shadow:0 10px 35px rgba(0,0,0,.18);overflow:hidden}
.mapboxgl-popup-close-button{font-size:18px;padding:5px 8px;color:#66707b}
.popup{width:280px}
.popup-head{padding:13px 14px 10px;display:flex;gap:9px;align-items:flex-start}
.popup-icon{width:34px;height:34px;border-radius:9px;color:#fff;display:grid;place-items:center;flex:none}
.popup-icon svg{width:17px}
.popup-name{font-size:13px;font-weight:750;line-height:1.2;padding-right:15px}
.popup-category{font-size:9px;margin-top:3px;font-weight:650}
.popup-body{padding:0 14px 14px}
.popup-line{display:flex;gap:7px;font-size:9px;color:#626a75;margin-top:7px;line-height:1.35}
.popup-line svg{width:13px;height:13px;flex:none}
.popup-link{display:inline-flex;align-items:center;gap:5px;margin-top:10px;font-size:9px;font-weight:700;text-decoration:none}
@media (max-width:1100px){
  .sidebar{width:255px;min-width:255px}
  .stats-row{grid-template-columns:repeat(6,1fr)}
  .results-list{grid-template-columns:repeat(3,1fr)}
  .top-search{width:420px}
}
@media (max-width:760px){
  .sidebar{position:absolute;left:0;top:0;bottom:0;transform:translateX(-100%);transition:transform .22s;box-shadow:10px 0 35px rgba(0,0,0,.12)}
  .sidebar.open{transform:translateX(0)}
  .top-search{left:12px;right:12px;transform:none;width:auto;min-width:0;top:12px}
  .map-actions{top:64px;right:12px}
  .action-btn{font-size:0;width:38px;justify-content:center;padding:0}
  .action-btn svg{width:16px}
  .legend{right:12px;top:112px;width:150px;max-height:280px}
  .bottom-panel{left:8px;right:8px;bottom:8px}
  .stats-row{display:flex;overflow:auto}
  .stat-card{min-width:112px}
  .results-list{grid-template-columns:1fr;max-height:145px}
  .map-controls{right:12px;bottom:230px}
}
