:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --border: #ddd9d0;
  --text: #1a1916;
  --text-2: #5a5750;
  --text-3: #8a8780;
  --accent: #1a5276;
  --accent-light: #d6e8f5;
  --accent-hover: #154360;
  --red: #c0392b;
  --red-light: #fde8e6;
  --green: #1e8449;
  --green-light: #e6f5eb;
  --blue: #1a6fa8;
  --blue-light: #cce4f5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.14), 0 4px 12px rgba(0,0,0,0.08);
  --radius: 10px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --header-h: 56px;
  --tray-h: 120px;
}


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

  .tray-handle { display: none; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  overflow: auto;
}

/* Keep the original no-scroll behavior for the map app by adding
   `class="map-app"` on the body element (used in templates/index.html) */
body.map-app {
  overflow: hidden;
}

/* ── Header ─────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
  flex-shrink: 0;
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.header-legend {
  display: flex;
  align-items: center;
  gap: 18px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-red { background: var(--red); }
.dot-green { background: var(--green); }
.dot-blue { background: var(--blue); }

.logo {
  margin: 30px 0 10px;
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 1.05;
}

.logo_svg {
  display: block;
  margin: 0 auto;
  max-width: 420px;
  width: 100%;
  height: auto;
  max-height: 84px;
}

/* ── Search bar ──────────────────────────────── */
.search-bar {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: min(400px, calc(100vw - 110px));
  z-index: 900;
}

.search-inner {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 0 14px;
  box-shadow: var(--shadow-md);
  gap: 8px;
}

.search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text);
  padding: 10px 0;
}

.search-input::placeholder { color: var(--text-3); }

.search-clear {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 4px;
  display: none;
  transition: color 0.15s;
}
.search-clear:hover { color: var(--text); }
.search-clear.visible { display: block; }

.search-results {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: none;
}

.search-results.visible { display: block; }

.search-result-item {
  padding: 10px 16px;
  font-size: 0.84rem;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  line-height: 1.3;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-2); }

.search-result-item .result-secondary {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 1px;
}

.search-no-results {
  padding: 12px 16px;
  font-size: 0.84rem;
  color: var(--text-3);
  font-style: italic;
}

/* ── Thank-you screen ────────────────────────── */
.thankyou-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.thankyou-screen.visible {
  display: flex;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.thankyou-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 48px 40px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: slideUp 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.thankyou-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
}

.thankyou-icon svg { width: 100%; height: 100%; }

.thankyou-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.15;
}

.thankyou-text {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 12px;
}

.thankyou-text strong {
  color: var(--accent);
  font-weight: 500;
}

.thankyou-subtext {
  font-size: 0.83rem;
  color: var(--text-3);
  line-height: 1.55;
}

/* ── Cluster overrides ───────────────────────── */
.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-anim .leaflet-marker-shadow {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ── Map ─────────────────────────────────────── */
#map {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: var(--tray-h);
  z-index: 1;
}

.leaflet-bottom .leaflet-right {
  display: none;
}

/* ── Tray ────────────────────────────────────── */
.tray {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tray-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 1000;
  padding: 10px 20px 14px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: height 0.35s;
}

.tray.expanded {
  height: 240px;
}

.tray-toggle {
  position: absolute;
  top: 10px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
  padding: 0;
}
.tray-toggle:hover { background: var(--border); }

.tray-toggle-arrow {
  display: inline-block;
  font-size: 0.95rem;
  color: var(--text-2);
  transition: transform 0.18s ease, color 0.18s;
}
.tray.expanded .tray-toggle-arrow { transform: rotate(180deg); color: var(--text); }

@media (min-width: 600px) {
  .tray-handle {
    display: block;
    width: 36px;
    height: 5px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 2px;
    cursor: pointer;
    transition: background 0.2s;
  }
  .tray-handle:hover { background: var(--text-3); }
  .tray-toggle { display: none; }
}

.tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tray-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.tray-subtitle {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 1px;
}

.chosen-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow-y: auto;
  padding-bottom: 4px;
}

.chosen-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid #9ecae8;
  border-radius: 20px;
  padding: 4px 10px 4px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.chosen-item-locate {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0;
  text-align: left;
  transition: color 0.15s, text-decoration 0.15s;
}
.chosen-item-locate:hover {
  color: var(--accent);
  text-decoration: underline;
}

.chosen-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue);
  font-size: 0.85rem;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.chosen-item-remove:hover { opacity: 1; }

/* ── Buttons ─────────────────────────────────── */
.btn-submit {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  flex-shrink: 0;
}

