:root{
  --bg:#f2f5f7;--panel:#fff;--text:#17212b;--muted:#6b7785;--line:#dce3e8;
  --brand:#214f4b;--brand2:#2e6d67;--accent:#b84a3a;--accent2:#f0b44d;--shadow:0 8px 28px rgba(15,35,45,.13);
  --radius:14px;
}
*{box-sizing:border-box} html,body{height:100%;margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;color:var(--text);background:var(--bg)}
body{overflow:hidden}.hidden{display:none!important}.mobile-only{display:none}
.topbar{height:68px;background:var(--panel);display:flex;align-items:center;justify-content:space-between;padding:0 18px;border-bottom:1px solid var(--line);position:relative;z-index:20}
.brand{display:flex;align-items:center;gap:11px;min-width:0}.brand-mark{height:42px;width:42px;display:grid;place-items:center;background:var(--brand);color:#fff;border-radius:11px;font-weight:800;font-size:13px;letter-spacing:.5px}.brand h1{font-size:18px;margin:0;line-height:1.1}.brand p{font-size:11px;color:var(--muted);margin:4px 0 0}.top-actions{display:flex;gap:8px;align-items:center}
.app-shell{height:calc(100% - 68px);display:grid;grid-template-columns:370px 1fr}.sidebar{background:var(--panel);border-right:1px solid var(--line);overflow:auto;z-index:10;display:flex;flex-direction:column}.panel-section{padding:15px 17px;border-bottom:1px solid var(--line)}.sticky-head{position:sticky;top:0;background:#fff;z-index:5}.grow-section{min-height:260px}.detail-panel{padding-bottom:30px}
.field-label{display:block;font-size:11px;text-transform:uppercase;letter-spacing:.07em;font-weight:750;color:#596774;margin:0 0 7px}.top-gap{margin-top:12px}.select,.input{border:1px solid #cdd7dd;border-radius:9px;background:#fff;color:var(--text);outline:none;transition:.15s}.select:focus,.input:focus{border-color:var(--brand2);box-shadow:0 0 0 3px rgba(46,109,103,.12)}.select{height:40px;padding:0 10px}.select.full{width:100%}.select.compact{height:36px;max-width:150px}.input{width:100%;height:40px;padding:0 11px;font-size:14px}.input.small{height:35px;font-size:13px}.mini-meta{font-size:11px;color:var(--muted);margin-top:7px;line-height:1.4}
.btn{border:0;border-radius:9px;padding:0 13px;height:38px;font-weight:700;cursor:pointer;background:#e9eef1;color:#25333d}.btn:hover{filter:brightness(.98)}.btn.primary{background:var(--brand);color:#fff}.btn.ghost{background:#edf3f2;color:var(--brand)}.btn.tiny{height:28px;padding:0 9px;font-size:11px}.icon-btn{border:0;background:transparent;font-size:23px}.link-btn{border:0;background:transparent;color:var(--brand2);font-weight:700;cursor:pointer;font-size:12px}.inline-search{display:grid;grid-template-columns:1fr auto;gap:8px}
.stats-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.stat{background:#f5f8f9;border-radius:10px;padding:10px 8px;text-align:center}.stat strong{display:block;font-size:17px;color:var(--brand)}.stat span{display:block;color:var(--muted);font-size:10px;margin-top:2px}.coverage{height:5px;background:#e6ecef;border-radius:8px;margin:10px 0 0;overflow:hidden}.coverage span{display:block;height:100%;background:var(--brand2);width:0}
.section-title-row{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}.section-title-row h2{font-size:13px;margin:0}.badge{font-size:10px;background:#edf2f4;border-radius:99px;padding:3px 7px;color:#66747e}
.suggestions{position:absolute;left:17px;right:17px;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);max-height:240px;overflow:auto;z-index:30;margin-top:4px}.suggestion{padding:9px 11px;border-bottom:1px solid #eef2f4;cursor:pointer}.suggestion:last-child{border:0}.suggestion:hover{background:#f2f7f6}.suggestion strong{font-size:12px;display:block}.suggestion span{font-size:10px;color:var(--muted)}
.street-list{margin-top:8px;max-height:360px;overflow:auto;border:1px solid #e3e9ed;border-radius:10px}.street-row{padding:8px 10px;border-bottom:1px solid #edf1f3;cursor:pointer;display:flex;justify-content:space-between;gap:8px;align-items:flex-start}.street-row:last-child{border:0}.street-row:hover,.street-row.active{background:#edf6f4}.street-name{font-size:12px;font-weight:700;line-height:1.25}.street-locality{font-size:10px;color:var(--muted);margin-top:2px}.access-count{font-size:10px;color:#60717b;white-space:nowrap;background:#f1f4f6;border-radius:7px;padding:3px 5px}
.message{margin-top:9px;border-radius:9px;padding:8px 10px;font-size:11px;line-height:1.4;background:#fff4dd;color:#77521b}.detail-card{border:1px solid #e1e7eb;border-radius:10px;overflow:hidden}.detail-head{padding:11px;background:#f4f7f8}.detail-head strong{display:block;font-size:13px}.detail-head span{font-size:10px;color:var(--muted)}.kv{display:grid;grid-template-columns:115px 1fr;border-top:1px solid #edf1f3;font-size:11px}.kv span,.kv strong{padding:6px 9px}.kv span{color:var(--muted)}.kv strong{font-weight:650;overflow-wrap:anywhere}.civic-list{margin-top:10px;display:flex;flex-wrap:wrap;gap:5px}.civic-chip{border:1px solid #d7e0e4;background:#fff;border-radius:7px;font-size:10px;padding:4px 6px;cursor:pointer}.civic-chip:hover{background:#edf6f4;border-color:#a9c6c1}.civic-chip.no-geo{opacity:.55}
.map-wrap{position:relative;min-width:0}.map-wrap #map{position:absolute;inset:0}.loading{position:absolute;top:15px;left:50%;transform:translateX(-50%);background:#fff;border-radius:99px;padding:9px 14px;box-shadow:var(--shadow);display:flex;gap:9px;align-items:center;z-index:8;font-size:12px}.spinner{width:16px;height:16px;border:2px solid #d8e2e5;border-top-color:var(--brand);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}
.welcome-card{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);background:rgba(255,255,255,.96);padding:24px 26px;border-radius:18px;box-shadow:var(--shadow);width:min(410px,calc(100% - 32px));z-index:5;text-align:center}.welcome-icon{margin:auto;width:48px;height:48px;border-radius:14px;display:grid;place-items:center;background:#e9f2f0;color:var(--brand);font-size:26px}.welcome-card h2{margin:12px 0 7px;font-size:19px}.welcome-card p{font-size:12px;line-height:1.55;color:var(--muted);margin:0}.global-stats{margin-top:12px;font-size:11px;color:#4f5f69}.legend{position:absolute;right:10px;bottom:28px;background:rgba(255,255,255,.94);border-radius:9px;padding:7px 9px;z-index:5;box-shadow:0 4px 14px rgba(20,40,50,.12);font-size:10px;line-height:1.65}.dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:5px}.dot.cluster{background:#235c59}.dot.civic{background:#b84a3a}.dot.selected{background:#f0b44d;border:1px solid #7a5a1e}
.maplibregl-popup-content{font-family:inherit;border-radius:10px!important;padding:10px 11px!important;box-shadow:var(--shadow)!important}.popup-title{font-weight:800;font-size:12px;margin-bottom:4px}.popup-line{font-size:10px;color:#5e6d76;line-height:1.45}
@media(max-width:850px){.mobile-only{display:block}.topbar{height:60px;padding:0 10px}.brand-mark{display:none}.brand h1{font-size:15px}.brand p{display:none}.top-actions .btn{display:none}.select.compact{max-width:118px}.app-shell{height:calc(100% - 60px);display:block}.sidebar{position:absolute;top:60px;bottom:0;left:0;width:min(360px,92vw);transform:translateX(-102%);transition:.22s;box-shadow:var(--shadow);z-index:30}.sidebar.open{transform:translateX(0)}.map-wrap{height:100%}.legend{bottom:18px}.welcome-card{top:46%}.street-list{max-height:290px}}
@media print{.topbar,.sidebar,.legend,.welcome-card{display:none!important}.app-shell{display:block;height:100vh}.map-wrap{height:100vh}}

.map-error{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:28px;text-align:center;background:#eef2f4;color:#17323c;z-index:3}.map-error strong{font-size:20px}.map-error span{max-width:520px;color:#5c6f78;font-size:14px;line-height:1.45}

/* Motore cartografico integrato: nessuna dipendenza WebGL/MapLibre */
.simple-map{background:#e8eef1;overflow:hidden;touch-action:none;cursor:grab;user-select:none}
.simple-map:active{cursor:grabbing}
.sm-tiles{position:absolute;inset:0;overflow:hidden;background:#e8eef1;z-index:0}
.sm-tile{position:absolute;width:256px;height:256px;max-width:none;pointer-events:none;user-select:none;-webkit-user-drag:none}
.sm-canvas{position:absolute;left:0;top:0;z-index:2;pointer-events:none}
.sm-controls{position:absolute;right:12px;top:12px;z-index:6;display:flex;flex-direction:column;border-radius:8px;overflow:hidden;box-shadow:0 2px 10px rgba(15,35,45,.18)}
.sm-controls button{width:34px;height:34px;border:0;border-bottom:1px solid #dce3e8;background:#fff;color:#17323c;font-size:22px;line-height:1;cursor:pointer;font-weight:500}
.sm-controls button:last-child{border-bottom:0}.sm-controls button:hover{background:#f2f6f7}
.sm-scale{position:absolute;left:10px;bottom:10px;z-index:6;border-left:2px solid #26343c;border-right:2px solid #26343c;border-bottom:2px solid #26343c;height:8px;color:#26343c;font-size:10px;line-height:18px;text-align:center;text-shadow:0 1px 0 #fff;background:rgba(255,255,255,.25)}
.sm-popup{position:absolute;z-index:8;transform:translate(-50%,calc(-100% - 12px));min-width:150px;max-width:280px;background:#fff;border-radius:10px;padding:10px 28px 10px 11px;box-shadow:0 8px 28px rgba(15,35,45,.22);font-size:12px;pointer-events:auto}
.sm-popup:after{content:"";position:absolute;left:50%;bottom:-8px;transform:translateX(-50%);border-width:8px 7px 0;border-style:solid;border-color:#fff transparent transparent}
.sm-popup-close{position:absolute;right:5px;top:4px;width:22px;height:22px;border:0;background:transparent;font-size:18px;cursor:pointer;color:#65737c}
