:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.card,
.panel {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.hidden {
  display: none;
}

h1, h2, h3 {
  margin-top: 0;
}

label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
}

input {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
}

button {
  margin-top: 8px;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  background: #2563eb;
  color: white;
}

button:hover {
  background: #1d4ed8;
}

.inline-actions {
  display: flex;
  gap: 8px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.top-actions {
  margin-top: 4px;
  margin-bottom: 10px;
}

.search-results {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  max-height: 180px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.search-results:empty {
  display: none;
}

.search-results li {
  margin: 0;
}

.search-results button {
  width: 100%;
  text-align: left;
  margin: 0;
  border-radius: 0;
  background: white;
  color: #1f2937;
  border-bottom: 1px solid #e5e7eb;
}

.search-results li:last-child button {
  border-bottom: 0;
}

.search-results button:hover {
  background: #f3f4f6;
}

.error {
  color: #dc2626;
  min-height: 1.2em;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-panel {
  margin-bottom: 12px;
  position: relative;
}

#map {
  width: 100%;
  height: 520px;
  border-radius: 10px;
}

.recenter-overlay {
  position: absolute;
  top: 102px;
  left: 26px;
  z-index: 600;
  width: 34px;
  height: 34px;
  margin-top: 0;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: white;
  color: #111827;
  font-weight: 700;
  padding: 0;
}

.recenter-overlay:hover {
  background: #f3f4f6;
}

.hint {
  margin-top: -6px;
  color: #4b5563;
  font-size: 13px;
}

.nearby {
  margin-top: 0;
  margin-bottom: 12px;
}

.nearby ol {
  margin: 0;
  padding-left: 20px;
}

.nearby li {
  margin-bottom: 6px;
}

.nearby-item {
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 6px;
}

.nearby-item:hover {
  background: #eef2ff;
}

.nearby-item.active {
  background: #dbeafe;
  font-weight: 600;
}

.secondary {
  background: #6b7280;
}

.secondary:hover {
  background: #4b5563;
}

.danger {
  background: #dc2626;
}

.danger:hover {
  background: #b91c1c;
}

.clients-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-header h3 {
  margin-bottom: 0;
}

.client-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
}

.client-meta {
  display: grid;
  gap: 2px;
  font-size: 14px;
}

.client-actions {
  display: flex;
  gap: 6px;
}

.client-actions button {
  margin-top: 0;
}

.recenter-control button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-weight: bold;
}

.recenter-control button:hover {
  background: #f3f4f6;
}

.client-label {
  background: rgba(17, 24, 39, 0.88);
  color: white;
  border: 0;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  box-shadow: none;
  text-align: center;
  white-space: nowrap;
  max-width: none;
  pointer-events: none;
}

.leaflet-tooltip-top.client-label {
  margin-top: -8px;
}

.client-label:before {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

#clientMsg,
#pwdMsg {
  min-height: 1.2em;
  margin-top: 8px;
}

@media (max-width: 900px) {
  #map {
    height: 380px;
  }

  .recenter-overlay {
    top: 96px;
    left: 24px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
