* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; height: 100vh; overflow: hidden; }
#app { display: flex; height: 100vh; }

/* Sidebar */
.sidebar { width: 320px; background: #1a1a2e; color: #eee; display: flex; flex-direction: column; z-index: 10; transition: margin-left 0.3s; }
.sidebar.collapsed { margin-left: -320px; }
.sidebar-header { padding: 16px; border-bottom: 1px solid #333; }
.sidebar-header h2 { font-size: 18px; margin-bottom: 10px; }
.sidebar-header select { width: 100%; padding: 8px; border-radius: 4px; background: #16213e; color: #eee; border: 1px solid #444; }
.layer-tree { flex: 1; overflow-y: auto; padding: 12px; }
.layer-group { margin-bottom: 8px; }
.layer-group-header { font-weight: 600; padding: 6px 0; cursor: pointer; user-select: none; }
.layer-group-header::before { content: '▾ '; font-size: 12px; }
.layer-group.collapsed .layer-group-header::before { content: '▸ '; }
.layer-group.collapsed .layer-group-items { display: none; }
.layer-item { display: flex; align-items: center; gap: 8px; padding: 4px 0 4px 16px; }
.layer-item input[type="checkbox"] { accent-color: #4fc3f7; }
.layer-item label { cursor: pointer; font-size: 14px; flex: 1; }
.layer-item input[type="range"] { width: 60px; }
.sidebar-footer { padding: 12px; border-top: 1px solid #333; display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-footer button, .admin-link { padding: 6px 10px; background: #16213e; color: #eee; border: 1px solid #444; border-radius: 4px; cursor: pointer; font-size: 13px; text-decoration: none; }
.sidebar-footer button:hover, .admin-link:hover { background: #0f3460; }
.sidebar-footer button.active { background: #4fc3f7; color: #000; }

/* Sidebar toggle */
.sidebar-toggle { position: absolute; top: 10px; left: 10px; z-index: 20; background: #1a1a2e; color: #eee; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 18px; }
.sidebar:not(.collapsed) ~ .sidebar-toggle { left: 330px; }

/* Map */
.map { flex: 1; position: relative; }

/* Search */
.search-bar { position: absolute; top: 10px; right: 10px; z-index: 10; }
.search-bar input { padding: 10px 14px; width: 280px; border: 2px solid #ccc; border-radius: 20px; font-size: 14px; outline: none; }
.search-bar input:focus { border-color: #4fc3f7; }
.search-results { background: white; border-radius: 8px; margin-top: 4px; max-height: 250px; overflow-y: auto; box-shadow: 0 2px 12px rgba(0,0,0,0.15); }
.search-results div { padding: 10px 14px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #eee; }
.search-results div:hover { background: #f0f7ff; }

/* Basemap switcher */
.basemap-switcher { position: absolute; bottom: 20px; right: 10px; z-index: 10; display: flex; gap: 4px; }
.basemap-btn { padding: 8px 14px; background: white; border: 2px solid #ccc; border-radius: 4px; cursor: pointer; font-size: 13px; }
.basemap-btn.active { border-color: #4fc3f7; background: #e3f2fd; }

/* Popup */
.ol-popup { position: absolute; background: white; padding: 15px 20px; border-radius: 8px; box-shadow: 0 2px 16px rgba(0,0,0,0.2); min-width: 200px; max-width: 350px; max-height: 300px; overflow-y: auto; }
.ol-popup-closer { position: absolute; top: 4px; right: 8px; text-decoration: none; color: #666; font-size: 16px; }
.ol-popup table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ol-popup td { padding: 3px 6px; border-bottom: 1px solid #eee; }
.ol-popup td:first-child { font-weight: 600; color: #555; white-space: nowrap; }

/* Measure tooltip */
.measure-tooltip { position: absolute; background: rgba(0,0,0,0.7); color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px; pointer-events: none; z-index: 100; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 280px; position: absolute; height: 100vh; }
  .sidebar:not(.collapsed) ~ .sidebar-toggle { left: 290px; }
  .search-bar input { width: 200px; }
}
