:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-2: #efe8d9;
  --ink: #1d2a22;
  --muted: #5f6b62;
  --line: #ddd3c0;
  --brand: #1f3d2b;      /* jungle green */
  --brand-ink: #f6f1e7;
  --accent: #c2410c;     /* lantern orange */
  --gold: #e8c27a;
  --today: #fff3d6;
  --tim: #d9480f;
  --dave: #1971c2;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121814; --surface: #1a221d; --surface-2: #233029; --ink: #e9efe9; --muted: #9aa89f;
    --line: #2f3d35; --brand: #2c5a3f; --brand-ink: #f1ede4; --accent: #fb8c4a; --today: #2c2a1c;
    --tim: #ff8a50; --dave: #5aa9ff; --shadow: 0 1px 2px rgb(0 0 0 / .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121814; --surface: #1a221d; --surface-2: #233029; --ink: #e9efe9; --muted: #9aa89f;
  --line: #2f3d35; --brand: #2c5a3f; --brand-ink: #f1ede4; --accent: #fb8c4a; --today: #2c2a1c;
  --tim: #ff8a50; --dave: #5aa9ff; --shadow: 0 1px 2px rgb(0 0 0 / .4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: Fraunces, Georgia, serif; font-weight: 700; line-height: 1.15; margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(1200px 300px at 85% -40%, rgb(232 194 122 / .35), transparent 70%),
    var(--brand);
  color: var(--brand-ink);
  padding: 28px 16px 22px;
}
.hero-inner { max-width: 1400px; margin: 0 auto; }
.eyebrow { margin: 0 0 6px; color: var(--gold); font-weight: 600; letter-spacing: .02em; font-size: 14px; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); }
.status { margin: 10px 0 0; font-size: 15px; opacity: .9; }
.status strong { color: var(--gold); font-weight: 600; }

/* ---------- layout ---------- */
.layout { max-width: 1400px; margin: 0 auto; display: grid; gap: 0; }
.map-col { position: relative; }
#map { height: 52vh; min-height: 300px; background: var(--surface-2); }
.content-col { padding: 0 16px 48px; min-width: 0; }

@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); gap: 24px; padding: 24px; }
  .map-col { position: sticky; top: 24px; align-self: start; }
  #map { height: calc(100vh - 48px - 92px); border-radius: var(--radius); box-shadow: var(--shadow); }
  .content-col { padding: 0; }
}

