/* Components. A view uses only these classes; internal/ui builds them. */

/* --- shell --- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 60px;
  padding: max(var(--space-2), env(safe-area-inset-top)) max(var(--space-4), env(safe-area-inset-right)) var(--space-2) max(var(--space-4), env(safe-area-inset-left));
  background: var(--surface); border-bottom: var(--border) solid var(--line);
}
.brand { font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--text-xl); color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.nav { display: flex; gap: var(--space-1); margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--touch); padding: 0 var(--space-3);
  border-radius: var(--radius-pill); color: var(--text); text-decoration: none; font-weight: 600; font-size: var(--text-md);
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
/* the dark / light switch: the sun in dark mode, the moon in light */
.nav-theme {
  display: inline-grid; place-items: center; width: var(--touch); height: var(--touch); padding: 0;
  border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text); cursor: pointer;
}
.nav-theme:hover { background: var(--surface-2); }
.nav-theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-moon, [data-theme="light"] .theme-sun { display: none; }
[data-theme="light"] .theme-moon { display: block; }
.nav a[aria-current="page"] { background: var(--text); color: var(--bg); }
/* on a phone the menu is icons; the labels stay for screen readers */
@media (max-width: 600px) {
  .nav { gap: 0; }
  .nav a { width: var(--touch); padding: 0; justify-content: center; }
  .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.page {
  width: 100%; max-width: var(--page-max); margin: 0 auto;
  padding: var(--space-6) max(var(--space-4), env(safe-area-inset-right)) max(var(--space-10), env(safe-area-inset-bottom)) max(var(--space-4), env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: var(--space-6);
}
.page-narrow { max-width: var(--form-max); }
.page-wide { max-width: var(--form-wide-max); }
.page-head { display: flex; flex-direction: column; gap: var(--space-2); }
.lede { color: var(--muted); font-size: var(--text-md); }

/* --- the login card, centred --- */
.center { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-4); }
.card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-xl);
  padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5);
  box-shadow: var(--shadow);
}

/* --- sections and boxes --- */
.box {
  background: var(--surface); border: var(--border) solid var(--line-soft); border-radius: var(--radius-xl);
  padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4);
}
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
@media (max-width: 480px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* --- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control); padding: 0 var(--space-5);
  border-radius: var(--radius-pill); border: var(--border-strong) solid var(--line);
  background: transparent; color: var(--text);
  font-weight: 700; font-size: var(--text-md); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-light { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-light:hover { background: var(--text-soft); color: var(--bg); }
.btn-danger { border-color: var(--danger); color: var(--text); }
.btn-danger:hover { background: var(--danger); color: var(--on-danger); }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 36px; padding: 0 var(--space-3); font-size: var(--text-sm); }

/* --- form fields --- */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.label { font-size: var(--text-sm); font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.hint { font-size: var(--text-sm); color: var(--muted); }
.input {
  width: 100%; min-height: var(--control); padding: 0 var(--space-4);
  border-radius: var(--radius); border: var(--border) solid var(--line);
  background: var(--bg); color: var(--text); font-size: var(--text-md);
}
textarea.input { padding: var(--space-3) var(--space-4); min-height: 96px; resize: vertical; line-height: 1.45; }
.input::placeholder { color: var(--faint); }
.field-error .input { border-color: var(--danger); }
.field-message { font-size: var(--text-sm); color: var(--error-text); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: var(--space-1); }
.check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--touch); font-size: var(--text-md); }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* --- the segmented switch (Tak / Nie / ?, Prywatna / Publiczna) --- */
.seg { display: inline-flex; width: fit-content; max-width: 100%; padding: 3px; gap: 2px; border-radius: var(--radius); background: var(--bg); border: var(--border) solid var(--line); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 0 var(--space-3); border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: 600; color: var(--muted);
}
.seg input:checked + span { background: var(--text); color: var(--bg); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --- chips --- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--touch); padding: 0 14px; border-radius: var(--radius-pill);
  background: var(--surface); border: var(--border) solid var(--line);
  color: var(--text); font-size: var(--text-md); font-weight: 600; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* --- notices --- */
