:root {
  --bg: #fafaf8;
  --card: #ffffff;
  --ink: #1c1c1a;
  --muted: #74736e;
  --line: #e6e4df;
  --accent: #2f6f4f;
  --accent-soft: #e6f0ea;
  --star: #e0a400;
  --danger: #b23a3a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  line-height: 1.4;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 500;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }

.nav-tabs { display: flex; gap: 4px; margin-left: auto; }
.nav-tabs a {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}
.nav-tabs a.active { background: var(--accent-soft); color: var(--accent); }

.search-box {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--bg);
  color: var(--ink);
}
.search-box:focus { outline: none; border-color: var(--accent); background: #fff; }

/* ---------------------------------------------------------------- filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filters select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 30px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%2374736e' d='M2 4l4 4 4-4'/></svg>") no-repeat right 10px center;
  font-size: 0.88rem;
  color: var(--ink);
  max-width: 46vw;
}
.filters select:focus { outline: none; border-color: var(--accent); }
.filters select.on { background-color: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.count { font-size: 0.82rem; color: var(--muted); margin-left: auto; white-space: nowrap; }
.btn-clear {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 4px;
  text-decoration: underline;
}

/* ---------------------------------------------------------------- list */
.wrap { max-width: 760px; margin: 0 auto; padding: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
}

.check {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
  color: transparent;
  transition: all 0.12s ease;
  margin-top: 2px;
}
.check.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.card-main { flex: 1 1 auto; min-width: 0; }
.card-title { font-weight: 650; font-size: 1.02rem; letter-spacing: -0.01em; }
.card-title a { color: var(--ink); }
.meta { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.meta .rating { color: var(--ink); font-weight: 600; }
.meta .price { color: var(--accent); font-weight: 600; }

.badges { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.badge.closed { background: #f0e6e6; color: var(--danger); }
.badge.list { background: #eee; color: var(--muted); }

.expand-toggle {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 6px;
  white-space: nowrap;
}

.detail {
  border-top: 1px dashed var(--line);
  padding: 12px 14px;
  display: none;
  background: #fcfcfb;
}
.detail.open { display: block; }
.detail label { font-size: 0.78rem; color: var(--muted); display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }

.stars { display: flex; gap: 4px; margin-bottom: 12px; }
.star {
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--line);
  user-select: none;
}
.star.on { color: var(--star); }

.detail textarea {
  width: 100%;
  min-height: 64px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  color: var(--ink);
}
.detail textarea:focus { outline: none; border-color: var(--accent); }

.detail-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.detail-row input[type="date"] {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}
.btn-save {
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  margin-left: auto;
}
.btn-save:disabled { opacity: 0.5; }
.saved-flash { font-size: 0.8rem; color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.loading { text-align: center; color: var(--muted); padding: 30px; }

/* ---------------------------------------------------------------- login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.login-card h1 { margin: 0 0 4px; font-size: 1.5rem; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: 0.9rem; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 12px;
}
.login-card button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.login-err { color: var(--danger); font-size: 0.85rem; margin-bottom: 12px; }

/* ---------------------------------------------------------------- map */
#map { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
.map-page { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.map-body { position: relative; flex: 1 1 auto; }

.leaflet-popup-content { font-size: 0.9rem; margin: 10px 12px; }
.popup-title { font-weight: 650; font-size: 1rem; }
.popup-meta { color: var(--muted); font-size: 0.82rem; margin: 3px 0 6px; }
.popup-toggle {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 600;
}
.popup-toggle.on { background: var(--accent); color: #fff; }

@media (min-width: 620px) {
  .filters select { max-width: 220px; }
}

/* --- place-name labels on the map --- */
#map .leaflet-tooltip.place-label { display: none; }
#map.show-labels .leaflet-tooltip.place-label {
  display: block;
  font-size: 10px;
  padding: 1px 4px;
  background: rgba(255, 255, 255, 0.68);
  border: none;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
#map.show-labels .leaflet-tooltip.place-label::before { display: none; }
.map-body { position: relative; }
.map-labels-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  font-size: 13px;
  user-select: none;
  cursor: pointer;
}

.badge.tempclosed { background: #f5eede; color: #a4700a; }

.filters .chk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.map-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  gap: 6px;
  align-items: center;
}
.map-controls .map-labels-toggle { position: static; }
.map-fit-btn {
  background: #fff;
  border: none;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
}
