:root{
  --bg:#08111f;
  --bg-soft:#111d31;
  --panel:#0d1628;
  --panel-2:#152239;
  --line:#243552;
  --text:#eff5ff;
  --muted:#8ea4c2;
  --accent:#f97316;
  --ok:#22c55e;
  --warn:#facc15;
  --bad:#ef4444;
}
*{box-sizing:border-box;margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:linear-gradient(180deg,#0a1322 0,#08111f 100%);
  color:var(--text);
  height:100vh;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
button,input,select{font:inherit}
#loading-overlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(6,11,21,.72);
  backdrop-filter:blur(4px);
  z-index:2000;
  transition:opacity .18s ease,visibility .18s ease;
}
body.loaded #loading-overlay{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
}
.loading-card{
  min-width:280px;
  max-width:420px;
  padding:22px 24px;
  border-radius:20px;
  background:linear-gradient(180deg,#132037 0,#10192b 100%);
  border:1px solid #263755;
  box-shadow:0 18px 48px rgba(0,0,0,.32);
  text-align:center;
}
.loading-spinner{
  width:34px;
  height:34px;
  margin:0 auto 12px;
  border-radius:999px;
  border:3px solid rgba(255,255,255,.12);
  border-top-color:#f97316;
  animation:spin .8s linear infinite;
}
.loading-title{
  font-size:15px;
  font-weight:800;
}
.loading-sub{
  margin-top:6px;
  font-size:11px;
  color:var(--muted);
  line-height:1.45;
}
@keyframes spin{
  to{transform:rotate(360deg)}
}
#topbar{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:56px;
  padding:8px 14px;
  background:rgba(8,15,28,.96);
  border-bottom:1px solid var(--line);
  flex-shrink:0;
  flex-wrap:wrap;
}
.brand{font-size:13px;font-weight:700;letter-spacing:.02em}
.top-controls{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.city-picker{
  display:flex;
  align-items:center;
  gap:6px;
  padding:4px 8px;
  border-radius:999px;
  background:#111c30;
  border:1px solid var(--line);
}
.city-picker span{
  font-size:9px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
}
.city-picker select,
.date-filter input{
  min-width:118px;
  height:24px;
  padding:0 22px 0 8px;
  border-radius:999px;
  border:1px solid #31476d;
  background:#22314b;
  color:#e3eefc;
  font-size:10px;
  outline:none;
}
.city-picker select:disabled{
  opacity:.7;
  cursor:wait;
}
.date-filter{
  display:flex;
  align-items:center;
  gap:6px;
  padding:4px 8px;
  border-radius:999px;
  background:#111c30;
  border:1px solid var(--line);
}
.date-filter span{
  font-size:9px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
}
.date-filter input{
  min-width:124px;
  padding-right:8px;
}
.date-filter input:disabled{
  opacity:.7;
  cursor:wait;
}
.channel-filter{
  position:relative;
}
.channel-toggle{
  height:32px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid #31476d;
  background:#22314b;
  color:#e3eefc;
  font-size:10px;
  font-weight:700;
  cursor:pointer;
}
.channel-toggle:disabled{
  opacity:.7;
  cursor:wait;
}
.channel-menu{
  position:absolute;
  top:calc(100% + 8px);
  left:0;
  width:240px;
  max-height:280px;
  padding:10px;
  border-radius:16px;
  border:1px solid #263755;
  background:#10192b;
  box-shadow:0 18px 40px rgba(0,0,0,.34);
  z-index:900;
}
.channel-menu-head{
  display:flex;
  justify-content:flex-end;
  gap:6px;
  margin-bottom:8px;
}
.channel-list{
  display:grid;
  gap:6px;
  max-height:220px;
  overflow:auto;
}
.channel-item{
  display:flex;
  align-items:center;
  gap:8px;
  padding:7px 8px;
  border-radius:10px;
  background:#131f33;
  border:1px solid #22324e;
  font-size:11px;
}
.channel-item input{
  accent-color:#f97316;
}
.city-tag{
  padding:3px 8px;
  border-radius:999px;
  background:#22314b;
  border:1px solid #31476d;
  font-size:9px;
  color:#e3eefc;
}
.top-note{
  min-width:0;
  flex:1;
  font-size:10px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.kpis{
  margin-left:auto;
  display:flex;
  gap:6px;
}
.kpi{
  min-width:72px;
  padding:5px 9px;
  border-radius:9px;
  background:#111c30;
  border:1px solid var(--line);
}
.kpi .v{font-size:13px;font-weight:800;line-height:1.15}
.kpi .l{
  margin-top:2px;
  font-size:8px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
}
#layerbar{
  display:flex;
  align-items:center;
  gap:7px;
  padding:8px 14px;
  background:rgba(10,17,31,.98);
  border-bottom:1px solid var(--line);
  flex-shrink:0;
  overflow-x:auto;
}
.layer-label{
  font-size:9px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
}
.layer-sep{
  width:1px;
  height:18px;
  background:var(--line);
  flex-shrink:0;
}
.pill{
  display:flex;
  align-items:center;
  gap:7px;
  padding:7px 12px;
  border-radius:999px;
  border:1px solid transparent;
  background:#131d31;
  color:#d8e4f5;
  cursor:pointer;
  font-size:10px;
  font-weight:700;
  white-space:nowrap;
  transition:.15s ease;
}
.pill.off{opacity:.42}
.pill.on{border-color:currentColor}
.dot{
  width:9px;
  height:9px;
  border-radius:999px;
  flex-shrink:0;
}
.dot-grid{background:#ef4444}
.dot-points{background:#facc15}
.dot-existing{background:#7dd3fc}
.dot-recommended{background:#fb923c}
.dot-custom{background:#f472b6}
#workspace{
  display:flex;
  flex:1;
  min-height:0;
}
#map-shell{
  position:relative;
  flex:1;
  min-width:0;
}
#map{
  width:100%;
  height:100%;
}
#sidepanel{
  width:340px;
  min-width:0;
  flex-shrink:0;
  display:flex;
  flex-direction:column;
  background:linear-gradient(180deg,#0f1728 0,#0b1220 100%);
  border-left:1px solid var(--line);
  transition:width .18s ease,border-color .18s ease,opacity .18s ease;
  overflow:hidden;
}
body.sidebar-collapsed #sidepanel{
  width:0;
  min-width:0;
  border-left-color:transparent;
  opacity:0;
  pointer-events:none;
}
body.sidebar-collapsed #sidepanel *{
  visibility:hidden;
}
.panel-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--line);
  flex-shrink:0;
}
.tabs{
  display:flex;
  flex:1;
}
.tab{
  flex:1;
  padding:11px 8px;
  border:none;
  background:transparent;
  color:var(--muted);
  cursor:pointer;
  font-size:10px;
  font-weight:800;
  letter-spacing:.04em;
  border-bottom:2px solid transparent;
}
.tab.active{
  color:#fff;
  border-bottom-color:var(--accent);
  background:rgba(17,27,43,.7);
}
#sidepanel-content{
  flex:1;
  overflow:auto;
  padding:10px 10px 14px;
}
.hub-card{
  border:1px solid #23324f;
  background:linear-gradient(180deg,#132037 0,#10192b 100%);
  border-radius:14px;
  margin-bottom:8px;
  overflow:hidden;
  box-shadow:0 8px 24px rgba(0,0,0,.16);
}
.hub-card.selected{
  border-color:#f59e0b;
  box-shadow:0 12px 28px rgba(249,115,22,.16);
}
.hub-summary{
  width:100%;
  border:none;
  background:transparent;
  color:inherit;
  text-align:left;
  padding:12px 12px 10px;
  display:flex;
  gap:9px;
  cursor:pointer;
}
.hub-swatch{
  width:16px;
  height:4px;
  border-radius:999px;
  margin-top:7px;
  flex-shrink:0;
}
.hub-main{
  flex:1;
  min-width:0;
}
.hub-name{
  font-size:12px;
  font-weight:800;
  line-height:1.25;
}
.hub-sub{
  margin-top:3px;
  font-size:9px;
  color:var(--muted);
}
.hub-meta-line{
  margin-top:7px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  font-size:9px;
  color:#d7e2f4;
}
.hub-meta-line span{
  padding:3px 6px;
  border-radius:999px;
  background:#1a2740;
  border:1px solid #2a3b5b;
}
.expand-tag{
  align-self:flex-start;
  font-size:9px;
  font-weight:800;
  color:var(--muted);
  padding-top:2px;
}
.hub-detail{
  display:none;
  padding:0 12px 12px;
}
.hub-card.expanded .hub-detail{display:block}
.detail-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:7px;
}
.detail-box{
  padding:9px;
  border-radius:11px;
  background:#0d1628;
  border:1px solid #23324f;
}
.detail-box .k{
  font-size:8px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
}
.detail-box .v{
  margin-top:4px;
  font-size:13px;
  font-weight:800;
}
.detail-actions{
  margin-top:9px;
  display:flex;
  gap:7px;
  flex-wrap:wrap;
}
.status-row{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:9px;
}
.status-pill{
  padding:3px 7px;
  border-radius:999px;
  font-size:8px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.06em;
}
.status-pill.ok{
  background:rgba(34,197,94,.12);
  border:1px solid rgba(34,197,94,.3);
  color:#bbf7d0;
}
.status-pill.warn{
  background:rgba(250,204,21,.12);
  border:1px solid rgba(250,204,21,.26);
  color:#fde68a;
}
.inline-empty{
  padding:18px 14px;
  border-radius:14px;
  border:1px dashed #2a3b5b;
  text-align:center;
  color:var(--muted);
  line-height:1.5;
}
#floating-top{
  position:absolute;
  top:12px;
  left:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index:1000;
  width:272px;
  max-width:min(272px,calc(100% - 24px));
}
.floating-card{
  border:1px solid #23324f;
  border-radius:14px;
  background:rgba(11,18,32,.9);
  backdrop-filter:blur(12px);
  box-shadow:0 18px 36px rgba(0,0,0,.24);
  overflow:hidden;
}
.bottom-card{
  position:absolute;
  left:12px;
  bottom:12px;
  z-index:1000;
  width:272px;
  max-width:min(272px,calc(100% - 24px));
}
.map-toggle{
  position:absolute;
  top:12px;
  right:12px;
  z-index:1000;
  border:none;
  border-radius:999px;
  padding:7px 12px;
  background:rgba(8,15,28,.9);
  color:#e4eefb;
  border:1px solid rgba(48,66,98,.96);
  cursor:pointer;
  font-size:10px;
  font-weight:800;
  letter-spacing:.03em;
  backdrop-filter:blur(10px);
}
.map-toggle:hover{background:#162239}
.card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
  padding:10px 11px;
  border-bottom:1px solid rgba(35,50,79,.85);
}
.card-title{
  font-size:11px;
  font-weight:800;
}
.card-sub{
  margin-top:3px;
  font-size:9px;
  color:var(--muted);
  line-height:1.35;
}
.card-body{
  padding:10px 11px 11px;
}
.card-actions{
  display:flex;
  gap:6px;
  align-items:center;
}
.collapse-btn,
.ghost-btn,
.primary-btn,
.seg-btn{
  border:none;
  border-radius:9px;
  cursor:pointer;
  transition:.15s ease;
}
.collapse-btn{
  padding:6px 9px;
  background:#162239;
  color:#d8e3f6;
  border:1px solid #31476d;
  font-size:9px;
  font-weight:800;
}
.ghost-btn{
  padding:8px 10px;
  background:#162239;
  color:#d8e3f6;
  border:1px solid #31476d;
  font-size:10px;
  font-weight:700;
}
.ghost-btn.small{padding:6px 9px;font-size:9px;font-weight:800}
.ghost-btn.danger{
  color:#fecaca;
  border-color:rgba(239,68,68,.38);
  background:rgba(127,29,29,.22);
}
.primary-btn{
  padding:8px 11px;
  background:linear-gradient(180deg,#fb923c 0,#f97316 100%);
  color:#fff7ed;
  font-size:10px;
  font-weight:800;
}
.ghost-btn:hover,
.collapse-btn:hover,
.seg-btn:hover{background:#21314d}
.ghost-btn.danger:hover{background:rgba(127,29,29,.38)}
.primary-btn:hover{filter:brightness(1.05)}
.ghost-btn:disabled,
.primary-btn:disabled{opacity:.45;cursor:not-allowed}
.field-grid{
  display:grid;
  gap:7px;
}
.field-grid.two{grid-template-columns:1fr 1fr}
.field{
  display:block;
}
.field span{
  display:block;
  margin-bottom:4px;
  font-size:8px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
  font-weight:800;
}
.field input{
  width:100%;
  border:1px solid #304262;
  background:#162239;
  color:#eff5ff;
  padding:7px 9px;
  border-radius:9px;
  outline:none;
  font-size:10px;
}
.field input:focus{
  border-color:#f59e0b;
  box-shadow:0 0 0 1px rgba(245,158,11,.22);
}
.action-row{
  display:flex;
  gap:7px;
  align-items:center;
  margin-top:9px;
}
.action-row.triple{display:grid;grid-template-columns:1fr 1fr 1fr}
.card-hint{
  margin-top:8px;
  font-size:10px;
  color:#d7e2f4;
  line-height:1.4;
}
.segmented{
  display:flex;
  gap:7px;
}
.seg-btn{
  flex:1;
  padding:8px 9px;
  background:#162239;
  color:#d8e3f6;
  border:1px solid #31476d;
  font-size:10px;
  font-weight:800;
}
.seg-btn.active{
  background:#23314b;
  border-color:#f59e0b;
  color:#fff;
}
.draft-stats{
  margin-top:8px;
}
.draft-card{
  padding:9px;
  border-radius:11px;
  background:#0d1628;
  border:1px solid #23324f;
}
.draft-card .name{
  font-size:11px;
  font-weight:800;
}
.draft-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:7px;
  margin-top:7px;
}
.draft-cell{
  padding:7px;
  border-radius:9px;
  background:#131f33;
  border:1px solid #23324f;
}
.draft-cell .k{
  font-size:8px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
}
.draft-cell .v{
  margin-top:3px;
  font-size:12px;
  font-weight:800;
}
.draft-empty{
  font-size:10px;
  color:#d7e2f4;
  line-height:1.4;
}
.legend-rows{
  display:flex;
  flex-direction:column;
  gap:5px;
}
.legend-row{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:10px;
  color:#d7e2f4;
}
.legend-swatch{
  width:12px;
  height:12px;
  border-radius:4px;
  border:1px solid rgba(255,255,255,.12);
  flex-shrink:0;
}
.grid-editor{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid rgba(35,50,79,.85);
}
.hidden{display:none}
.mode-pencil #map,
.mode-pencil #map *{
  cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M6 23 23.4 5.6a2.6 2.6 0 0 1 3.7 0l1.3 1.3a2.6 2.6 0 0 1 0 3.7L11 28l-6 1 1-6Z' fill='%23fbbf24' stroke='%2308111f' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='m22.5 6.6 3 3' stroke='%23fff7ed' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") 4 28, crosshair;
}
.mode-grid #map,
.mode-grid #map *{
  cursor:cell;
}
.cluster-icon{background:transparent;border:none}
.cluster-badge{
  width:42px;
  height:42px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:radial-gradient(circle at 35% 35%,#fff7ed 0,#fdba74 28%,#f97316 100%);
  color:#431407;
  font-size:12px;
  font-weight:900;
  border:2px solid rgba(255,244,230,.72);
  box-shadow:0 10px 20px rgba(249,115,22,.34);
}
.point-icon{background:transparent;border:none}
.point-dot{
  min-width:14px;
  height:14px;
  padding:0 5px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fef3c7;
  color:#7c2d12;
  border:2px solid rgba(249,115,22,.72);
  font-size:9px;
  font-weight:900;
  box-shadow:0 6px 12px rgba(249,115,22,.24);
}
.point-dot.single{width:14px;padding:0;background:#fff7ed}
.leaflet-tooltip{
  background:#0a1322 !important;
  color:#eef4ff !important;
  border:1px solid #304262 !important;
  border-radius:10px !important;
  box-shadow:0 10px 24px rgba(0,0,0,.28) !important;
  font-size:11px !important;
  padding:8px 10px !important;
}
.leaflet-tooltip:before{display:none !important}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip{
  background:#0a1322 !important;
  color:#eef4ff !important;
}
.leaflet-popup-content{
  margin:12px 14px !important;
  font-size:11px !important;
}
.tt-title{
  font-size:11px;
  font-weight:800;
  margin-bottom:5px;
}
.tt-row{
  display:flex;
  justify-content:space-between;
  gap:14px;
  margin-top:2px;
  color:#99adca;
  font-size:10px;
}
.tt-row b{color:#eef4ff}
::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-thumb{background:#2a3b5b;border-radius:999px}
@media (max-width:1180px){
  #sidepanel{width:312px}
  .kpis{display:none}
  .top-note{
    width:100%;
    order:5;
  }
}
@media (max-width:980px){
  #workspace{flex-direction:column}
  .top-controls{
    width:100%;
  }
  #sidepanel{
    width:100%;
    height:40vh;
    border-left:none;
    border-top:1px solid var(--line);
  }
  body.sidebar-collapsed #sidepanel{
    width:0;
    height:0;
    border-top-color:transparent;
  }
  #floating-top{
    left:12px;
    right:12px;
    width:auto;
    max-width:none;
  }
  .bottom-card{
    left:12px;
    right:12px;
    width:auto;
    max-width:none;
  }
}
