:root{
  --bg:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --accent:#2563eb;

  --card:#ffffff;
  --border:#e5e7eb;
  --soft:#f3f4f6;

  --footer-h:56px;
  --header-h:98px;

  --shadow:0 10px 28px rgba(0,0,0,0.08);
  --radius:16px;
}

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

html,
body{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}

body{
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  min-height:100vh;
  overflow-y:auto;
}

body.portal-page{
  overflow:auto;
}

/* ===== HEADER ===== */
.site-header{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:1000;
  background:#fff;
  box-shadow:0 8px 25px rgba(0,0,0,0.08);
}

.header-inner{
  width:100%;
  min-height:var(--header-h);
  padding:16px 20px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
}

.brand{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  text-decoration:none;
  color:inherit;
  min-width:0;
  flex-wrap:wrap;
  text-align:center;
}

.brand-logo{
  height:65px;
  width:auto;
  display:block;
}

.brand-title{
  font-size:1.6rem;
  font-weight:900;
  line-height:1.1;
}

.calendar-icon{
  font-size:26px;
  line-height:1;
}

/* ===== NAV ===== */
.nav{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:center;
  width:100%;
}

.nav-link{
  text-decoration:none;
  color:#111;
  padding:10px 16px;
  border-radius:999px;
  font-weight:600;
  transition:0.18s ease;
  white-space:nowrap;
}

.nav-link:hover{
  background:var(--soft);
}

.nav-link.active{
  background:var(--accent);
  color:#fff;
}

.nav-web{
  text-decoration:none;
  font-size:20px;
  padding:8px 12px;
  border-radius:999px;
  transition:0.18s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
}

.nav-web:hover{
  background:var(--soft);
}

/* ===== APP LAYOUT ===== */
.app{
  display:flex;
  align-items:stretch;
  gap:0;
  margin-top:var(--header-h);
  min-height:calc(100vh - var(--header-h) - var(--footer-h));
}

.map-sidebar{
  width:300px;
  min-width:300px;
  padding:12px;
  flex-shrink:0;
}

#map{
  width:100%;
  height:100%;
  min-height:420px;
  border-radius:14px;
  overflow:hidden;
}

.right-panel{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
}

.panel-header{
  padding:18px;
  background:#fff;
}

.location-title{
  text-align:center;
  font-weight:700;
  margin-bottom:12px;
  font-size:1.05rem;
}

.location-buttons{
  display:flex;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
}

.location-buttons button{
  padding:10px 18px;
  border-radius:999px;
  background:#fff;
  font-weight:600;
  cursor:pointer;
  border:1px solid var(--border);
  transition:0.18s ease;
}

.location-buttons button:hover{
  background:var(--soft);
}

.location-buttons button.active{
  background:var(--accent);
  color:#fff;
  border-color:transparent;
}

.widget-panel{
  flex:1;
  overflow-y:auto;
  padding:20px;
}

.widget{
  display:none;
  max-width:900px;
  width:100%;
  margin:0 auto;
}

.widget.active{
  display:block;
}

cnct-widget-loader{
  display:block;
  width:100%;
  max-width:100%;
}

/* ===== LEAFLET FIX ===== */
.leaflet-top,
.leaflet-bottom{
  z-index:400;
}

.leaflet-control-zoom{
  margin-top:12px !important;
  margin-left:12px !important;
}

/* ===== MODAL ===== */
.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.45);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:2000;
  padding:16px;
}

.modal{
  width:min(100%, 520px);
  background:#fff;
  border-radius:20px;
  box-shadow:var(--shadow);
  overflow:hidden;
}

.modal-header{
  padding:18px 20px;
  border-bottom:1px solid var(--border);
  font-size:1.1rem;
  font-weight:700;
}

.modal-body{
  padding:20px;
}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:12px;
  padding:16px 20px 20px;
}

.modal-btn{
  border:none;
  border-radius:12px;
  padding:12px 18px;
  cursor:pointer;
  font-weight:700;
}

.modal-btn.primary{
  background:var(--accent);
  color:#fff;
}

.modal-btn.secondary{
  background:var(--soft);
  color:var(--text);
}

/* ===== FOOTER ===== */
.site-footer{
  height:var(--footer-h);
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  box-shadow:0 -6px 20px rgba(0,0,0,0.05);
  padding:0 16px;
  text-align:center;
}

/* ===== TABLET ===== */
@media (max-width: 980px){
  :root{
    --header-h:170px;
  }

  .header-inner{
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:14px 16px;
    gap:12px;
  }

  .brand{
    width:100%;
    justify-content:center;
  }

  .brand-logo{
    height:52px;
  }

  .brand-title{
    font-size:1.2rem;
  }

  .nav{
    width:100%;
    justify-content:center;
    gap:8px;
  }

  .nav-link{
    padding:10px 14px;
    font-size:0.95rem;
  }

  .app{
    flex-direction:column;
    min-height:auto;
  }

  .map-sidebar{
    width:100%;
    min-width:0;
    padding:12px 12px 0 12px;
  }

  #map{
    height:320px;
    min-height:320px;
  }

  .right-panel{
    width:100%;
    min-width:0;
  }

  .panel-header{
    padding:16px 12px;
  }

  .location-title{
    font-size:1rem;
    line-height:1.4;
  }

  .location-buttons{
    justify-content:flex-start;
    gap:10px;
  }

  .location-buttons button{
    flex:1 1 calc(50% - 10px);
    min-width:140px;
  }

  .widget-panel{
    overflow:visible;
    padding:12px;
  }

  .widget{
    max-width:100%;
  }

  .site-footer{
    min-height:var(--footer-h);
    height:auto;
    padding:14px 16px;
  }
}

/* ===== MOBILE ===== */
@media (max-width: 640px){
  :root{
    --header-h:190px;
  }

  .header-inner{
    padding:12px;
    gap:10px;
  }

  .brand{
    gap:8px;
  }

  .brand-logo{
    height:46px;
  }

  .brand-title{
    font-size:1.05rem;
  }

  .calendar-icon{
    font-size:22px;
  }

  .nav{
    gap:8px;
  }

  .nav-link{
    font-size:0.9rem;
    padding:9px 12px;
  }

  .nav-web{
    width:40px;
    height:40px;
    padding:0;
  }

  .map-sidebar{
    padding:16px 10px 0 10px;
  }

  #map{
    height:260px;
    min-height:260px;
    border-radius:12px;
  }

  .leaflet-top .leaflet-control{
    margin-top:18px !important;
  }

  .leaflet-left .leaflet-control{
    margin-left:12px !important;
  }

  .panel-header{
    padding:14px 10px;
  }

  .location-buttons{
    flex-direction:column;
    align-items:stretch;
  }

  .location-buttons button{
    width:100%;
    min-width:0;
    flex:none;
  }

  .widget-panel{
    padding:10px;
  }

  .modal{
    width:100%;
  }

  .modal-actions{
    flex-direction:column;
  }

  .modal-btn{
    width:100%;
  }
}