.notice {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius);
  background: var(--surface-2); border: var(--border) solid var(--line); font-size: var(--text-md);
}
.notice-error { border-color: var(--danger); }
.notice-ok { border-color: var(--water); }

/* --- tables of people, categories, features --- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center;
  min-height: 56px; padding: var(--space-3) 0; border-bottom: var(--border) solid var(--line-soft);
}
.list-row:last-child { border-bottom: 0; }
.list-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-title { font-weight: 700; }
.list-meta { font-size: var(--text-sm); color: var(--muted); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text);
  font-size: var(--text-xs); font-weight: 600;
}

/* --- pickers: icons and palette colours as radio buttons --- */
.picks { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pick { position: relative; }
.pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pick > span {
  display: flex; align-items: center; justify-content: center;
  min-width: var(--touch); height: var(--touch); padding: 0 var(--space-2);
  border-radius: var(--radius); border: var(--border) solid var(--line); background: var(--bg); color: var(--text);
}
.pick-text > span { font-size: var(--text-sm); color: var(--muted); }
.pick input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch { display: inline-block; width: 26px; height: 26px; border-radius: 50%; }
.pick > span.swatch { min-width: 0; width: var(--touch); padding: 0; border: 3px solid var(--bg); }
.swatch-sm { width: 14px; height: 14px; flex: none; }
.swatch-none { border: var(--border) dashed var(--faint); }

/* --- the category tree and sortable lists --- */
.tree { list-style: none; margin: 0; padding: 0; min-height: 8px; }
.tree .tree { padding-left: var(--space-6); border-left: var(--border) dashed var(--line-soft); margin-left: var(--space-3); }
.tree-row { display: flex; align-items: center; gap: var(--space-3); min-height: var(--touch); }
.tree-row a { color: var(--text); text-decoration: none; font-weight: 600; }
.tree-row a:hover { color: var(--accent); }
.tree-grip { color: var(--faint); cursor: grab; display: inline-flex; touch-action: none; }
.sortable { list-style: none; margin: 0; padding: 0; }
.sortable-ghost { opacity: .4; }

/* --- a spot's page --- */
.spot-head { display: flex; flex-direction: column; gap: var(--space-2); }
.crumb { display: flex; align-items: center; gap: var(--space-2); color: var(--accent); font-size: var(--text-sm); font-weight: 600; }
.spot-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--muted); font-size: var(--text-sm); }
.pill-draft { background: var(--no-bg); color: var(--no-text); }
.tabs {
  display: flex; gap: 6px; padding: 5px; border-radius: var(--radius-pill);
  background: var(--surface); border: var(--border) solid var(--line-soft);
}
.tabs a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 40px; border-radius: var(--radius-pill); color: var(--text); text-decoration: none; font-weight: 600; font-size: var(--text-md);
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.spot-description { color: var(--text-soft); line-height: 1.6; white-space: pre-line; }
.frows { display: flex; flex-direction: column; }
.frow { display: flex; align-items: center; gap: var(--space-3); min-height: 52px; border-bottom: var(--border) solid var(--line-soft); }
.frow:last-child { border-bottom: 0; }
.frow-icon { width: 40px; height: 40px; border-radius: var(--radius); background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex: none; }
.frow-name { display: flex; align-items: center; gap: var(--space-2); flex: 1; min-width: 0; }
.state { margin-left: auto; padding: 5px 11px; border-radius: 14px; font-size: var(--text-sm); font-weight: 700; white-space: nowrap; }
.state-yes { background: var(--yes-bg); color: var(--yes-text); }
.state-no { background: var(--no-bg); color: var(--no-text); }
.state-unknown { border: var(--border-strong) dashed var(--faint); color: var(--no-text); }
.unknowns summary { cursor: pointer; color: var(--muted); font-size: var(--text-sm); min-height: var(--touch); display: flex; align-items: center; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: var(--border) solid var(--line-soft); border-radius: var(--radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.tile-k { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--muted); }
.tile-v { font-size: 17px; font-weight: 700; }

/* --- the compact feature badge (look A: a square with a corner mark) --- */
.fb { position: relative; width: 38px; height: 38px; border-radius: var(--radius); background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.fb-mark { position: absolute; right: -5px; bottom: -5px; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.fb-mark .ico { width: 10px; height: 10px; stroke-width: 3; }
.fb-yes .fb-mark { background: var(--yes-bg); color: var(--yes-text); }
.fb-no { color: var(--faint); }
.fb-no .fb-mark { background: var(--no-bg); color: var(--text); }
.fb-unknown { background: transparent; border: var(--border-strong) dashed var(--no-bg); }
.fb-unknown .fb-mark { background: var(--surface); color: var(--text); border-color: var(--no-bg); }

/* --- visits (look A: a timeline) --- */
.visits-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.visits-private { display: flex; align-items: center; gap: 5px; }
.visits-summary { font-size: var(--text-md); color: var(--text-soft); }
.visit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.visit { display: flex; gap: var(--space-3); align-items: flex-start; }
.visit-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); margin-top: 7px; flex: none; }
.visit-dot-latest { background: var(--accent); }
.visit-main { flex: 1; min-width: 0; }
.visit-when { font-weight: 700; }
.visit-nights { font-weight: 400; color: var(--muted); }
.visit-note { font-size: var(--text-sm); color: var(--muted); }

/* --- photos: the form's gallery and the spot page's cover --- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.photos { scroll-margin-top: 84px; }
.photo-grid { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-3); }
.photo-grid:empty { display: none; }
.photo-thumb { position: relative; width: 104px; height: 80px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); cursor: grab; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cover {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-size: var(--text-xs); font-weight: 700;
}
.photo-grip { position: absolute; top: 6px; left: 6px; color: var(--text); opacity: .85; pointer-events: none; }
.photo-del {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--radius-sm);
  display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 80%, transparent); color: var(--text); cursor: pointer;
}
.photo-del:hover { background: var(--danger); color: var(--on-danger); }
.photo-add { align-self: flex-start; cursor: pointer; }
.photo-add:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.upload-queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.upload-queue:empty { display: none; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto auto; gap: var(--space-2); align-items: center; font-size: var(--text-sm); }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item progress { width: 90px; accent-color: var(--accent); }
.upload-state { color: var(--muted); }
.upload-failed .upload-state { color: var(--error-text); }
.photo-gps { padding-top: var(--space-1); }
.spot-photos { display: flex; flex-direction: column; gap: var(--space-3); }
.spot-cover { display: block; border-radius: var(--radius-xl); overflow: hidden; background: var(--surface); aspect-ratio: 3 / 2; }
.spot-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.spot-thumbs { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-2); overflow-x: auto; }
.spot-thumbs a { display: block; width: 88px; height: 66px; border-radius: var(--radius); overflow: hidden; flex: none; }
.spot-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- the spot form --- */
.pick-map { height: 260px; border-radius: var(--radius-lg); overflow: hidden; border: var(--border) solid var(--line-soft); }
@media (min-width: 1000px) { .pick-map { height: 320px; } }
.spot-edit { display: grid; gap: var(--space-5); align-items: start; }
.spot-edit-col { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
@media (min-width: 1000px) { .spot-edit { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
/* one line per feature: name, yes/no/?, and the price, which only means something after "yes" */
.feature-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: var(--space-3); }
.feature-grid h3 { grid-column: 1 / -1; margin-top: var(--space-3); }
.feature-edit {
  grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; row-gap: var(--space-2);
  padding: var(--space-2) 0; border-bottom: var(--border) solid var(--line-soft);
}
.frow-name { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; min-width: 0; }
.feature-edit:not(:has(input[value="yes"]:checked)) .seg-price { opacity: .35; pointer-events: none; }
@media (max-width: 600px) {
  .feature-grid { grid-template-columns: minmax(0, 1fr) auto; }
  .feature-edit .seg-price { grid-column: 1 / -1; justify-self: start; }
  .feature-edit:not(:has(input[value="yes"]:checked)) .seg-price,
  .feature-edit .price-none { display: none; }
}
/* the save buttons stay in reach while the long list scrolls */
.form-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-3);
  margin: 0 calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4) max(var(--space-3), env(safe-area-inset-bottom));
  background: var(--bg); border-top: var(--border) solid var(--line-soft);
}
.unit-input { display: flex; align-items: center; gap: var(--space-2); max-width: 220px; }

