:root {
  --ink: #142033;
  --teal: #0e5a6b;
  --accent: #d9822b;
  --line: #d7dee8;
  --paper: #f5f8f9;
  --muted: #52627a;
  --warn-bg: #fff4e5;
  --warn: #8a4b08;
  --font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  background: white;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  background: var(--teal);
  color: white;
  font-weight: 600;
}

button.secondary {
  background: white;
  color: var(--teal);
  border: 1px solid var(--teal);
}

button.small {
  padding: 0.25rem 0.7rem;
  font-size: 0.9rem;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.link-button {
  background: none;
  color: var(--teal);
  padding: 0;
  font-weight: 400;
  text-decoration: underline;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.75rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: white;
}

.wordmark {
  text-decoration: none;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.wordmark__name { color: var(--teal); }
.wordmark__map { color: var(--accent); }

.search {
  display: flex;
  flex: 1 1 16rem;
  min-width: 14rem;
  max-width: 38rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.search input {
  flex: 1;
  border: 0;
  padding: 0.55rem 0.7rem;
  font: inherit;
  min-width: 0;
}

.search button,
.icon-button {
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-weight: 400;
  padding: 0.55rem 0.75rem;
}

.add-button {
  background: var(--accent);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex-basis: 100%;
  align-items: center;
}

.kind select {
  font: inherit;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.chip:has(input:checked) {
  background: #e3f1f3;
  border-color: var(--teal);
  color: var(--teal);
}

.map-wrap {
  position: relative;
}

#map {
  height: calc(100vh - 6.5rem);
  min-height: 320px;
  background: var(--paper);
}

.map-page--detail #map {
  height: 42vh;
  min-height: 260px;
}

.loader,
.map-hint {
  position: absolute;
  z-index: 500;
  margin: 0;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(20, 32, 51, 0.15);
}

.loader {
  left: 3.4rem;
  top: 0.8rem;
  padding: 0.35rem 0.6rem;
}

.map-hint {
  left: 50%;
  top: 0.8rem;
  transform: translateX(-50%);
  max-width: min(28rem, calc(100% - 2rem));
  padding: 0.4rem 0.7rem;
  text-align: center;
  pointer-events: none;
}

.place-bar {
  position: absolute;
  z-index: 600;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 0.9rem;
  width: max-content;
  max-width: calc(100% - 2rem);
  padding: 0.6rem 0.9rem;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(20, 32, 51, 0.25);
}

.place-bar[hidden] { display: none; }

.leaflet-div-icon.pin,
.leaflet-div-icon.pin-cluster {
  background: transparent;
  border: 0;
}

.pin__svg {
  display: block;
  filter: drop-shadow(0 2px 2px rgba(20, 32, 51, 0.35));
}

.pin-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(20, 32, 51, 0.35);
  font-weight: 700;
  font-size: 0.85rem;
}

.map-legend {
  padding: 0.4rem 0.55rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(20, 32, 51, 0.18);
  font-size: 0.82rem;
  line-height: 1.35;
}

.map-legend div {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

@media (max-width: 640px) {
  .map-legend { display: none; }
  .add-button { order: 3; }
}

.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0;
}

.popup-card {
  min-width: 220px;
  max-width: 290px;
  padding: 0.7rem 0.8rem 0.55rem;
  border-top: 4px solid var(--teal);
  font-family: var(--font);
}

.popup-card h2 {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  line-height: 1.3;
}

.popup-card p {
  margin: 0.2rem 0;
}

.popup-card .meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.popup-card a {
  color: var(--teal);
}

.popup-card .hours {
  font-size: 0.88rem;
}

.popup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
  margin-top: 0.45rem !important;
}

.popup-more {
  display: flex;
  gap: 0.9rem;
  font-size: 0.85rem;
}

.rating-line {
  color: #8a5a00;
  font-weight: 600;
}

.warning {
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 600;
}

.directory,
.prose,
.admin {
  max-width: 52rem;
  padding: 1.25rem 1rem 2rem;
}

.directory h1,
.prose h1,
.admin h1 {
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
}

.directory h2,
.prose h2,
.admin h2 {
  font-size: 1.1rem;
  margin: 1.25rem 0 0.4rem;
}

.directory .meta,
.meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
}

.features li {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 0.9rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.4rem;
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.crumbs a,
.directory__links a,
.site-footer a,
.prose a {
  color: var(--teal);
}

.facility-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
}

.facility-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.facility-list li > a {
  font-weight: 700;
}

.facility-list p {
  margin: 0.15rem 0 0;
}

.listing-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.directory__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
}

.prose {
  line-height: 1.5;
}

.site-footer {
  padding: 0 1rem 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.sheet {
  width: min(30rem, calc(100% - 1.5rem));
  max-height: calc(100vh - 2rem);
  border: 0;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: 0 8px 32px rgba(20, 32, 51, 0.3);
}

.sheet::backdrop {
  background: rgba(20, 32, 51, 0.45);
}

.sheet h2 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
}

.sheet fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 0.8rem;
}

.sheet legend {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.field {
  display: block;
  margin: 0 0 0.7rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-weight: 400;
}

.tags,
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

.choices {
  flex-direction: column;
}

.stars {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 0.1rem;
}

.stars legend {
  width: 100%;
}

.stars input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.stars label {
  font-size: 2rem;
  line-height: 1;
  color: #cdd5df;
  cursor: pointer;
}

.stars input:checked ~ label,
.stars label:hover,
.stars label:hover ~ label {
  color: #f0a500;
}

.stars input:focus-visible + label {
  outline: 2px solid var(--teal);
  border-radius: 4px;
}

.turnstile-slot:not(:empty) {
  margin: 0.4rem 0 0.7rem;
}

.form-error {
  color: #a3261b;
  font-weight: 600;
}

.sheet__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toast {
  position: fixed;
  z-index: 2000;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: 0 4px 16px rgba(20, 32, 51, 0.3);
}

.queue-card {
  padding: 0.8rem 0.9rem;
  margin: 0 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.queue-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.queue-card .note {
  padding: 0.45rem 0.6rem;
  background: var(--paper);
  border-left: 3px solid var(--teal);
}

.diff {
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.4rem 0;
}

.diff th,
.diff td {
  text-align: left;
  padding: 0.2rem 0.9rem 0.2rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.admin-logout {
  margin-left: auto;
}

.admin-login {
  max-width: 22rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
