:root {
  --bg: #fbf7f0;
  --surface: #ffffff;
  --ink: #2b2118;
  --muted: #9a8269;
  --faint: #cbbaa4;
  --line: #e9dfd0;
  --accent: #b5722c;
  --accent-ink: #fffaf3;
  --accent-soft: #f6ead8;
  --danger: #b5492c;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 33, 24, .05), 0 8px 24px -12px rgba(43, 33, 24, .12);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 22px;
  padding-bottom: 22px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  font-size: 34px;
  line-height: 1;
  background: var(--accent-soft);
  border-radius: 50%;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
}

.brand-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 999px;
}

.tab-btn {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  padding: 8px 20px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
  transition: all .15s ease;
}

.tab-btn:hover { color: var(--ink); }

.tab-btn.is-active {
  background: var(--ink);
  color: var(--accent-ink);
}

/* ---------- Main / toolbar ---------- */
main { flex: 1; padding-top: 28px; padding-bottom: 48px; }

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  font-size: 20px;
  color: var(--muted);
}

#search-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color .15s ease;
}

#search-input:focus { border-color: var(--accent); }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

select {
  appearance: none;
  font: inherit;
  font-size: 14.5px;
  padding: 10px 34px 10px 13px;
  color: var(--ink);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239a8269' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 13px center;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  outline: none;
}

select:focus { border-color: var(--accent); }

/* ---------- Stats ---------- */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.stat {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 14px;
  color: #6b532f;
}

.stat strong { color: var(--ink); }

/* ---------- Cards grid ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.group-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.group-head .group-name { font-family: var(--serif); font-size: 20px; font-weight: 700; margin: 0; }
.group-head .group-count { color: var(--muted); font-size: 13.5px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .12s ease, box-shadow .12s ease;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(43,33,24,.06), 0 16px 32px -12px rgba(43,33,24,.16); }

.card.is-clickable { cursor: pointer; }

.card-photo {
  width: calc(100% + 40px);
  margin: -20px -20px 0;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
}

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }

.card-name { font-family: var(--serif); font-size: 19px; font-weight: 700; margin: 0; line-height: 1.25; }

.card-meta { font-size: 13.5px; color: var(--muted); }

.rating { font-size: 15px; letter-spacing: 1px; white-space: nowrap; }
.rating .off { opacity: .18; }
.rating-label-chip { font-size: 12px; color: var(--muted); }

.cost { font-size: 14px; letter-spacing: 1px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.cost .off { color: var(--faint); font-weight: 400; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-size: 12.5px;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #6b532f;
  border: 1px solid var(--line);
  cursor: default;
}

.card-desc {
  font-size: 14.5px;
  color: #5c4c3a;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-address a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  border-bottom: 1px dotted var(--faint);
}

.card-address a:hover { color: var(--accent); border-bottom-color: var(--accent); }

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

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 15px;
  cursor: pointer;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: all .15s ease;
}

.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
  font-family: var(--serif);
  font-size: 19px;
}

/* ---------- Form ---------- */
#tab-add form {
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 30px 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.form-head h2 { font-family: var(--serif); margin: 0 0 4px; font-size: 24px; }
.form-hint { margin: 0; color: var(--muted); font-size: 14.5px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label { font-size: 14px; font-weight: 600; }

.field input[type="text"],
.field input[type="date"],
.field textarea {
  font: inherit;
  font-size: 15px;
  padding: 11px 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s ease;
}

.field textarea { resize: vertical; min-height: 96px; }

.field input:focus, .field textarea:focus { border-color: var(--accent); background: var(--surface); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

.field-note { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.photo-count { font-weight: 600; font-size: 13px; color: var(--muted); }
.photo-count.full { color: var(--accent); }

input:disabled { opacity: .45; cursor: not-allowed; }

.rating-picker, .cost-picker { display: flex; gap: 8px; }

.rating-picker .star, .cost-picker .euro {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
  padding: 10px 6px;
  cursor: pointer;
  transition: all .15s ease;
  color: var(--faint);
}

.rating-picker .star.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); color: initial; }

.rating-picker .star:not(.is-on) { filter: grayscale(1) opacity(.35); }

.cost-picker .euro { font-weight: 700; color: var(--muted); font-size: 21px; }
.cost-picker .euro.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.label-choice { font-size: 13.5px; color: var(--muted); }
.label-active { font-size: 13.5px; color: var(--accent); font-weight: 600; }

.tag-input-row { display: flex; gap: 8px; }
.tag-input-row input { flex: 1; }

.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  color: #6b532f;
}

