:root {
  --bg: #0d120f;
  --surface: #ffffff;
  --surface-2: #fbfcf9;
  --surface-warm: #f5f7f1;
  --ink: #14201a;
  --ink-soft: #3c4a42;
  --muted: #77817a;
  --muted-soft: #a3aaa2;
  --accent: #1f4d38;
  --accent-2: #3a7a58;
  --lime: #8fd14f;
  --lime-2: #c8ef8a;
  --gold: #a9895f;
  --gold-soft: #f3e8d6;
  --border: rgba(20, 32, 26, 0.08);
  --border-strong: rgba(20, 32, 26, 0.14);
  --shadow-xs: 0 1px 2px rgba(13, 18, 15, 0.06), 0 1px 3px rgba(13, 18, 15, 0.04);
  --shadow-sm: 0 4px 16px -6px rgba(13, 18, 15, 0.18);
  --shadow-md: 0 12px 32px -12px rgba(13, 18, 15, 0.22);
  --shadow-lg: 0 30px 70px -20px rgba(10, 16, 12, 0.32);
  --shadow-glow: 0 8px 18px -10px rgba(31, 77, 56, 0.5);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --gradient-brand: var(--accent);
  --gradient-brand-soft: linear-gradient(135deg, rgba(143, 209, 79, 0.16), rgba(31, 77, 56, 0.12));
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--surface-warm);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-locked {
  overflow: hidden;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(20, 32, 26, 0.14);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 32, 26, 0.24);
  background-clip: content-box;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseRing {
  0% { transform: scale(0.85); opacity: 0.6; }
  70% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ============ Topbar ============ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.topbar-glow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(143, 209, 79, 0.7), rgba(31, 77, 56, 0.4), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 1;
  min-width: 0;
}

.topbar-actions > * {
  flex-shrink: 0;
}

.brand-icon {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-brand);
  color: #ffffff;
  box-shadow: 0 4px 14px -3px rgba(58, 122, 88, 0.6);
}

.brand-icon-pulse {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: var(--lime);
  animation: pulseRing 2.8s ease-out infinite;
  z-index: -1;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}

/* View switch */
.view-switch {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(20, 32, 26, 0.05);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}

.view-switch-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform 0.34s cubic-bezier(0.65, 0, 0.35, 1), width 0.34s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: 0;
}

.view-switch-btn {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 7px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.view-switch-btn:hover { color: var(--ink); }
.view-switch-btn.active { color: var(--accent); font-weight: 600; }

/* Export */
.export-wrap { position: relative; }

.export-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.export-btn svg { color: var(--accent-2); }
.export-btn:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }

.export-btn.primary {
  border: none;
  background: var(--gradient-brand);
  color: #ffffff;
  font-weight: 700;
  box-shadow: var(--shadow-glow);
}
.export-btn.primary svg { color: #ffffff; }
.export-btn.primary:hover { background: var(--accent-2); transform: translateY(-1px); box-shadow: 0 10px 24px -12px rgba(31, 77, 56, 0.56); }
.export-btn.primary:active { transform: translateY(0) scale(0.98); }

.export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 196px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 6px;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 1200;
}

.export-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.export-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.export-menu button:hover { background: var(--surface-warm); }

.admin-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  transition: color 0.25s ease, border-color 0.25s ease, transform 0.35s ease;
  flex-shrink: 0;
}

.admin-link:hover {
  color: var(--accent);
  border-color: var(--border-strong);
  transform: rotate(60deg);
}

.tree-count {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
  padding: 8px 6px;
  white-space: nowrap;
}

.tree-count::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(143, 209, 79, 0.22);
}

/* ============ Layout ============ */
.app-body {
  position: fixed;
  top: 68px;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  z-index: 1;
}

#map {
  flex: 1;
  height: 100%;
  min-width: 0;
}

.public-map-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
}

