:root {
  --bg: #12100e;
  --panel: #1c1917;
  --panel-border: #33302c;
  --text: #f2ede6;
  --text-dim: #a8a099;
  --accent: #e0692f;
  --accent-dim: #7a3d1e;
  --star-on: #e0b429;
  --star-off: #4a4540;
  --danger: #c0463a;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

#map {
  flex: 1;
  height: 100%;
}

header.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: linear-gradient(to bottom, rgba(18,16,14,0.9), rgba(18,16,14,0));
  pointer-events: none;
}

header.topbar h1 {
  font-size: 18px;
  margin: 0;
  pointer-events: auto;
  letter-spacing: 0.02em;
}

header.topbar .subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

header.topbar a.admin-link {
  pointer-events: auto;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  border: 1px solid var(--panel-border);
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(28,25,23,0.85);
}
header.topbar a.admin-link:hover { color: var(--text); border-color: var(--accent); }

#sidebar {
  width: 340px;
  min-width: 340px;
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar .sidebar-header {
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--panel-border);
}

#sidebar .sidebar-header h1 {
  margin: 0 0 4px;
  font-size: 18px;
}

#sidebar .sidebar-header p {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

#location-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.location-card {
  background: #221f1c;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.location-card:hover { border-color: var(--accent); }
.location-card.active { border-color: var(--accent); background: #2a2118; }

.location-card .name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.location-card .address {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.stars {
  display: inline-flex;
  gap: 2px;
  font-size: 14px;
}
.stars .on { color: var(--star-on); }
.stars .off { color: var(--star-off); }

.stars.interactive span {
  cursor: pointer;
  font-size: 22px;
}

.leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
}
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { margin: 12px 14px; min-width: 200px; }
.popup-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.popup-address { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.popup-details { font-size: 13px; margin: 8px 0; white-space: pre-wrap; }
.popup-actions { display: flex; gap: 8px; margin-top: 8px; }
.popup-actions button {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--panel-border);
  background: #2a2724;
  color: var(--text);
  cursor: pointer;
}
.popup-actions button:hover { border-color: var(--accent); }
.popup-actions button.danger:hover { border-color: var(--danger); color: var(--danger); }

/* --- Admin form panel --- */
#admin-panel {
  width: 360px;
  min-width: 360px;
  background: var(--panel);
  border-left: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px;
}

#admin-panel h1 { font-size: 18px; margin: 0 0 4px; }
#admin-panel .hint { font-size: 12px; color: var(--text-dim); margin: 0 0 16px; line-height: 1.5; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field textarea {
  width: 100%;
  padding: 8px 10px;
  background: #262220;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 70px; }
.field .coords { font-size: 12px; color: var(--text-dim); }

.btn-row { display: flex; gap: 8px; margin-top: 6px; }
button.primary {
  background: var(--accent);
  color: #1a1310;
  border: none;
  padding: 9px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  flex: 1;
}
button.primary:hover { background: #f07a3c; }
button.secondary {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
button.secondary:hover { color: var(--text); border-color: var(--accent); }

#admin-status {
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
  display: none;
}
#admin-status.show { display: block; }
#admin-status.ok { background: #1e3324; color: #7cc98a; }
#admin-status.err { background: #3a2020; color: #e08585; }

.locked-overlay {
  position: absolute;
  inset: 0;
  z-index: 2000;
  background: rgba(12,10,9,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}
.locked-box {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 24px;
  width: 280px;
  text-align: center;
}
.locked-box h2 { margin: 0 0 6px; font-size: 16px; }
.locked-box p { margin: 0 0 14px; font-size: 12px; color: var(--text-dim); }

.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
}
.admin-list-item:hover { border-color: var(--accent); }
.admin-list-item.active { border-color: var(--accent); background: #2a2118; }
.admin-list-item .name { font-weight: 600; }
.admin-list-item .mini-stars { font-size: 11px; color: var(--star-on); }
