*{box-sizing:border-box}
:root{--border:#d9dde3;--text:#1f2937;--muted:#6b7280;--bg:#f6f7f9;--panel:#fff}
html,body{height:100%;margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;color:var(--text);background:var(--bg)}
body{overflow:hidden}
header{height:72px;background:#fff;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:10px 16px;gap:12px}
header h1{font-size:18px;margin:0 0 2px} header p{margin:0;color:var(--muted);font-size:12px}
main{height:calc(100% - 72px);display:grid;grid-template-columns:320px 1fr}
#sidebar{overflow:auto;padding:12px;background:var(--bg);border-right:1px solid var(--border)}
.card{background:var(--panel);border:1px solid var(--border);border-radius:12px;padding:12px;margin-bottom:10px}
.card h2{font-size:14px;margin:0 0 10px}
.card.small{font-size:12px}.card.small p{margin-bottom:0}
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;text-align:center}
.stats div{background:#f8fafc;border-radius:9px;padding:7px 3px}.stats span{display:block;font-size:18px;font-weight:700}.stats small{font-size:9px;color:var(--muted)}
label{display:block;font-size:12px;margin:8px 0}select,input[type=search]{width:100%;padding:9px;border:1px solid var(--border);border-radius:8px;background:#fff;margin-top:4px}
.check{display:flex;align-items:center;gap:8px}
button{border:1px solid var(--border);background:#fff;border-radius:8px;padding:8px 10px;cursor:pointer}
button.primary{background:#111827;color:#fff;border-color:#111827}.danger-light{color:#991b1b}.muted{color:var(--muted);font-size:11px}
#mapWrap{position:relative;min-width:0}#map{height:100%;width:100%}
#sidebarToggle{display:none;position:absolute;left:10px;top:10px;z-index:1001}
.site-popup{min-width:250px}.site-popup h3{margin:0 0 6px}.kv{display:grid;grid-template-columns:105px 1fr;gap:2px 6px;font-size:12px}
.popup-actions{display:flex;gap:6px;flex-wrap:wrap;margin:9px 0}.popup-actions a{display:inline-block;text-decoration:none;border:1px solid #cbd5e1;border-radius:7px;padding:6px 8px;color:#111827}
.field-editor{border-top:1px solid #e5e7eb;margin-top:8px;padding-top:8px}.field-editor textarea,.field-editor select{width:100%;margin-top:4px}
.field-editor textarea{min-height:64px;padding:7px;border:1px solid #cbd5e1;border-radius:7px}
.legend{background:#fff;padding:7px 9px;border:1px solid var(--border);border-radius:8px;font-size:11px;line-height:1.5}
.legend i{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:5px}
@media(max-width:780px){
  header{height:64px}header h1{font-size:15px}header p{font-size:10px}
  main{height:calc(100% - 64px);display:block}
  #sidebar{position:absolute;z-index:1100;width:min(88vw,340px);height:calc(100% - 64px);transform:translateX(-105%);transition:.2s;box-shadow:4px 0 18px #0002}
  #sidebar.open{transform:translateX(0)}
  #mapWrap{height:100%}#sidebarToggle{display:block}
}

.field-editor input[type=text]{width:100%;padding:7px;border:1px solid #cbd5e1;border-radius:7px;margin-top:4px}
.maplibregl-popup-content{border-radius:12px;padding:12px;box-shadow:0 8px 28px #0002}
.maplibregl-popup-close-button{font-size:20px;padding:2px 7px}
.save-status{display:block;margin-top:6px}

.header-actions{display:flex;gap:8px;align-items:center}
.stats3{grid-template-columns:repeat(3,1fr)}
.badge{font-size:11px;border-radius:999px;padding:5px 8px;background:#374151;color:#fff}
.badge.online{background:#166534}.badge.offline{background:#991b1b}
.progress-track{height:8px;background:#e5e7eb;border-radius:999px;overflow:hidden;margin-bottom:9px}
.progress-track>div{height:100%;width:0;background:#16a34a;transition:width .2s}
.wide{width:100%}.row{display:flex;gap:7px}.row>*{flex:1}
.field-editor .two{display:grid;grid-template-columns:1fr 1fr;gap:7px}
input[type=password],input[type=number]{width:100%;padding:9px;border:1px solid var(--border);border-radius:8px;background:#fff;margin-top:4px}