/* the iPhone's install hint under the top bar */
.install-hint {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) max(var(--space-4), env(safe-area-inset-right)) var(--space-3) max(var(--space-4), env(safe-area-inset-left));
  background: var(--surface-2); color: var(--text); font-size: var(--text-sm); border-bottom: var(--border) solid var(--line);
}
.install-hint[hidden] { display: none; }
.install-hint p { margin: 0; flex: 1; }
.install-close { width: var(--touch); height: var(--touch); padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; flex: none; }

/* --- the map screen: the map fills what the top bar leaves --- */
.page-full { flex: 1 1 auto; position: relative; min-height: 0; }
.map-screen { position: absolute; inset: 0; overflow: hidden; }
/* maplibre-gl.css, linked after this file, makes its container relative; this keeps it full size */
.map-screen > .map { position: absolute; inset: 0; width: 100%; height: 100%; background: var(--bg); }
/* the search box: on the map a pill over it, on the form a row above the pin's map */
.search { display: flex; flex-direction: column; gap: var(--space-2); }
.search-box {
  display: flex; align-items: center; gap: var(--space-2); min-height: var(--control);
  padding: 4px 4px 4px var(--space-4); border-radius: var(--radius-pill);
  background: var(--surface); border: var(--border) solid var(--line); color: var(--muted);
}
.search-box:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; min-height: 40px; color: var(--text); outline: none; }
.search-out:empty { display: none; }
.search-out { background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-lg); padding: var(--space-2); box-shadow: var(--shadow); }
.search-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.search-hit {
  width: 100%; display: flex; gap: var(--space-3); align-items: flex-start; text-align: left; min-height: var(--touch);
  padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius); background: transparent; color: var(--text); cursor: pointer;
}
.search-hit:hover, .search-hit:focus-visible { background: var(--surface-2); }
.search-hit .ico { margin-top: 3px; color: var(--accent); }
.search-hit-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.search-message { margin: 0; padding: var(--space-2) var(--space-3); }
.map-search {
  position: absolute; top: var(--space-3); z-index: 3;
  left: max(var(--space-4), env(safe-area-inset-left)); right: max(var(--space-4), env(safe-area-inset-right));
}
@media (min-width: 900px) { .map-search { right: auto; width: 440px; } }
.map-search .search-box { box-shadow: var(--shadow); }
.map-chips {
  position: absolute; top: calc(var(--space-3) + var(--control) + var(--space-2)); left: 0; right: 0; z-index: 2;
  display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none;
  padding: 0 max(var(--space-4), env(safe-area-inset-right)) var(--space-1) max(var(--space-4), env(safe-area-inset-left));
}
.map-chips::-webkit-scrollbar { display: none; }
.map-chips .chip { box-shadow: var(--shadow); flex: none; }
.chip-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--on-accent); font-size: var(--text-xs); display: inline-grid; place-items: center;
}
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.map-actions {
  /* above the data credit in the bottom right corner, which must stay readable */
  position: absolute; right: max(var(--space-4), env(safe-area-inset-right)); bottom: calc(var(--space-10) + env(safe-area-inset-bottom)); z-index: 2;
  display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-3);
}
.map-round {
  width: var(--control); height: var(--control); border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: var(--surface); color: var(--text); border: var(--border) solid var(--line); box-shadow: var(--shadow); cursor: pointer;
}
.map-add { box-shadow: var(--shadow-lift); min-height: 56px; }
.map-status {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 3; max-width: calc(100% - 32px);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill); background: var(--surface); box-shadow: var(--shadow);
  font-size: var(--text-sm); text-align: center;
}
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--water); border: 3px solid var(--pin-ink); box-shadow: 0 0 0 6px color-mix(in srgb, var(--water) 30%, transparent); }
/* the card: a sheet from the bottom on a phone, a panel on the left on a wide screen */
.map-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: var(--space-5) max(var(--space-5), env(safe-area-inset-right)) calc(var(--space-5) + env(safe-area-inset-bottom)) max(var(--space-5), env(safe-area-inset-left));
  background: var(--surface); border-top: var(--border) solid var(--line); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-lift);
}
@media (min-width: 900px) {
  .map-sheet { left: var(--space-4); right: auto; bottom: var(--space-4); width: 400px; border: var(--border) solid var(--line); border-radius: var(--radius-xl); }
}
/* placing a new spot's pin: a hint where the search was, a bar like the card, the map free between */
.map-screen.placing .map-search, .map-screen.placing .map-chips, .map-screen.placing #add-start { display: none; }
.map-place {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
}
.map-place > * { pointer-events: auto; }
.map-place-hint {
  margin: var(--space-3) max(var(--space-4), env(safe-area-inset-right)) 0 max(var(--space-4), env(safe-area-inset-left));
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow);
  text-align: center;
}
.map-place-bar {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4) max(var(--space-5), env(safe-area-inset-right)) calc(var(--space-4) + env(safe-area-inset-bottom)) max(var(--space-5), env(safe-area-inset-left));
  background: var(--surface); border-top: var(--border) solid var(--line); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-lift);
}
.map-place-at { font-size: var(--text-sm); color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.map-place-buttons { display: grid; grid-template-columns: 1fr 2fr; gap: var(--space-3); }
.map-screen.placing .map-actions { bottom: calc(150px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  .map-place-hint { margin-right: auto; width: 440px; }
  .map-place-bar { margin: 0 0 var(--space-4) var(--space-4); width: 400px; border: var(--border) solid var(--line); border-radius: var(--radius-xl); }
  .map-screen.placing .map-actions { bottom: calc(var(--space-10) + env(safe-area-inset-bottom)); }
}
.map-card { position: relative; display: flex; flex-direction: column; gap: var(--space-4); }
.map-card-close {
  position: absolute; top: -6px; right: -6px; width: var(--touch); height: var(--touch); padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer;
}
.map-card-head { display: flex; gap: var(--space-4); padding-right: var(--space-8); }
.map-card-cover { width: 104px; height: 104px; border-radius: 18px; object-fit: cover; flex: none; }
.map-card-nocover { display: grid; place-items: center; background: var(--cat, var(--cat-1)); color: var(--pin-ink); }
.map-card-text { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.map-card-name { font-size: var(--text-xl); line-height: 1.15; }
.map-card-visits { display: flex; align-items: center; gap: 6px; }
.map-card-features { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-3); padding: 2px 4px 4px; }
.cat-1 { --cat: var(--cat-1); } .cat-2 { --cat: var(--cat-2); } .cat-3 { --cat: var(--cat-3); } .cat-4 { --cat: var(--cat-4); }
.cat-5 { --cat: var(--cat-5); } .cat-6 { --cat: var(--cat-6); } .cat-7 { --cat: var(--cat-7); } .cat-8 { --cat: var(--cat-8); }
/* the filter panel: a dialog, full height on a phone */
.filters-panel {
  /* the browser's own dialog:modal keeps 2em off the sides; the panel is a sheet, so none */
  width: min(560px, 100%); max-width: 100%; max-height: 100dvh; margin: auto 0 0 auto; padding: var(--space-5);
  background: var(--surface); color: var(--text); border: var(--border) solid var(--line); border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}
.filters-panel::backdrop { background: color-mix(in srgb, var(--bg) 55%, transparent); }
@media (max-width: 600px) { .filters-panel { margin: auto 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 90dvh; } }
.filters-head { display: flex; justify-content: space-between; align-items: center; }
.filters-head .map-card-close { position: static; }
.check-hint { display: block; }
.maplibregl-ctrl-attrib { font-size: 11px; }

/* --- icons --- */
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 26px; height: 26px; }
