:root {
  --bg: #070708;
  --bg-2: #101012;
  --card: rgba(18, 18, 20, 0.86);
  --card-solid: #161618;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f6f6f7;
  --muted: #9b9ba3;
  --teal: #1ad4b0;
  --teal-dim: #0c8f77;
  --orange: #f08a2c;
  --orange-dark: #c96b14;
  --danger: #ff6b6b;
  --ok: #1ad4b0;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --nav-h: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 22px;
  --font: Inter, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--teal); }
img, svg { display: block; max-width: 100%; }

#app { height: 100%; display: grid; grid-template-rows: 1fr var(--nav-h); }

.view { display: none; height: 100%; overflow: hidden; position: relative; }
.view.active { display: block; }
.view.scroll { overflow: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(var(--nav-h) + 12px); }

/* Bottom nav */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 6px 10px var(--safe-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(8, 8, 10, 0.9);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  color: #7d7d86;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.01em;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--text); }
.tab.active svg { color: var(--teal); }

/* Map */
#view-map { background: #0b0b0d; }
#map { position: absolute; inset: 0 0 calc(var(--nav-h) + var(--safe-bottom)) 0; }
.leaflet-container { background: #0b0b0d; font-family: var(--font); }
.leaflet-control-attribution {
  background: rgba(0,0,0,0.55) !important; color: #aaa !important;
  font-size: 10px; margin: 0 8px 8px !important;
}
.leaflet-control-attribution a { color: #ccc !important; }

.map-top {
  position: absolute; left: 14px; right: 14px; top: calc(12px + env(safe-area-inset-top, 0px));
  z-index: 20; display: grid; gap: 10px; pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; letter-spacing: -0.04em; font-size: 1.15rem;
  text-shadow: 0 2px 16px rgba(0,0,0,0.6);
}
.brand svg, .brand img { width: 32px; height: 32px; border-radius: 9px; }
.loc-chip {
  background: var(--card); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 12px; font-size: 0.75rem; font-weight: 600; color: var(--muted);
  max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-pill {
  display: flex; align-items: center; gap: 10px;
  background: #1a1a1d; border: 1px solid var(--line);
  border-radius: 18px; padding: 12px 14px;
  box-shadow: var(--shadow);
}
.search-pill input {
  flex: 1; background: transparent; border: 0; outline: none;
  font-size: 1rem; font-weight: 600; color: var(--text);
}
.search-pill input::placeholder { color: #7a7a82; font-weight: 550; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  background: rgba(16,16,18,0.9); border: 1px solid var(--line);
  color: var(--text); border-radius: 999px;
  padding: 8px 12px; font-size: 0.8rem; font-weight: 650;
  backdrop-filter: blur(12px);
  display: flex; align-items: center; gap: 6px;
}
.chip.active { background: var(--text); color: #111; border-color: var(--text); }

.sheet {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  z-index: 21;
  background: linear-gradient(180deg, rgba(7,7,8,0) 0%, rgba(7,7,8,0.55) 18px, var(--bg) 48px);
  padding: 0 12px 10px;
  max-height: 46vh;
  display: flex; flex-direction: column;
}
.sheet.expanded { max-height: 70vh; }
.sheet-handle {
  width: 42px; height: 5px; border-radius: 99px; background: #3a3a40;
  margin: 8px auto 8px; flex: 0 0 auto;
}
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 8px; }
.sheet-head h2 { margin: 0; font-size: 1.05rem; letter-spacing: -0.03em; }
.sheet-head span { color: var(--muted); font-size: 0.78rem; }
.sheet-list { overflow: auto; display: grid; gap: 10px; padding-bottom: 6px; }

.place {
  display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center;
  background: var(--card-solid); border: 1px solid var(--line);
  border-radius: 18px; padding: 10px; text-align: left; width: 100%;
  color: inherit; animation: rise 0.35s ease both;
}
.place:active { transform: scale(0.99); }
.thumb {
  width: 76px; height: 76px; border-radius: 14px;
  display: grid; place-items: center;
  font-size: 1.6rem; background: #222227;
  position: relative; overflow: hidden;
}
.thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(26,212,176,0.18), rgba(240,138,44,0.12));
}
.meta h3 { margin: 0 0 2px; font-size: 0.98rem; letter-spacing: -0.02em; }
.meta p { margin: 0; color: var(--muted); font-size: 0.78rem; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 7px; border-radius: 999px; text-transform: uppercase;
}
.badge.demo { background: rgba(240,138,44,0.16); color: var(--orange); }
.badge.open { background: rgba(26,212,176,0.14); color: var(--teal); }
.eta { text-align: right; font-weight: 800; letter-spacing: -0.03em; font-size: 0.95rem; }
.eta small { display: block; color: var(--muted); font-weight: 600; font-size: 0.68rem; }
.place-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.btn {
  border-radius: 999px; font-weight: 700; padding: 10px 14px;
}
.btn-primary { background: var(--orange); color: #2a1704; }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-ghost { background: #26262b; color: var(--text); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-danger { background: #3a1515; color: #ffb4b4; }

.demo-banner, .notice, .status {
  border-radius: 14px; padding: 10px 12px; font-size: 0.85rem; font-weight: 600;
}
.demo-banner {
  background: rgba(240,138,44,0.12); color: #ffd2a1; border: 1px solid rgba(240,138,44,0.25);
  margin: 0 0 10px;
}
.status { display: none; }
.status.show { display: block; }
.status.ok { background: rgba(26,212,176,0.12); color: var(--teal); }
.status.err { background: rgba(255,107,107,0.12); color: var(--danger); }

.user-dot, .pin {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--teal); border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(26,212,176,0.25);
}
.pin-wrap { position: relative; width: 28px; height: 36px; }
.pin-body {
  width: 24px; height: 24px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--orange);
  border: 2px solid #fff;
  box-shadow: 0 6px 12px rgba(0,0,0,0.35);
  margin: 0 auto;
}
.pin-body.teal { background: var(--teal-dim); }
.pin-wrap span {
  position: absolute; left: 50%; top: 4px; transform: translateX(-50%);
  font-size: 10px; color: #fff; font-weight: 800;
}

/* Explore */
#view-explore { background: var(--bg); }
.explore-top {
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 8px;
}
.explore-top h1 { margin: 4px 0 4px; font-size: 1.9rem; letter-spacing: -0.05em; font-weight: 800; }
.explore-top p { margin: 0 0 12px; color: var(--muted); }
.section { padding: 6px 16px 18px; }
.section h2 { margin: 0 0 12px; font-size: 1.05rem; letter-spacing: -0.03em; }
.carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.feature-card {
  flex: 0 0 78%; max-width: 320px; scroll-snap-align: start;
  background: var(--card-solid); border: 1px solid var(--line);
  border-radius: 22px; overflow: hidden; text-align: left; color: inherit;
  animation: rise 0.4s ease both;
}
.feature-art {
  height: 120px; display: grid; place-items: center; font-size: 2.4rem;
  background: linear-gradient(145deg, #1b3d36, #2a2118);
  position: relative;
}
.feature-card .body { padding: 12px 14px 14px; }
.grid { display: grid; gap: 10px; }
@media (min-width: 720px) {
  .grid.two, .carousel { }
  .grid.two { grid-template-columns: 1fr 1fr; }
  .feature-card { flex-basis: 280px; }
}

/* AI */
#view-ai { display: none; flex-direction: column; height: 100%; background: var(--bg); }
#view-ai.active { display: flex; }
.ai-head { padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 8px; }
.ai-head h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.05em; font-weight: 800; }
.ai-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.messages { flex: 1; overflow: auto; padding: 8px 16px 12px; display: grid; gap: 10px; align-content: start; }
.msg {
  max-width: 92%; border-radius: 18px; padding: 10px 12px; font-size: 0.92rem;
  animation: rise 0.25s ease both;
}
.msg.bot { background: #17171a; border: 1px solid var(--line); }
.msg.user { background: var(--teal-dim); color: #effffb; margin-left: auto; }
.ai-composer {
  padding: 8px 12px calc(10px + var(--nav-h) + var(--safe-bottom));
  display: grid; gap: 8px; background: linear-gradient(180deg, transparent, var(--bg) 20%);
}
.suggest { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.suggest button {
  flex: 0 0 auto; background: #17171a; border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 12px; font-size: 0.78rem; font-weight: 650; color: var(--text);
}
.composer-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
}
.composer-row input {
  background: #17171a; border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 14px; outline: none;
}
.composer-row .btn { padding: 12px 16px; }

/* List form */
#view-list { background: var(--bg); }
.list-wrap { width: min(680px, 100%); margin: 0 auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 40px; }
.list-wrap h1 { margin: 0 0 6px; font-size: 1.8rem; letter-spacing: -0.05em; font-weight: 800; }
.list-wrap .lead { color: var(--muted); margin: 0 0 16px; }
.pitch {
  background: linear-gradient(135deg, #12352f, #2a1d10);
  border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; margin-bottom: 16px;
}
.pitch p { margin: 0 0 8px; }
.pitch p:last-child { margin: 0; color: #ffd2a1; font-weight: 700; }
form { display: grid; gap: 14px; }
.row { display: grid; gap: 14px; }
label, .label { display: grid; gap: 6px; font-size: 0.86rem; font-weight: 700; }
input, select, textarea {
  width: 100%; background: #141416; border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; outline: none;
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal-dim); box-shadow: 0 0 0 3px rgba(26,212,176,0.15); }
.hint { font-weight: 500; color: var(--muted); font-size: 0.78rem; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.photo-note, .loc { background: #141416; border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.loc { display: grid; gap: 10px; }
@media (min-width: 720px) {
  .row.two { grid-template-columns: 1fr 1fr; }
  .row.three { grid-template-columns: 1.1fr 0.9fr 0.9fr; }
}

/* Admin */
.admin-page { overflow: auto; height: 100%; }
.admin-wrap { width: min(900px, calc(100% - 28px)); margin: 0 auto; padding: 24px 0 80px; }
.admin-wrap h1 { letter-spacing: -0.04em; }
.listing-admin {
  background: var(--card-solid); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px; margin-top: 12px;
}
.listing-admin h3 { margin: 0 0 4px; }
.listing-admin dl { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; margin: 10px 0; font-size: 0.9rem; }
.listing-admin dt { color: var(--muted); }
.listing-admin dd { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