.btn-submit:hover:not(:disabled) { background: var(--accent-hover); }
.btn-submit:active:not(:disabled) { transform: scale(0.97); }
.btn-submit:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Popup (Leaflet) ─────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--border);
  min-width: 240px;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
}

.leaflet-popup-tip-container { display: none; }

.popup-inner {
  padding: 18px 20px 14px;
}

.popup-status-bar {
  height: 4px;
  width: 100%;
  margin-bottom: 14px;
  border-radius: 2px;
}
.popup-status-bar.claimed { background: var(--green); }
.popup-status-bar.unclaimed { background: var(--red); }
.popup-status-bar.local { background: var(--blue); }

.popup-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
}

.popup-address {
  font-size: 0.82rem;
  color: var(--text-2);
  margin-bottom: 12px;
}

.popup-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.popup-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  color: var(--text-2);
  line-height: 1.3;
}

.popup-chip strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.popup-extra {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-bottom: 12px;
  font-style: italic;
}

/* Opening hours inside popups */
.popup-open-times {
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text-2);
}
.popup-open-times strong {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  font-size: 0.92rem;
}
.popup-open-times ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.popup-open-times li {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text-2);
  font-size: 0.82rem;
}
.popup-open-times li::before {
  content: '\2022';
  display: inline-block;
  width: 8px;
  color: var(--text-3);
  transform: translateY(-1px);
}

/* Collapse long opening-hours lists: show first 3 by default when many entries */
.popup-open-times.collapsed ul li:nth-child(n+4) {
  display: none;
}
.popup-open-times .open-times-toggle {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
}
.popup-open-times .open-times-toggle:hover {
  text-decoration: underline;
}
.popup-open-times.expanded ul li { display: list-item; }

.popup-btn {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.popup-btn:active { transform: scale(0.97); }

.popup-btn-claim {
  background: var(--accent);
  color: white;
}
.popup-btn-claim:hover { background: var(--accent-hover); }

.popup-btn-unclaim {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.popup-btn-unclaim:hover { background: var(--border); }

/* ── Modal ───────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 8, 0.55);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px;
  width: min(480px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.visible .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: var(--border); }

.modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 0.86rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* Inline modifier for checkbox labels */
.form-label--inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.required { color: var(--red); }
.optional { color: var(--text-3); font-weight: 400; }

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-summary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 0.82rem;
}

.form-summary strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.84rem;
}

.form-summary ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-summary ul li::before {
  content: '- ';
  color: var(--accent);
  font-weight: 600;
}

.form-summary ul li {
  color: var(--text-2);
}

.form-error {
  color: var(--red);
  font-size: 0.82rem;
  min-height: 20px;
  margin-bottom: 10px;
}

.btn-confirm {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 13px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-confirm:hover { background: var(--accent-hover); }
.btn-confirm:active { transform: scale(0.98); }
.btn-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Toast ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--tray-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: #1a1916;
  color: white;
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  z-index: 3000;
  box-shadow: var(--shadow-md);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 600px) {
  .header-legend { display: none; }
  .brand-text { font-size: 1rem; }
  .tray { padding: 8px 14px 12px; height: var(--tray-h); }
  .tray-header { flex-wrap: wrap; }
  .btn-submit { width: 100%; text-align: center; }
  :root { --tray-h: 110px; }
  .tray.expanded { height: 280px; }
}

/* Small utilities and card layout for questionnaire pages */
.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  min-height: calc(100vh - var(--header-h));
  padding-top: var(--header-h);
  padding-bottom: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  max-width: 760px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-md);
}
.muted { color: var(--text-3); margin-bottom: 12px; margin-top: 12px; }
.decision-buttons { display:grid; gap:12px; text-align:center; margin-top:32px; }
.btn-primary { background: var(--accent); color: white; padding: 12px 18px; border-radius: 10px; text-decoration:none; display:inline-block; font-weight:600; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-large { font-size:1.05rem; padding:14px 20px; }
.btn-secondary { background: transparent; border:1px solid var(--border); padding:10px 14px; border-radius:10px; cursor:pointer; font-weight:600; color:var(--text); }
.btn-secondary.active { border-color: var(--accent); box-shadow: 0 4px 18px rgba(26,111,168,0.08); }
.hidden { display:none; }
.form-group-inline { display:flex; gap:12px; align-items:center; margin:12px 0; }
.form-actions { display:flex; gap:12px; align-items:center; margin-top:16px; }
.btn-link { background:none; border:none; color:var(--text-2); cursor:pointer; }

