:root {
  --bg: #f5f3ee;
  --fg: #1f2933;
  --muted: #6b7280;
  --line: #e2dfd6;
  --accent: #2f6f4a;
  --accent-strong: #1f4f33;
  --warn: #b45309;
  --danger: #b91c1c;
  --card: #ffffff;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
  --radius: 10px;
  --cat-nature: #2f6f4a;
  --cat-city: #2563eb;
  --cat-camp: #7c2d12;
  --cat-ferry: #0e7490;
  --cat-activity: #b45309;
  --cat-food: #be185d;
  --cat-border: #4b5563;
  --cat-other: #6b7280;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

header.topbar {
  background: var(--accent-strong);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}
header.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; }
header.topbar a { color: #fff; }
header.topbar .spacer { flex: 1; }

main { padding: 16px; max-width: 1200px; margin: 0 auto; }

.trip-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.trip-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s;
}
.trip-card:hover { transform: translateY(-2px); }
.trip-card .cover {
  aspect-ratio: 16/10;
  background: #d6d3c7 center/cover no-repeat;
}
.trip-card .body { padding: 12px 14px; }
.trip-card h2 { margin: 0 0 4px; font-size: 17px; }
.trip-card .meta { color: var(--muted); font-size: 13px; }
.trip-card .badge {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 6px;
}

/* trip view layout */
.trip-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 12px;
  height: calc(100vh - 56px);
  padding: 0;
  max-width: none;
}
@media (max-width: 800px) {
  .trip-layout { grid-template-columns: 1fr; height: auto; }
  .trip-sidebar { max-height: 50vh; }
  #map { height: 60vh !important; }
}
.trip-sidebar {
  background: var(--card);
  overflow-y: auto;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}
.trip-sidebar h2 { margin: 0 0 4px; font-size: 18px; }
.trip-sidebar .trip-meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.day-block {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.day-block h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-strong);
}
.stop-item {
  display: flex;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
  align-items: flex-start;
}
.stop-item:hover { background: var(--bg); }
.stop-item.active { background: rgba(47,111,74,0.12); }
.stop-item .thumb {
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  background-position: center;
  background-size: cover;
}
.stop-item .thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
}
.stop-item .meta { flex: 1; min-width: 0; }
.stop-item .title { font-weight: 600; font-size: 14px; line-height: 1.25; }
.stop-item .loc { font-size: 12px; color: var(--muted); }
.stop-item .time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stop-item .links {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  align-items: center;
}
.stop-item .detail-link,
.stop-item .nav-link {
  font-size: 11px;
  text-decoration: none;
  color: var(--accent);
}
.stop-item .nav-link {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}
.stop-item .nav-link:hover { background: var(--accent-strong); text-decoration: none; }
.stop-item .detail-link:hover { text-decoration: underline; }
.km-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
  white-space: nowrap;
}

#map { height: 100%; width: 100%; }

.legend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(255,255,255,0.94);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  box-shadow: var(--shadow);
  z-index: 500;
}
.legend .row { display: flex; align-items: center; gap: 6px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; }

/* stop detail */
.stop-detail { max-width: 760px; }
.stop-detail h1 { margin-top: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  letter-spacing: 0.02em;
}
.pill.ghost {
  background: #fff;
  color: var(--fg);
  border: 1px solid var(--line);
  font-weight: 500;
}
.pill.warn { background: var(--warn); }
.address-row {
  display: block;
  font-size: 14px;
  color: var(--muted);
  padding: 6px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  text-decoration: none;
}
.address-row:hover { color: var(--accent-strong); text-decoration: underline; }
.btn.nav-btn { background: #1f4f33; }
.btn.nav-btn:hover { background: #0f3a23; }
.photo-attrib { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.prose p { line-height: 1.55; margin: 0 0 14px; font-size: 15px; }
.section {
  background: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 12px 0;
  border: 1px solid var(--line);
}
.section h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-strong);
  letter-spacing: 0.02em;
}
.section p { margin: 0; line-height: 1.5; font-size: 14px; }
.section.tip-box {
  background: #fef9e7;
  border-color: #f4d35e;
}
.section.tip-box h3 { color: #8a6300; }
.section.wifi-box {
  background: #e0f2fe;
  border-color: #7dd3fc;
}
.section.wifi-box h3 { color: #075985; }
.highlights {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.highlights li {
  position: relative;
  padding: 4px 0 4px 22px;
  font-size: 14px;
  line-height: 1.4;
}
.highlights li::before {
  content: "•";
  position: absolute;
  left: 6px;
  top: 4px;
  color: var(--accent);
  font-weight: 700;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; }
.stop-map { height: 280px; margin-top: 14px; border-radius: 10px; overflow: hidden; }
.alt-block summary { cursor: pointer; padding: 8px 0; }
.gallery {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 12px 0;
}
.gallery img {
  flex: 0 0 90%;
  scroll-snap-align: start;
  border-radius: 8px;
  height: 280px;
  width: auto;
  object-fit: cover;
}
@media (min-width: 700px) {
  .gallery img { flex: 0 0 60%; }
}
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; font-size: 14px; margin: 14px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.alt-card {
  background: var(--card);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
}
.alt-card h4 { margin: 0 0 4px; font-size: 15px; }
.alt-card .reason { color: var(--muted); font-size: 13px; font-style: italic; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  border: 0;
  text-decoration: none;
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.warn { background: var(--warn); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 4px 8px; font-size: 12px; }

/* admin */
.admin-grid { display: grid; gap: 14px; grid-template-columns: 320px 1fr; }
@media (max-width: 800px) { .admin-grid { grid-template-columns: 1fr; } }
.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.panel h2 { margin-top: 0; font-size: 16px; }

table.stops-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.stops-table th, table.stops-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.stops-table tr.dragging { opacity: 0.5; }
table.stops-table tr.drag-over { background: rgba(47,111,74,0.1); }
table.stops-table .handle { cursor: grab; color: var(--muted); }

label.field { display: block; margin: 8px 0; font-size: 13px; }
label.field span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
input[type=text], input[type=number], input[type=date], input[type=url], textarea, select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.notice {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
  color: var(--danger);
}

.unsplash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.unsplash-grid img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
}
.unsplash-grid img:hover { border-color: var(--accent); }

.image-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.image-thumbs .thumb {
  position: relative;
  width: 96px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
}
.image-thumbs .thumb.primary { border-color: var(--accent); }
.image-thumbs .thumb img { width: 100%; height: 100%; object-fit: cover; }
.image-thumbs .thumb .overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 10px;
  text-align: center;
  padding: 2px;
  display: flex;
  justify-content: space-around;
}
.image-thumbs .thumb .overlay a { color: #fff; cursor: pointer; }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}
.dropzone.over { background: rgba(47,111,74,0.08); border-color: var(--accent); }

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

footer.attrib {
  padding: 10px 16px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