.public-map-toolbar {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(31, 77, 56, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 16px 34px rgba(31, 77, 56, 0.12);
  padding: 5px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.public-map-toolbar button {
  appearance: none;
  -webkit-appearance: none;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  padding: 8px 14px;
}

.public-map-toolbar button:hover,
.public-map-toolbar button.active {
  background: var(--surface-warm);
  color: var(--accent);
}

/* ============ Sidebar ============ */
.sidebar {
  width: 392px;
  flex-shrink: 0;
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 2;
  box-shadow: var(--shadow-sm);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-head {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-head-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-title {
  margin: 0;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.sidebar-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--gradient-brand-soft);
  border-radius: 999px;
}

.sidebar-subtitle {
  margin: 3px 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--surface-warm);
  border: 1.5px solid transparent;
  border-radius: 13px;
  color: var(--muted-soft);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sidebar-search:focus-within {
  background: var(--surface);
  border-color: var(--lime);
  box-shadow: 0 0 0 4px rgba(143, 209, 79, 0.16);
}

.sidebar-search svg { flex-shrink: 0; }

.sidebar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  width: 100%;
}

.sidebar-search input::placeholder { color: var(--muted-soft); }

.location-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.location-actions button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.location-actions button:hover,
.location-actions button.active {
  border-color: rgba(31, 77, 56, 0.24);
  background: rgba(31, 77, 56, 0.08);
  color: var(--accent);
}

.location-actions button:active {
  transform: scale(0.98);
}

.location-status {
  min-height: 17px;
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.location-status.error {
  color: #9f2f2f;
}

.distance-chip {
  color: var(--accent);
  background: rgba(31, 77, 56, 0.08);
}

.search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(20, 32, 26, 0.1);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.search-clear:hover { background: rgba(20, 32, 26, 0.18); color: var(--ink); }
.search-clear[hidden] { display: none; }

.tree-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Tree card */
.tree-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid transparent;
  opacity: 0;
  animation: fadeUp 0.42s ease forwards;
}

.tree-item:hover {
  background: var(--surface-2);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.tree-item.active {
  background: var(--gradient-brand-soft);
  border-color: rgba(143, 209, 79, 0.4);
}

.tree-item.active .tree-item-name { color: var(--accent); }

.tree-item-thumb {
  position: relative;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: 13px;
  overflow: hidden;
  background: var(--surface-warm);
  box-shadow: var(--shadow-xs);
}

.tree-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.tree-item:hover .tree-item-img { transform: scale(1.08); }

.tree-item-info {
  min-width: 0;
  flex: 1;
}

.tree-item-tag {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-item-name {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  transition: color 0.18s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-item-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tree-item-meta {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface-warm);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.chip svg { color: var(--accent-2); flex-shrink: 0; }

.tree-item-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-soft);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.tree-item:hover .tree-item-chevron,
.tree-item.active .tree-item-chevron {
  opacity: 1;
  transform: translateX(0);
}

.tree-item:nth-child(1) { animation-delay: 0.02s; }
.tree-item:nth-child(2) { animation-delay: 0.06s; }
.tree-item:nth-child(3) { animation-delay: 0.1s; }
.tree-item:nth-child(4) { animation-delay: 0.14s; }
.tree-item:nth-child(5) { animation-delay: 0.18s; }
.tree-item:nth-child(n+6) { animation-delay: 0.22s; }

/* Empty state */
.list-empty {
  text-align: center;
  padding: 48px 24px;
  animation: fadeUp 0.4s ease;
}

.list-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-warm);
  color: var(--muted-soft);
}

.list-empty-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.list-empty-text {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ============ View modes ============ */
.view-map .sidebar {
  width: 0;
  margin-left: -1px;
  border-right: none;
  overflow: hidden;
}

.view-list .public-map-wrap { display: none; }

.view-list .sidebar {
  width: 100%;
  border-right: none;
}

.view-list .sidebar-head {
  max-width: 1160px;
  margin: 0 auto;
  width: 100%;
  border-bottom: none;
  padding: 28px 32px 8px;
}

.view-list .tree-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  max-width: 1160px;
  margin: 0 auto;
  width: 100%;
  padding: 16px 32px 48px;
}

.view-list .tree-item {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.view-list .tree-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.view-list .tree-item.active {
  border-color: rgba(143, 209, 79, 0.5);
  box-shadow: var(--shadow-md);
}

.view-list .tree-item-thumb {
  width: 100%;
  height: 156px;
  border-radius: 0;
  box-shadow: none;
}

.view-list .tree-item-info { padding: 14px 16px 16px; }

.view-list .tree-item-desc { -webkit-line-clamp: 2; }

.view-list .tree-item-chevron { display: none; }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 11, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  padding: 24px;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(30px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-card { transform: translateY(0) scale(1); }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(13, 18, 15, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background 0.15s ease, transform 0.25s ease;
}

.modal-close:hover { background: rgba(13, 18, 15, 0.55); transform: rotate(90deg); }

.modal-image-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  background: var(--surface-warm);
}

.modal-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 7s ease;
}

.modal-overlay.open .modal-image { transform: scale(1.08); }

.modal-image-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 14, 10, 0.82) 0%, rgba(8, 14, 10, 0.28) 42%, rgba(8, 14, 10, 0) 72%);
  pointer-events: none;
}