/* ---------- whereabouts ---------- */
.whereabouts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px; }
@media (min-width: 960px) { .whereabouts { padding: 12px 0 0; } }
.person {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; display: flex; gap: 10px; align-items: center; cursor: pointer; text-align: left;
  min-width: 0;
}
.person:disabled { cursor: default; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 15px;
}
.person .meta { min-width: 0; }
.person .name { font-weight: 600; }
.person .where { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- tabs ---------- */
.tabs {
  position: sticky; top: 0; z-index: 500; display: flex; gap: 4px;
  background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.tab {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  font-weight: 500; color: var(--muted);
}
.tab[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }
.tab-post { margin-left: auto; color: var(--accent); }
.count { font-size: 12px; opacity: .8; }

/* ---------- itinerary ---------- */
.flights { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }
.flights summary { cursor: pointer; font-weight: 600; }
.flights ul { margin: 8px 0 0; padding-left: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; }
.flights li { display: flex; gap: 8px; }
.tag { flex: none; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; color: #fff; height: fit-content; }

.days { list-style: none; margin: 0; padding: 0; position: relative; }
.days::before { content: ""; position: absolute; left: 21px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.day { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 0 0 14px; }
.day-num {
  position: relative; z-index: 1; width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line); display: grid; place-items: center;
  font-weight: 600; font-size: 14px; line-height: 1; text-align: center;
}
.day-num small { display: block; font-size: 9px; font-weight: 500; color: var(--muted); text-transform: uppercase; }
.day.past .day-num { background: var(--surface-2); color: var(--muted); }
.day.today .day-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.day.today .day-num small { color: #fff; }
.day-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; transition: border-color .15s;
}
.day-card:hover { border-color: var(--brand); }
.day.today .day-card { background: var(--today); border-color: var(--accent); }
.day-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.day-date { color: var(--muted); font-size: 13px; white-space: nowrap; }
.day h3 { font-size: 18px; }
.day .place { color: var(--accent); font-size: 13px; font-weight: 600; margin: 2px 0 6px; }
.day p { margin: 0; font-size: 14px; }
.day .facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.day .thumbs { display: flex; gap: 4px; margin-top: 10px; overflow: hidden; }
.day .thumbs img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.flag { font-size: 12px; }
.day .hotel-line { flex-basis: 100%; }
.flights a, .hotel-line a { color: inherit; text-decoration: underline; }
.flights li > span:last-child, .flights li > strong { line-height: 1.4; }
#hotel-list li { display: block; }

/* ---------- feed ---------- */
.feed { display: grid; gap: 16px; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.post-imgs { display: grid; gap: 2px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); background: var(--line); }
.post-imgs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; cursor: zoom-in; background: var(--surface-2); }
.post-imgs img:only-child { aspect-ratio: auto; max-height: 520px; }
.post-body { padding: 12px 14px; }
.post-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.post-meta .avatar { width: 24px; height: 24px; font-size: 12px; }
.post-caption { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-actions { display: flex; gap: 12px; margin-top: 8px; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

/* ---------- forms ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; display: grid; gap: 12px; }
.card h2 { font-size: 20px; }
label { display: grid; gap: 4px; font-weight: 500; font-size: 14px; }
input[type="password"], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
legend { font-weight: 500; font-size: 14px; margin-bottom: 4px; }
fieldset label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
fieldset.who { grid-auto-flow: column; justify-content: start; gap: 18px; }
.muted { color: var(--muted); margin: 0; font-size: 14px; }
.small { font-size: 13px; }
.error { color: #c92a2a; margin: 0; font-size: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line); background: var(--surface-2); padding: 10px 16px; border-radius: 10px;
  font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .6; cursor: progress; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: inherit; }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center;
  cursor: pointer; color: var(--muted); font-weight: 500;
}
.drop:hover { border-color: var(--accent); color: var(--accent); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
.previews:empty { display: none; }
.previews figure { margin: 0; position: relative; }
.previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.previews .gps { position: absolute; left: 4px; bottom: 4px; font-size: 10px; background: rgb(0 0 0 / .6); color: #fff; border-radius: 4px; padding: 0 4px; }
.progress { margin: 0; font-size: 14px; color: var(--muted); }

.share-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.share-status { margin: 0; font-size: 14px; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 2000; background: rgb(10 14 12 / .92); display: grid; place-items: center; padding: 16px; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: grid; gap: 8px; }
.lightbox img { max-height: 82vh; max-width: 100%; object-fit: contain; border-radius: 6px; }
.lightbox figcaption { color: #eee; font-size: 14px; text-align: center; }
.lb-close { position: absolute; top: 8px; right: 12px; background: none; border: 0; color: #fff; font-size: 36px; cursor: pointer; }

/* ---------- map bits ---------- */
.leaflet-container { font: inherit; }
.tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
.leaflet-popup-content { margin: 10px 12px; }
.pop img { width: 220px; max-width: 100%; border-radius: 8px; margin-bottom: 6px; cursor: zoom-in; }
.pop p { margin: 0; font-size: 13px; }
.pop .muted { font-size: 12px; }
.stop-dot { background: var(--brand); color: var(--brand-ink); border: 2px solid #fff; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; box-shadow: 0 1px 4px rgb(0 0 0 / .3); }
.photo-pin img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .35); }
.photo-pin .note { width: 100%; height: 100%; display: grid; place-items: center; background: var(--accent); color: #fff; border-radius: 8px; border: 2px solid #fff; font-size: 16px; }
.person-pin { border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; border: 3px solid #fff; box-shadow: 0 2px 8px rgb(0 0 0 / .4); }
