:root{--border:#e5e7eb;--muted:#6b7280;--accent:#2563eb;--bg:#fff}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;background:var(--bg)}
.header{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 14px;border-bottom:1px solid var(--border)}
.toolbar.top{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.container{display:grid;grid-template-columns:360px 1fr;height:calc(100vh - 49px);min-height:420px}
.sidebar{border-right:1px solid var(--border);padding:12px;display:flex;flex-direction:column;gap:14px;min-height:0;overflow:auto}
.section-title{font-weight:600;font-size:13px;margin-bottom:6px}
.muted{color:var(--muted);font-size:12px}
.btn{border:1px solid var(--border);background:#f8fafc;padding:6px 10px;border-radius:8px;cursor:pointer}
.btn.secondary{background:#fff}
.btn:hover{border-color:#cbd5e1}
#searchBox{width:100%;padding:8px;border:1px solid var(--border);border-radius:8px;margin-bottom:8px}
.actions{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:8px}
.list{border:1px solid var(--border);border-radius:8px;min-height:40px;padding:6px;max-height:40vh;overflow:auto;font-size:13px}
.list .item{padding:6px 8px;border-bottom:1px dashed var(--border);display:flex;justify-content:space-between;gap:6px;align-items:center}
.list .item:last-child{border-bottom:0}
.list .badge{font-size:11px;color:#fff;background:var(--accent);padding:2px 6px;border-radius:999px}
#map{width:100%;height:100%;min-height:320px}
.poly-label{font-weight:600;color:#1f2937;text-shadow:0 0 2px #fff,0 0 4px #fff}
.labels-hidden .poly-label{display:none}
.legend{border:1px solid var(--border);border-radius:8px;padding:8px;display:flex;flex-direction:column;gap:8px}
.legend-row{display:flex;align-items:center;gap:8px;font-size:13px}
.swatch{display:inline-block;width:18px;height:12px;border-radius:3px;border:1px solid #333}
.swatch.border{background:#f3f4f6}
.swatch.sel{background:#fff;border-style:dashed}
.swatch.pt{width:12px;height:12px;border-radius:50%;border:2px solid #111;background:#ff3b30}
.palette{display:grid;grid-template-columns:repeat(9, 16px);gap:4px}
.palette .sq{width:16px;height:14px;border-radius:2px;border:1px solid rgba(0,0,0,.2)}
.layers{border:1px solid var(--border);border-radius:8px;padding:8px;display:flex;flex-direction:column;gap:8px}
.layer-row{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px}
.layer-row label{display:flex;align-items:center;gap:8px}
.layer-row input[type="range"]{width:120px}
@media (max-width: 900px){
  .container{grid-template-columns:1fr;grid-template-rows:340px 1fr}
  #map{order:-1}
}