.chip button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.chip button:hover { color: var(--danger); }

.loc-results {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.picker-map {
  height: 320px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  z-index: 0;
  background: var(--accent-soft);
}

.picker-map .leaflet-control-attribution { font-size: 10px; }

.map-note {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 14px;
  padding: 20px;
  text-align: center;
}

.photo-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.photo-preview {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
}

.photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo-preview .x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: rgba(43, 33, 24, .65);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Detail modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 33, 24, .82);
  backdrop-filter: blur(7px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  max-width: 760px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 24px 60px -20px rgba(43, 33, 24, .35);
  animation: modal-in .18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: sticky;
  top: 14px;
  margin-left: calc(100% - 58px);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  z-index: 5;
  box-shadow: var(--shadow);
}

.modal-close:hover { color: var(--danger); border-color: var(--danger); }

.modal-body { padding: 4px 30px 28px; }

.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 6px; }
.detail-name { font-family: var(--serif); font-size: 28px; margin: 0; }
.detail-actions { display: flex; gap: 8px; }

.detail-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 4px; }
.detail-meta .rating { font-size: 18px; }
.detail-meta .cost { font-size: 15px; }
.detail-date { font-size: 13.5px; color: var(--muted); }

.detail-desc {
  font-size: 15px;
  color: #5c4c3a;
  white-space: pre-wrap;
  margin: 14px 0 18px;
}

.detail-map-wrap { margin: 18px 0; }

.map-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 10px;
}

.map-tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
}

.map-tabs button.is-active { background: var(--ink); color: var(--accent-ink); }

.detail-map-frame {
  width: 100%;
  height: 340px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.detail-no-map {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
  margin: 0;
}

.detail-address {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 4px;
}

.detail-address a { color: var(--accent); }

.detail-photos-title { font-family: var(--serif); font-size: 18px; margin: 20px 0 10px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

.gallery img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  transition: transform .12s ease;
}

.gallery img:hover { transform: scale(1.02); }

.no-photos { color: var(--muted); font-size: 14px; margin: 0; font-style: italic; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 10, .9);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 24px;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.lightbox-close:hover { background: rgba(255, 255, 255, .3); }

@media (max-width: 560px) {
  .detail-name { font-size: 22px; }
  .modal-body { padding: 4px 18px 22px; }
  .picker-map { height: 260px; }
}

.loc-result {
  font: inherit;
  text-align: left;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 13px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
}

.loc-result:last-child { border-bottom: 0; }
.loc-result:hover, .loc-result:focus { background: var(--accent-soft); outline: none; }

.loc-picked {
  display: flex;
  gap: 9px;
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 14px;
  color: #6b532f;
}

.loc-picked .x {
  margin-left: auto;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.form-actions { display: flex; gap: 10px; margin-top: 4px; }

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  padding: 11px 22px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s ease;
  font-size: 15px;
}

.btn-primary { background: var(--ink); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); }

.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--faint); }

.form-msg { font-size: 14px; margin: 0; min-height: 1.2em; }
.form-msg.ok { color: #4e7a5c; }
.form-msg.err { color: var(--danger); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
  padding: 20px 0;
  margin-top: 20px;
}

.site-footer p { margin: 0; }

/* ---------- Auth gate ---------- */
.auth-gate {
  max-width: 460px;
  margin: 40px auto;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 32px;
  text-align: center;
}

.auth-icon {
  font-size: 38px;
  line-height: 1;
  background: var(--accent-soft);
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 14px;
}

.auth-card h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 8px; }

.auth-sub { color: var(--muted); font-size: 14.5px; margin: 0 0 20px; }

.auth-form { display: flex; gap: 8px; }

.auth-form input {
  flex: 1;
  font: inherit;
  font-size: 15px;
  padding: 11px 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.auth-form input:focus { border-color: var(--accent); background: var(--surface); }