:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #f1eee6;
  --ink: #1d2729;
  --ink-2: #4c5759;
  --ink-3: #7b8486;
  --line: #e3dfd4;
  --accent: #1c5d63;
  --accent-ink: #ffffff;
  --accent-soft: #e2eeee;
  --place: #233b6e;
  --love: #2f8a5f;
  --improve: #d6921c;
  --problem: #c4443b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 30, .06), 0 8px 24px rgba(20, 30, 30, .08);
  --panel-w: 400px;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fraunces', Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, select, textarea, input { font: inherit; color: inherit; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- banner + top bar ---------- */
.status-banner {
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 8px 16px;
}
/* Consultation closed: nothing new can be added */
.is-closed [data-action="add"],
.is-closed [data-pop="add"] { display: none !important; }
.is-closed .agree { cursor: default; }
.demo-banner {
  background: #fdf1d8;
  color: #6b4a07;
  font-size: 13px;
  text-align: center;
  padding: 6px 16px;
  border-bottom: 1px solid #f0dcae;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 500;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand > div { min-width: 0; }
.brand-mark {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--accent);
  display: grid; place-items: center;
}
.brand-mark svg { width: 22px; height: 22px; fill: #fff; stroke: none; }
.brand h1 {
  font-family: var(--display);
  font-size: 21px;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; flex: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; stroke-width: 2.5; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #164c51; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 5px 12px; font-size: 13px; background: #fff; border-color: var(--line); }
.link {
  background: none; border: 0; padding: 0;
  color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--surface-2); cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn svg { width: 18px; height: 18px; }
:focus-visible { outline: 3px solid #7fb4b9; outline-offset: 2px; }

/* ---------- layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: var(--panel-w) minmax(0, 1fr); min-height: 0; }
.panel {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  z-index: 400;
}
.panel-handle { display: none; }
.map-wrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #e8e6df; }

/* ---------- summary ---------- */
.summary { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.summary-head { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }
.summary-head strong { font-family: var(--display); font-size: 26px; color: var(--ink); margin-right: 4px; }
.summary-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.summary-bar span { display: block; height: 100%; transition: flex-grow .3s; }
.summary-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.summary-legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- tabs ---------- */
.tabs { display: flex; padding: 0 20px; border-bottom: 1px solid var(--line); gap: 18px; }
.tab {
  background: none; border: 0; padding: 12px 0 10px; cursor: pointer;
  font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- filters ---------- */
.filters { padding: 12px 20px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
select, textarea, input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface);
  min-width: 0;
}
.filter-row select { font-size: 13.5px; padding: 7px 10px; }
.active-place {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--accent-soft); border-radius: 10px; padding: 7px 12px; font-size: 13.5px;
}

/* ---------- lists ---------- */
.comment-list, .place-list { list-style: none; margin: 0; padding: 8px 12px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 8px 0;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  border-left-width: 4px;
}
.card:hover, .card.is-active { box-shadow: var(--shadow); border-color: #cfc9ba; }
.card.is-active { border-color: var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.cat { font-size: 12.5px; color: var(--ink-3); }
.card p { margin: 4px 0 8px; overflow-wrap: anywhere; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.card-meta .where { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agree {
  flex: none;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.agree svg { width: 15px; height: 15px; }
.agree:hover { border-color: var(--accent); color: var(--accent); }
.agree[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); cursor: default; }
.empty { text-align: center; color: var(--ink-3); padding: 32px 16px; }

.place-item { display: flex; gap: 12px; align-items: flex-start; }
.place-item .pin-ico {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  background: var(--place); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.place-item h3 { margin: 0; font-size: 15px; }
.place-item p { margin: 2px 0 6px; font-size: 13.5px; color: var(--ink-2); }
.mini-bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 1px; width: 100%; }

.panel-foot {
  padding: 10px 20px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-3); display: flex; gap: 10px; align-items: center;
}

/* ---------- map overlays ---------- */
.pick-hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 600;
  background: var(--ink); color: #fff;
  border-radius: 999px; padding: 8px 8px 8px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow); font-weight: 500; max-width: calc(100% - 32px);
}
.picking #map { cursor: crosshair; }
.basemap-toggle {
  position: absolute; right: 12px; bottom: 28px; z-index: 500;
  display: flex; background: var(--surface); border-radius: 999px; padding: 3px; box-shadow: var(--shadow);
}
.basemap-toggle button {
  border: 0; background: none; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2);
}
.basemap-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* markers */
.c-marker {
  width: 100%; height: 100%; border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.c-marker.is-active { outline: 3px solid var(--ink); outline-offset: 1px; }
.p-marker {
  width: 34px; height: 34px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  background: var(--place);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  display: grid; place-items: center;
}
.p-marker span { transform: rotate(45deg); color: #fff; font-weight: 700; font-size: 12.5px; }
.p-marker svg { transform: rotate(45deg); width: 15px; height: 15px; fill: #fff; stroke: none; }
.draft-marker {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(29, 39, 41, .2), 0 2px 6px rgba(0, 0, 0, .3);
}
.cluster {
  width: 100%; height: 100%; border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .3);
}
.cluster span {
  width: calc(100% - 10px); height: calc(100% - 10px); border-radius: 50%;
  background: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}

/* popups */
.leaflet-popup-content-wrapper { border-radius: var(--radius); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 14px 16px; font-family: var(--font); font-size: 14px; line-height: 1.45; width: 260px; }
.leaflet-container { font-family: var(--font); }
.pop h3 { margin: 0 0 4px; font-family: var(--display); font-size: 17px; }
.pop p { margin: 4px 0 10px; overflow-wrap: anywhere; }
.pop .muted { color: var(--ink-3); font-size: 12.5px; }
.pop .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pop .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pop .btn { padding: 6px 12px; font-size: 13px; }

/* ---------- form sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 28, 30, .35); z-index: 900; }
.form-sheet {
  position: fixed; z-index: 1000;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.form-sheet form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.form-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 8px; }
.form-head h2 { margin: 0; font-family: var(--display); font-size: 22px; }
.form-body { padding: 8px 22px 16px; overflow-y: auto; display: grid; gap: 16px; }
.form-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.field { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: 14px; padding: 0; }
.field .opt { font-weight: 400; color: var(--ink-3); }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
.counter { font-size: 12px; color: var(--ink-3); text-align: right; }
.counter.over { color: var(--problem); font-weight: 600; }
.location-line {
  display: flex; align-items: center; gap: 8px;
  background: var(--accent-soft); border-radius: 10px; padding: 8px 12px; font-size: 13.5px;
}
.location-line svg { flex: none; width: 16px; height: 16px; color: var(--accent); }
.sentiment-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.sentiment-pick label {
  position: relative;
  border: 2px solid var(--line); border-radius: 12px;
  padding: 10px 6px; text-align: center; cursor: pointer;
  font-weight: 600; font-size: 13.5px;
  display: grid; gap: 4px; justify-items: center;
}
.sentiment-pick input { position: absolute; opacity: 0; pointer-events: none; }
.sentiment-pick .face { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.sentiment-pick .face svg { width: 16px; height: 16px; stroke-width: 2.4; }
.sentiment-pick input:checked + .face + span { color: var(--ink); }
.sentiment-pick label:has(input:checked) { border-color: var(--sel); background: color-mix(in srgb, var(--sel) 10%, #fff); }
.sentiment-pick label:has(input:focus-visible) { outline: 3px solid #7fb4b9; outline-offset: 2px; }
.consent { display: flex; gap: 10px; font-size: 13.5px; color: var(--ink-2); align-items: flex-start; }
.consent input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.turnstile { min-height: 65px; }
.form-error { margin: 0; color: var(--problem); font-weight: 600; font-size: 14px; }
.invalid { border-color: var(--problem) !important; }

.about .form-body p { margin: 0; color: var(--ink-2); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.legend-key { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13.5px; }
.legend-key li { display: flex; align-items: center; gap: 6px; }
.legend-key .place-sw { width: 12px; height: 12px; border-radius: 50% 50% 50% 2px; transform: rotate(-45deg); background: var(--place); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  z-index: 1100; box-shadow: var(--shadow); font-weight: 500; max-width: calc(100vw - 32px);
}

/* ---------- mobile: panel becomes a bottom sheet ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .topbar { padding: 10px 16px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand h1 { font-size: 17px; white-space: normal; }
  .leaflet-bottom { bottom: 132px; }
  .brand-sub { display: none; }
  .topbar-actions .ghost { display: none; }
  .btn { padding: 8px 14px; }

  .layout { display: block; position: relative; }
  .map-wrap { position: absolute; inset: 0; }
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 72%;
    z-index: 700;
    border-right: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, .15);
    transform: translateY(calc(100% - 132px));
    transition: transform .25s ease;
  }
  .panel.is-open { transform: none; }
  .panel-handle { display: block; padding: 8px 0 0; cursor: pointer; }
  .panel-handle span { display: block; width: 40px; height: 5px; border-radius: 99px; background: #cfcabd; margin: 0 auto; }
  .summary { padding: 8px 16px 12px; }
  .tabs, .filters { padding-left: 16px; padding-right: 16px; }
  .basemap-toggle { bottom: 146px; }
  .panel-foot { display: none; }
  .form-sheet {
    top: auto; bottom: 0; left: 0; transform: none;
    width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0;
  }
  .form-head, .form-body, .form-foot { padding-left: 16px; padding-right: 16px; }
  .form-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .leaflet-popup-content { width: 230px; }
}