.modal-hero {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 28px;
  z-index: 2;
}

.modal-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 5px 12px 5px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
}

.modal-tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(143, 209, 79, 0.3);
}

.modal-title {
  margin: 0;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
}

.modal-body {
  padding: 24px 28px 26px;
}

.modal-desc {
  margin: 0 0 22px;
  font-size: 14.5px;
  line-height: 1.68;
  color: var(--ink-soft);
}

.modal-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 16px 15px;
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.stat-icon {
  display: flex;
  align-items: center;
  color: var(--accent-2);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 10.5px;
  color: var(--muted-soft);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
}

.stat-value {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.modal-coords {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.modal-coords svg { color: var(--accent-2); flex-shrink: 0; }
.modal-coords span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal-locate {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.modal-locate:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.modal-locate:active { transform: translateY(0); }
.modal-locate svg { transition: transform 0.2s ease; }
.modal-locate:hover svg { transform: translateX(3px); }

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .topbar {
    padding: 0 16px;
    gap: 10px;
  }
  .topbar-actions { gap: 10px; }
  .brand-name { display: none; }
  .view-switch-btn { padding: 7px 11px; font-size: 11.5px; }
  .export-btn .btn-label,
  .tree-count .btn-label { display: none; }
  .export-btn { padding: 9px 12px; }
  .sidebar { width: 340px; }
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .topbar {
    height: 60px;
    padding: 0 12px;
    gap: 8px;
  }
  .topbar-actions { gap: 8px; }

  /* Segmented control: only Liste + Harita on mobile */
  .view-switch-btn[data-view="split"] { display: none; }
  .view-switch { padding: 3px; }
  .view-switch-btn { padding: 8px 14px; font-size: 12.5px; }

  .tree-count { display: none; }
  .export-btn { padding: 10px; }
  .admin-link { width: 38px; height: 38px; }
  .brand-icon { width: 34px; height: 34px; }

  .app-body { top: 60px; }

  /* Sidebar / list = full screen */
  .sidebar { width: 100%; border-right: none; box-shadow: none; }
  .view-split .sidebar,
  .view-list .sidebar { width: 100%; }

  .sidebar-head { padding: 18px 18px 14px; }
  .sidebar-title { font-size: 22px; }
  .sidebar-subtitle { margin-bottom: 14px; }

  /* Single-column cards on mobile list view */
  .view-list .sidebar-head { padding: 18px 18px 4px; }
  .view-list .tree-list {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 16px 40px;
  }
  .view-list .tree-item { flex-direction: row; align-items: center; }
  .view-list .tree-item-thumb {
    width: 66px;
    height: 66px;
    border-radius: 13px 0 0 13px;
    flex-shrink: 0;
  }
  .view-list .tree-item::before { display: none; }
  .view-list .tree-item-info { padding: 12px 14px 12px 0; }
  .view-list .tree-item-desc { -webkit-line-clamp: 1; }

  /* Map full screen when active */
  .view-map .public-map-wrap,
  .view-map #map { height: 100%; }
  .public-map-toolbar {
    top: 12px;
  }

  /* Larger touch targets in split/list rows */
  .tree-item { padding: 12px; }
  .tree-item-chevron { display: none; }

  /* Modal fills width, bottom-anchored feel */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-card {
    max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-overlay .modal-card { transform: translateY(100%); }
  .modal-overlay.open .modal-card { transform: translateY(0); }
  .modal-image-wrap { height: 240px; }
  .modal-body { padding: 22px 22px 28px; }
  .modal-title { font-size: 26px; }
  .modal-stats { gap: 10px; }
  .modal-footer { flex-direction: column; align-items: stretch; gap: 12px; }
  .modal-coords { justify-content: center; }
  .modal-locate { justify-content: center; padding: 13px 16px; }
}

@media (max-width: 380px) {
  .view-switch-btn { padding: 8px 11px; font-size: 12px; }
  .modal-stats { flex-direction: column; }
}
