:root{
  --brand:#00528f;
  --brand-hover:#126daf;
  --green:#47bd1c;
  --red:#f5361d;
  --text:#12284c;
  --muted:#616580;
  --line:#d7e3ec;
  --bg:#f4f7fc;
  --card:#fff;
  --shadow:0 18px 44px rgba(0,82,143,.12);
  font-family:Poppins,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

*{box-sizing:border-box}
body{
  margin:0;
  min-height:100vh;
  background:linear-gradient(135deg,#eef8f7,#f4f7fc 48%,#fff);
  color:var(--text);
}

button,
input,
select{
  font:inherit;
}

button{
  min-height:40px;
  border:1px solid var(--brand);
  border-radius:8px;
  background:var(--brand);
  color:#fff;
  font-weight:900;
  cursor:pointer;
}

button:hover{background:var(--brand-hover)}
button.secondary{
  background:#fff;
  color:var(--brand);
  border-color:#bed7e5;
}
button.secondary:hover{background:#eaf5fb}
button.danger{
  border-color:#ffb4a9;
  background:#fff3f1;
  color:#b42318;
}
button.danger:hover{background:#ffe6e1}
button:disabled{
  opacity:.55;
  cursor:not-allowed;
}

.zonesLoading{
  display:grid;
  min-height:100vh;
  place-items:center;
  color:var(--brand);
  font-weight:900;
}

.zonesPage{
  display:grid;
  grid-template-columns:360px minmax(0,1fr);
  min-height:100vh;
}

.zonesSidebar{
  position:sticky;
  top:0;
  max-height:100vh;
  overflow:auto;
  z-index:2;
  display:flex;
  flex-direction:column;
  gap:14px;
  padding:20px;
  background:rgba(255,255,255,.94);
  border-right:1px solid var(--line);
  box-shadow:var(--shadow);
}

.zonesBrand img{
  width:220px;
  max-width:100%;
}

.zonesBrand h1{
  margin:14px 0 4px;
  color:var(--brand);
  font-size:24px;
}

.zonesBrand p{
  margin:0;
  color:var(--muted);
  font-size:13px;
  line-height:1.4;
}

.zonesCard{
  display:grid;
  gap:10px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
}

.zonesCard h2{
  margin:0;
  color:var(--brand);
  font-size:15px;
}

.zonesCard label{
  display:grid;
  gap:6px;
  color:#24445b;
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
}

.zonesCard select,
.zonesCard input[type="text"]{
  width:100%;
  min-height:42px;
  padding:0 12px;
  border:1px solid #c5d9e2;
  border-radius:8px;
  background:#fbfdff;
  color:var(--text);
}

.zonesColorRow{
  display:grid;
  grid-template-columns:1fr 54px;
  gap:10px;
  align-items:end;
}

.zonesCard input[type="color"]{
  width:54px;
  height:42px;
  padding:4px;
  border:1px solid #c5d9e2;
  border-radius:8px;
  background:#fff;
}

.agencyStatus,
.zonesStatus{
  margin:0;
  color:var(--muted);
  font-size:12px;
  line-height:1.4;
}

.zonesStatus strong{color:var(--brand)}
.zonesWarn{
  padding:10px;
  border:1px solid #ffcc85;
  border-radius:8px;
  background:#fff7e6;
  color:#8a4b00;
  font-size:12px;
  font-weight:800;
}

.zonesList{
  display:grid;
  gap:7px;
}

.zoneActions{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
}

.smappenTools{
  border-color:#c6dff0;
  background:linear-gradient(135deg,#fff,#f3fbff);
}

.toolHint{
  margin:0;
  color:var(--muted);
  font-size:12px;
  line-height:1.4;
}

.operationGrid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.operationGrid button{
  min-width:0;
}

.zoneRow{
  display:grid;
  grid-template-columns:14px minmax(0,1fr);
  gap:8px;
  align-items:center;
  min-height:38px;
  padding:8px;
  border:1px solid #dce8ef;
  border-radius:8px;
  background:#f9fcff;
  color:#153755;
  text-align:left;
}

.zoneRow.active{
  border-color:var(--brand);
  background:#eaf5fb;
}

.zoneDot{
  width:12px;
  height:12px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.1);
}

.zoneRow span:last-child{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.zonesMapWrap{
  position:relative;
  min-height:100vh;
  padding:16px;
}

.zonesMapShell{
  position:relative;
  min-height:calc(100vh - 32px);
}

.zonesMap{
  width:100%;
  height:calc(100vh - 32px);
  min-height:620px;
  border:1px solid var(--line);
  border-radius:10px;
  overflow:hidden;
  box-shadow:var(--shadow);
}

.zonesMapError{
  position:absolute;
  z-index:500;
  top:18px;
  left:18px;
  max-width:360px;
  padding:12px 14px;
  border:1px solid #ffb4a9;
  border-radius:8px;
  background:#fff3f1;
  color:#b42318;
  font-weight:900;
}

.devMode{
  margin:8px 0 0;
  padding:8px 10px;
  border:1px solid #b9ebca;
  border-radius:8px;
  background:#effaf5;
  color:#0f6b4b;
  font-size:12px;
  font-weight:900;
}

.agencyMarker{
  display:grid;
  width:22px;
  height:22px;
  place-items:center;
  border:3px solid #fff;
  border-radius:999px;
  background:var(--green);
  box-shadow:0 7px 18px rgba(0,82,143,.25);
}

.agencyMarker::after{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  background:#fff;
}

.agencyMapLabel{
  border:0;
  border-radius:7px;
  padding:5px 8px;
  background:#fff;
  color:#12284c;
  box-shadow:0 8px 18px rgba(0,82,143,.14);
  font:800 12px/1.1 Poppins,system-ui,sans-serif;
}

.agencyMapLabel::before{
  display:none;
}

.leaflet-popup-content{
  min-width:180px;
  margin:12px;
  color:var(--text);
  font-family:inherit;
}

.leaflet-popup-content b{
  color:var(--brand);
}

.matchResult{
  padding:10px;
  border:1px solid #b9ebca;
  border-radius:8px;
  background:#effaf5;
  color:#0f6b4b;
  font-size:12px;
  font-weight:800;
}

@media (max-width:900px){
  .zonesPage{
    grid-template-columns:1fr;
  }
  .zonesSidebar{
    position:relative;
    border-right:0;
    border-bottom:1px solid var(--line);
  }
  .zonesMapWrap{
    min-height:70vh;
  }
  .zonesMap{
    height:70vh;
    min-height:520px;
  }
}
