:root {
  --topbar-h: 56px;
  --sidebar-w: 360px;
  --border: #e6e6e6;
  --bg: #ffffff;
  --bg2: #fafafa;
  --text: #111;
  --muted: #666;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
}

#app {
  height: 100%;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
}

#topbar {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

#topbar .title {
  font-weight: 650;
}

#main {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
}

#sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg2);
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

#controls {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controls-top,
.controls-filters,
.controls-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
}

.controls-top {
  justify-content: space-between;
}

.controls-top-left {
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}

.controls-top-right,
.controls-bottom-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls-search {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls-search label {
  flex: 0 0 auto;
}

.controls-search input {
  flex: 1 1 auto;
  min-width: 0;
}

.controls-search button {
  flex: 0 0 auto;
}

.controls-filters .field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls-filters .field.hdv {
  flex: 1 1 auto;
  min-width: 0;
}

.controls-filters .field.min-kw input {
  width: 72px;
}

.controls-clustering label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

label {
  font-size: 13px;
  color: var(--muted);
}

input[type="number"],
input[type="text"],
select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}

input[type="checkbox"] {
  transform: translateY(1px);
}

button {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: #f3f3f3;
}

button.compact {
  padding: 6px 10px;
}

.item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  cursor: pointer;
}

.item .name {
  font-weight: 650;
  margin-bottom: 4px;
}

.item .meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.item.selected {
  outline: 2px solid #111;
}

#mapWrap {
  position: relative;
  min-height: 0;
}

#map {
  height: 100%;
  width: 100%;
}

#clusteringToggleBtn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#clusteringToggleBtn:hover {
  background: #fff;
}

#clusteringToggleBtn.active {
  font-weight: 700;
}

#clusteringToggleBtn:disabled {
  opacity: 0.5;
  cursor: default;
}

#list {
  padding: 0 12px 10px 12px;
  overflow: auto;
  min-height: 0;
}

.controls-mobile-view {
  display: none;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.segmented button {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 8px;
}

.segmented button:hover {
  background: #f3f3f3;
}

.segmented button.active {
  background: #111;
  color: #fff;
}