* {
  box-sizing: border-box;
  border-radius: 0 !important;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  color: #1a1a1a;
}

#map {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}

/* ---- Leaflet overrides: no rounded corners anywhere ---- */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip,
.leaflet-bar,
.leaflet-bar a,
.leaflet-control-zoom,
.leaflet-control-attribution {
  border-radius: 0 !important;
}
.leaflet-popup-tip {
  display: none;
}

/* ---- Legend / toggle panel ---- */
#panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  width: 260px;
  max-height: calc(100vh - 24px);
  background: #ffffff;
  border: 1px solid #333333;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
}

#panel-header {
  background: #1a1a1a;
  color: #ffffff;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: default;
}

#panel-toggle {
  background: transparent;
  border: 1px solid #ffffff;
  color: #ffffff;
  width: 20px;
  height: 20px;
  line-height: 1;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}
#panel-toggle:hover {
  background: #333333;
}

#panel-body {
  padding: 8px 10px 10px 10px;
  overflow-y: auto;
}

#panel.collapsed #panel-body {
  display: none;
}

#legend-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
#legend-actions button {
  flex: 1;
  border: 1px solid #999999;
  background: #f2f2f2;
  padding: 4px 0;
  cursor: pointer;
  font-size: 12px;
}
#legend-actions button:hover {
  background: #e2e2e2;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 2px;
  border-bottom: 1px solid #eeeeee;
  cursor: pointer;
  user-select: none;
}
.legend-row:last-child {
  border-bottom: none;
}
.legend-row input {
  margin: 0;
  cursor: pointer;
  flex: none;
}
.legend-swatch {
  width: 14px;
  height: 14px;
  flex: none;
  border: 1px solid rgba(0,0,0,0.35);
}
.legend-label {
  flex: 1;
  line-height: 1.25;
}
.legend-code {
  color: #666666;
  font-size: 11px;
}
.legend-row.dimmed .legend-label,
.legend-row.dimmed .legend-code {
  color: #b0b0b0;
}
.legend-row.dimmed .legend-swatch {
  opacity: 0.25;
}

#panel-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #dddddd;
  font-size: 11px;
  color: #555555;
}

/* ---- Info / popup panel (click on a segment) ---- */
#info-box {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1000;
  width: 300px;
  background: #ffffff;
  border: 1px solid #333333;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.25);
}
#info-box.hidden {
  display: none;
}
#info-header {
  background: #1a1a1a;
  color: #ffffff;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
#info-close {
  background: transparent;
  border: 1px solid #ffffff;
  color: #ffffff;
  width: 20px;
  height: 20px;
  line-height: 1;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}
#info-close:hover {
  background: #333333;
}
#info-body {
  padding: 10px;
}
#info-body table {
  width: 100%;
  border-collapse: collapse;
}
#info-body td {
  padding: 3px 4px;
  vertical-align: top;
  font-size: 12.5px;
}
#info-body td.k {
  color: #666666;
  white-space: nowrap;
  width: 40%;
}
#info-body td.v {
  font-weight: 600;
}
#info-swatch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dddddd;
}
#info-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(0,0,0,0.35);
  flex: none;
}
