:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #e5e3dd;
  --text-primary: #1a1a1a;
  --text-secondary: #6b6b6b;
  --accent: #1e7a5f;
  --accent-light: #e8f5f0;
  --sidebar-w: 320px;
  --topbar-h: 64px;
  --radius: 10px;
}

[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2e2e2e;
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --accent: #2fd4a5;
  --accent-light: #16352c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.logo span { color: var(--accent); }

.btn-add {
  margin-left: auto;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-add:hover { opacity: 0.9; }
.btn-add strong { text-transform: uppercase; }

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
}

.layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
}

.sidebar h2 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#cat-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 12px;
}

.cat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.1s;
}
.cat-item:hover { background: var(--bg); }
.cat-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

.cat-item .count {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}
.cat-item.active .count { background: var(--accent); color: #fff; }

.map-area {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
}

.popup-card { min-width: 200px; }
.popup-card h3 { font-size: 15px; margin-bottom: 4px; }
.popup-card p { font-size: 13px; color: #555; margin-bottom: 2px; }
.popup-card a {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 768px) {
  .sidebar { position: absolute; z-index: 1000; height: 100%; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
}
