:root {
  color-scheme: light;
  --ink: #0b1a17;
  --ink-2: #1c2c27;
  --muted: #60706a;
  --line: #d8e0da;
  --line-strong: #b8c5be;
  --surface: #ffffff;
  --surface-soft: #f7f8f6;
  --surface-2: #edf2ee;
  --accent: #1b7f5f;
  --accent-dark: #0e5d44;
  --accent-soft: #d6efe2;
  --gold: #a66a00;
  --gold-soft: #fff1c2;
  --coral: #c44727;
  --sky-soft: #e4f2ff;
  --danger: #b91c1c;
  --danger-soft: #fde2e2;
  --verified: #1d9bf0;
  --shadow-sm: 0 4px 14px rgba(11, 26, 23, 0.08);
  --shadow: 0 22px 60px rgba(11, 26, 23, 0.2);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 8px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: linear-gradient(180deg, #f9faf8 0%, var(--surface-soft) 100%);
  color: var(--ink);
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }

.button-reset { appearance: none; background: none; border: 0; margin: 0; padding: 0; }

/* Topbar */
.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 64px;
  justify-content: space-between;
  left: 0;
  padding: 0 max(16px, env(safe-area-inset-left));
  position: fixed;
  right: 0;
  top: 0;
  z-index: 900;
}
.brand {
  align-items: center;
  display: inline-flex;
  font-size: 1.05rem;
  font-weight: 800;
  gap: 10px;
  letter-spacing: 0;
}
.brand-mark {
  background: conic-gradient(from 210deg, var(--accent), #1d9bf0, var(--gold), var(--accent));
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(27, 127, 95, 0.35);
  display: inline-block;
  height: 28px;
  position: relative;
  width: 28px;
}
.brand-mark::after {
  content: "";
  background: var(--surface);
  border-radius: 50%;
  display: block;
  height: 8px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
}
.topbar nav { align-items: center; display: flex; gap: 10px; }
.topbar form { margin: 0; }

.user-pill {
  align-items: center;
  background: rgba(237, 242, 238, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-dark);
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  max-width: 160px;
  padding: 7px 12px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.user-pill:hover { background: #e1ebe4; border-color: var(--line-strong); }
.user-pill:active { transform: scale(0.97); }
.user-pill__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.verified-badge {
  flex: 0 0 18px;
  height: 18px;
  width: 18px;
}

/* Buttons */
.primary-button, .ghost-button, .icon-button {
  border: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 18px rgba(27, 127, 95, 0.28);
  color: white;
  font-weight: 750;
  min-height: 46px;
  padding: 12px 18px;
}
.primary-button:hover { box-shadow: 0 8px 22px rgba(27, 127, 95, 0.34); }
.primary-button:active { transform: translateY(1px); }
.primary-button.compact, .ghost-button { min-height: 38px; padding: 9px 14px; }
.ghost-button {
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--accent-dark);
  font-weight: 700;
}
.ghost-button:hover { background: var(--surface-2); }
.primary-button--disabled, .primary-button:disabled {
  background: var(--surface-2);
  box-shadow: none;
  color: var(--muted);
  cursor: not-allowed;
}
.danger-button {
  background: var(--danger);
  border: 0;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  font-weight: 750;
  min-height: 38px;
  padding: 9px 14px;
}
.danger-button:hover { background: #921515; }
.icon-button {
  align-items: center;
  background: var(--ink);
  border-radius: 50%;
  color: white;
  display: inline-flex;
  flex: 0 0 38px;
  font-size: 1.2rem;
  height: 38px;
  justify-content: center;
  width: 38px;
}
.icon-button:hover { background: var(--ink-2); }
.icon-button--danger { background: var(--danger); }
.icon-button--danger:hover { background: #921515; }

.link-button {
  background: none;
  border: 0;
  color: var(--accent-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.link-button:hover { background: var(--accent-soft); }
.link-button:disabled { color: var(--muted); cursor: default; background: transparent; }
.link-button--danger { color: var(--danger); }
.link-button--danger:hover { background: var(--danger-soft); }

/* App shell */
.app-shell { height: 100dvh; padding-top: 64px; position: relative; }
#map { height: calc(100dvh - 64px); width: 100%; z-index: 1; background: #d9e2d7; }
.leaflet-tile-pane { filter: saturate(0.86) contrast(0.96) brightness(1.03); }
.heat-halo { filter: blur(10px); mix-blend-mode: multiply; }
.leaflet-control-zoom {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-sm) !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  border: 0 !important;
  color: var(--ink) !important;
}

.report-panel, .place-sheet, .auth-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.report-panel {
  border-radius: var(--radius);
  bottom: 18px;
  left: 18px;
  max-height: calc(100dvh - 96px);
  overflow: auto;
  padding: 18px;
  position: fixed;
  width: min(440px, calc(100vw - 36px));
  z-index: 800;
  animation: slide-up 0.32s ease;
}
.panel-head, .sheet-header { align-items: center; display: flex; justify-content: space-between; gap: 12px; }
.sheet-header__actions { align-items: center; display: inline-flex; gap: 8px; }

.eyebrow {
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
  text-transform: uppercase;
}
h1, h2, p { margin-top: 0; }
h1 { font-size: 1.4rem; line-height: 1.18; margin-bottom: 0; }
h2 { font-size: 1.2rem; margin-bottom: 0; }
.account-name { align-items: center; display: inline-flex; gap: 6px; }
.muted, .form-message { color: var(--muted); font-size: 0.92rem; line-height: 1.4; margin: 10px 0; }
.role-line { margin-top: 4px; }

.selection-pill {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent-dark);
  display: inline-flex;
  font-size: 0.86rem;
  font-weight: 750;
  margin: 0 0 12px;
  padding: 7px 11px;
}

.review-form, .auth-form { display: grid; gap: 12px; }
label, .field-label {
  color: var(--ink);
  display: grid;
  font-weight: 700;
  gap: 6px;
}
.field-label { font-size: 0.92rem; }
.question-block { display: grid; gap: 4px; }

input, textarea {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}
input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27, 127, 95, 0.18);
  outline: none;
}
textarea { resize: vertical; min-height: 92px; }
input[type="range"] {
  accent-color: var(--accent);
  background: linear-gradient(90deg, #44ad73, #e5c84b, var(--coral), var(--danger));
  border: 0;
  border-radius: 999px;
  height: 7px;
  padding: 0;
}

.slider-label {
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0;
}

.place-sheet {
  animation: slide-in 0.32s ease;
  border-radius: var(--radius) 0 0 var(--radius);
  bottom: 0;
  max-width: 460px;
  overflow: auto;
  padding: 18px;
  position: fixed;
  right: 0;
  top: 64px;
  width: min(460px, 100vw);
  z-index: 850;
}

.reviews { display: grid; gap: 12px; margin-top: 18px; }
.review {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.review:hover { box-shadow: var(--shadow-sm); }
.review header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.review-author { align-items: center; display: inline-flex; gap: 6px; }
.score {
  border-radius: 999px;
  color: white;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 9px;
  white-space: nowrap;
}
.review-scores { display: grid; gap: 6px; margin: 10px 0 12px; }
.score-row { align-items: center; display: flex; justify-content: space-between; gap: 10px; font-size: 0.9rem; }
.score-row strong { color: var(--accent-dark); font-weight: 800; }
.role-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 8px;
  white-space: nowrap;
}
.role-chip--verified_user { background: var(--sky-soft); border-color: #b8dcff; color: #0b5c91; }
.role-chip--staff { background: var(--gold-soft); border-color: #f2d47b; color: var(--gold); }
.role-chip--admin { background: #f1e8ff; border-color: #d6c2ff; color: #5f35a5; }
.role-chip--user { background: var(--surface-soft); }

.review-footer {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 10px;
}
.vote-row { display: flex; gap: 6px; }
.vote-row button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  min-height: 36px;
  padding: 7px 10px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.vote-row button:hover { background: var(--accent-soft); }
.vote-row button.active { background: var(--accent); border-color: var(--accent-dark); color: white; }
.review-actions { display: inline-flex; gap: 4px; }

.account-backdrop {
  background: rgba(8, 14, 12, 0.28);
  border: 0;
  inset: 0;
  position: fixed;
  z-index: 920;
  animation: fade-in 0.2s ease;
}
.account-drawer {
  animation: slide-in 0.28s ease;
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid var(--line);
  border-radius: var(--radius) 0 0 var(--radius);
  box-shadow: var(--shadow);
  max-height: calc(100dvh - 78px);
  overflow: auto;
  padding: 18px;
  position: fixed;
  right: 18px;
  top: 74px;
  width: min(430px, calc(100vw - 36px));
  z-index: 930;
}
.account-drawer__head, .account-actions, .account-reviews-head { align-items: center; display: flex; justify-content: space-between; gap: 12px; }
.account-actions { align-items: flex-start; margin: 14px 0 18px; }
.account-actions form { margin: 0; }

.account-stats { margin-top: 14px; }
.stat-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); display: grid; gap: 6px; padding: 12px; }
.stat-card span { color: var(--muted); font-size: 0.74rem; font-weight: 700; text-transform: uppercase; }
.stat-card strong { color: var(--accent-dark); font-size: 1.2rem; }

.account-reviews { display: grid; gap: 12px; }
.account-review { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.account-review__title {
  background: none;
  border: 0;
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
  margin-bottom: 8px;
  padding: 0;
  text-align: left;
}
.account-review__title:hover { text-decoration: underline; }
.account-review__meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  justify-content: space-between;
  margin-top: 10px;
}

.moderation-panel {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}
.moderation-users {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.moderation-user {
  align-items: center;
  background: rgba(247, 248, 246, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
}
.moderation-user.is-banned { background: #fff7f7; border-color: #fecaca; }
.moderation-user__name { align-items: center; display: flex; flex-wrap: wrap; gap: 7px; }
.moderation-user__meta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  margin: 6px 0 0;
}

.auth-shell { display: grid; min-height: 100dvh; padding: 96px 18px 32px; place-items: center; }
.auth-card { border-radius: var(--radius); max-width: 420px; padding: 24px; width: 100%; animation: slide-up 0.32s ease; }
.auth-link { color: var(--accent-dark); display: inline-block; font-weight: 700; margin-top: 16px; }
.auth-link:hover { text-decoration: underline; }

.flash-stack {
  left: 50%;
  position: fixed;
  top: 74px;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 28px));
  z-index: 1000;
}
.flash {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin: 0 0 8px;
  padding: 12px 14px;
}
.flash.error { border-color: #fecaca; color: #991b1b; background: #fff5f5; }

.toast-stack {
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  left: 50%;
  position: fixed;
  transform: translateX(-50%);
  z-index: 1100;
}
.toast {
  background: var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  color: white;
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
  max-width: min(420px, calc(100vw - 32px));
  opacity: 0;
  padding: 11px 16px;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--success { background: var(--accent-dark); }
.toast--error { background: var(--danger); }
.toast--info { background: var(--ink); }

.rate-limit {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-top: 14px;
  padding: 12px;
}
.rate-limit__head { align-items: center; display: flex; justify-content: space-between; }
.rate-limit__title { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; }
.rate-limit__count { color: var(--accent-dark); font-weight: 800; }
.rate-limit__bar {
  background: white;
  border-radius: 999px;
  height: 6px;
  margin: 8px 0;
  overflow: hidden;
}
.rate-limit__bar > span {
  background: var(--accent);
  border-radius: inherit;
  display: block;
  height: 100%;
  transition: width 0.3s ease;
}
.rate-limit__fill--full { background: var(--danger) !important; }
.rate-limit__hint { color: var(--muted); font-size: 0.82rem; margin: 0; }

.leaflet-popup-content { margin: 12px; }

@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 720px) {
  body { overflow: hidden; }
  .topbar { height: 58px; }
  .brand { font-size: 1rem; }
  .topbar nav { gap: 6px; }
  .ghost-button, .primary-button.compact { padding: 8px 10px; }
  .app-shell { padding-top: 58px; }
  #map { height: calc(100dvh - 58px); }
  .report-panel {
    border-radius: var(--radius) var(--radius) 0 0;
    bottom: 0;
    left: 0;
    max-height: 64dvh;
    width: 100vw;
  }
  .account-drawer {
    border-radius: var(--radius) var(--radius) 0 0;
    bottom: 0;
    left: 0;
    max-height: 78dvh;
    right: 0;
    top: auto;
    width: 100vw;
  }
  .stat-grid { grid-template-columns: 1fr; }
  .place-sheet {
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 80dvh;
    top: auto;
  }
}
