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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f0f0f;
  color: #e5e5e5;
  height: 100vh;
  display: grid;
  grid-template-rows: 48px 1fr;
  grid-template-columns: 280px 1fr;
  grid-template-areas:
    "header header"
    "sidebar map";
}

/* Header */
header {
  grid-area: header;
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

header h1 span {
  color: #3b82f6;
}

#stats-bar {
  display: flex;
  gap: 1.2rem;
  font-size: 0.8rem;
  color: #888;
}

.stat {
  font-family: monospace;
}

/* Sidebar */
#sidebar {
  grid-area: sidebar;
  background: #141414;
  border-right: 1px solid #2a2a2a;
  padding: 1rem;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 1.2rem;
}

.sidebar-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #222;
}

.sidebar-section label {
  display: block;
  font-size: 0.85rem;
  padding: 0.3rem 0;
  cursor: pointer;
  color: #bbb;
}

.sidebar-section label:hover {
  color: #fff;
}

.sidebar-section input[type="checkbox"] {
  margin-right: 0.5rem;
  accent-color: #3b82f6;
}

#info-panel {
  font-size: 0.85rem;
  line-height: 1.5;
}

#info-panel .muted {
  color: #555;
  font-style: italic;
}

#info-panel .detail {
  margin-bottom: 0.4rem;
}

#info-panel .detail-label {
  color: #888;
  font-size: 0.75rem;
  text-transform: uppercase;
}

#info-panel .detail-value {
  color: #e5e5e5;
}

#info-panel .badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}

#info-panel .badge-apa {
  background: #f59e0b22;
  color: #f59e0b;
}

#info-panel .badge-dd {
  background: #3b82f622;
  color: #3b82f6;
}

#info-panel .badge-other {
  background: #6b728022;
  color: #9ca3af;
}

#api-status {
  font-size: 0.8rem;
}

#api-status .ok {
  color: #22c55e;
}

#api-status .error {
  color: #ef4444;
}

/* Map */
#map {
  grid-area: map;
  background: #0a0a0a;
}

/* Leaflet overrides */
.leaflet-popup-content-wrapper {
  background: #1a1a1a;
  color: #e5e5e5;
  border: 1px solid #333;
  border-radius: 6px;
}

.leaflet-popup-tip {
  background: #1a1a1a;
}

.leaflet-popup-content {
  font-size: 0.85rem;
  line-height: 1.5;
}

.leaflet-popup-content strong {
  color: #fff;
}

.leaflet-popup-content .popup-desc {
  color: #aaa;
  font-size: 0.8rem;
  margin-top: 0.3rem;
  max-width: 250px;
}

.leaflet-popup-content a {
  color: #3b82f6;
}

/* Custom marker */
.leaflet-marker-icon {
  transition: transform 0.15s;
}

.leaflet-marker-icon:hover {
  transform: scale(1.3);
}

/* Legend */
.legend {
  background: #1a1a1a;
  border: 1px solid #333;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #aaa;
  line-height: 1.8;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Match panel */
.match-category {
  margin-bottom: 0.6rem;
}

.match-cat-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: #FF6B35;
  text-transform: capitalize;
  margin-bottom: 0.3rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid #222;
}

.match-artisan {
  padding: 0.3rem 0;
  border-bottom: 1px solid #1a1a1a;
  position: relative;
}

.match-artisan:last-child {
  border-bottom: none;
}

.match-artisan-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e5e5e5;
}

.match-artisan-addr {
  font-size: 0.7rem;
  color: #888;
}

.match-artisan-tel {
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.match-artisan-tel a {
  color: #22c55e;
  text-decoration: none;
}

.match-artisan-tel a:hover {
  text-decoration: underline;
}

.match-artisan-dist {
  position: absolute;
  top: 0.3rem;
  right: 0;
  font-size: 0.65rem;
  color: #FF6B35;
  font-weight: 600;
}
