*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: #1a1a1a;
  background: #f0f2f5;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.muted {
  color: #5c5c5c;
  margin: 0 0 1.25rem;
}

.panel .hint {
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.error {
  color: #b00020;
  margin: 0 0 1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-bottom: 1rem;
  font: inherit;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
}

.card form button[type="submit"] {
  width: 100%;
  background: #c41e3a;
  color: #fff;
  font-weight: 600;
}

.card form button[type="submit"]:hover {
  background: #a01830;
}

a.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 1rem;
  margin-top: 0.25rem;
  background: #fff;
  color: #3c4043;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid #dadce0;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

a.btn-google:hover {
  background: #f8f9fa;
  border-color: #d2d2d2;
}

.btn-google-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.map-page {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr 300px;
  grid-template-areas:
    "header header"
    "map panel";
  height: 100vh;
  overflow: hidden;
}

@media (max-width: 800px) {
  .map-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto 200px 1fr;
    grid-template-areas:
      "header"
      "panel"
      "map";
  }
}

.toolbar {
  grid-area: header;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.65rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
}

.toolbar-title {
  font-weight: 700;
  margin-right: auto;
}

.toolbar-user {
  color: #444;
  font-size: 0.95rem;
}

.inline {
  margin: 0;
}

.btn-primary {
  background: #c41e3a;
  color: #fff;
  font-weight: 600;
  width: 100%;
  margin-bottom: 0.5rem;
}

.btn-primary:hover {
  background: #a01830;
}

.btn-secondary {
  background: #e8e8e8;
  color: #222;
}

.btn-secondary:hover {
  background: #ddd;
}

#map {
  grid-area: map;
  min-height: 0;
  z-index: 0;
}

.panel {
  grid-area: panel;
  background: #fff;
  border-left: 1px solid #e0e0e0;
  padding: 1rem;
  overflow-y: auto;
}

@media (max-width: 800px) {
  .panel {
    border-left: none;
    border-bottom: 1px solid #e0e0e0;
  }
}

.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.panel-section-title {
  margin: 1.25rem 0 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e8e8e8;
  font-size: 1.1rem;
}

.status {
  min-height: 1.4em;
  font-size: 0.9rem;
  color: #333;
  margin: 0 0 0.75rem;
}

.user-marker {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 32px;
  height: 40px;
}

.user-marker-draggable {
  cursor: grab;
}

.user-marker-draggable:active {
  cursor: grabbing;
}

.user-marker-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.user-marker-self .user-marker-dot {
  width: 18px;
  height: 18px;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.35);
}

.user-marker-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-bottom: 2px;
}

.barycenter-marker-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 36px;
  height: 44px;
}

.barycenter-marker-star {
  width: 22px;
  height: 22px;
  background: #0d9488;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.barycenter-marker-wrap .user-marker-label {
  max-width: 140px;
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}

.custom-pin-marker {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 32px;
  height: 40px;
}

.custom-pin-diamond {
  width: 14px;
  height: 14px;
  background: #6d28d9;
  border: 2px solid #fff;
  transform: rotate(45deg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  margin-bottom: 4px;
}

.leaflet-popup-content .popup-muted {
  color: #666;
  font-size: 0.85rem;
}

.custom-pins-list {
  margin-top: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}

.custom-pin-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.custom-pin-row:last-child {
  border-bottom: none;
}

.custom-pin-row-title {
  font-weight: 600;
}

.custom-pin-row-meta {
  color: #666;
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.btn-delete-pin {
  margin-top: 0.4rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font: inherit;
}

.btn-delete-pin:hover {
  background: #fecaca;
}

.admin-positions-list {
  margin-top: 0.35rem;
  max-height: 200px;
  overflow-y: auto;
}

.admin-pos-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.88rem;
}

.admin-pos-row:last-child {
  border-bottom: none;
}

.admin-pos-label {
  word-break: break-all;
  flex: 1;
  min-width: 0;
}

button.btn-delete-pos {
  flex-shrink: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  background: #fef3c7;
  color: #92400e;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

button.btn-delete-pos:hover {
  background: #fde68a;
}
