/* pinmap — app.css
 *
 * Hand-written, no framework. Everything visual lives here.
 *
 * Two structural decisions worth knowing before you edit anything:
 *
 * 1. #sidebar and #map are position:fixed rather than laid out in a flex row.
 *    The HTML may or may not wrap them in a container, and a Leaflet map inside a
 *    zero-height box renders as a blank grey rectangle. Fixed insets give the map an
 *    explicit height at every breakpoint no matter what the surrounding markup does.
 *
 * 2. The mobile bottom sheet animates HEIGHT, not transform. A transform on #sidebar
 *    would make it the containing block for its position:fixed descendants (the two
 *    floating map buttons), which would strand them inside the sheet. Same reason
 *    there is no backdrop-filter / will-change / contain on #sidebar.
 */

/* ------------------------------------------------------------------ tokens */

:root {
  color-scheme: dark;

  --bg:            #0d1014;
  --surface:       #141920;
  --surface-2:     #1a212a;
  --surface-3:     #212a35;
  --surface-hover: #1f2731;
  --border:        #262f3b;
  --border-strong: #35414f;

  --text:       #e8eef5;
  --text-dim:   #b4bfcc;   /* raised from #9aa7b6 for ~4.5:1 on surface */
  --text-faint: #8b96a5;   /* raised from #6b7889 for field labels */

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  /* Settled sheet occlusion height (mobile); 0 on desktop. */
  --sheet-h: 0px;

  --accent:        #4eabda;
  --accent-strong: #6bc0e9;
  --accent-ink:    #06121a;
  --accent-soft:   rgba(78, 171, 218, 0.14);
  --accent-line:   rgba(78, 171, 218, 0.42);

  --ok:      #3dd68c;
  --warn:    #f0b429;
  --danger:  #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.13);

  --scrim: rgba(5, 8, 12, 0.62);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:    0 6px 20px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55);

  /* pin palette — data colors, identical in both themes */
  --pin-red:    #e5484d;
  --pin-orange: #f76b15;
  --pin-amber:  #f5b014;
  --pin-green:  #30a46c;
  --pin-teal:   #12a594;
  --pin-blue:   #4f7cf0;
  --pin-violet: #9b62d6;
  --pin-pink:   #d6409f;
  --pin-slate:  #7b8794;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --r-xs: 5px;
  --r-sm: 8px;
  --r:    11px;
  --r-lg: 15px;
  --r-xl: 20px;

  --sidebar-w: 340px;
  --geo-rail-w: clamp(320px, 28vw, 400px);
  --peek: 92px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  --fast: 130ms cubic-bezier(0.4, 0, 0.2, 1);
  --slow: 300ms cubic-bezier(0.32, 0.72, 0, 1);

  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%239aa7b6' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg:            #eef1f5;
    --surface:       #ffffff;
    --surface-2:     #f5f7fa;
    --surface-3:     #e9eef4;
    --surface-hover: #eef2f7;
    --border:        #dde3ec;
    --border-strong: #c2ccda;

    --text:       #17212c;
    --text-dim:   #445266;   /* ~4.5:1 on white */
    --text-faint: #5a6578;

    --accent:        #1b7fae;
    --accent-strong: #146a94;
    --accent-ink:    #ffffff;
    --accent-soft:   rgba(27, 127, 174, 0.11);
    --accent-line:   rgba(27, 127, 174, 0.4);

    --ok:      #17864f;
    --warn:    #a16207;
    --danger:  #c62a2f;
    --danger-soft: rgba(198, 42, 47, 0.09);

    --scrim: rgba(20, 28, 38, 0.4);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.08);
    --shadow:    0 6px 20px rgba(16, 24, 40, 0.12);
    --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.18);

    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%2355637a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

/* pin color hooks — whichever convention the markup uses, one of these lands */
[data-color="red"],    .color-red,    .swatch-red,    .c-red    { --pin: var(--pin-red); }
[data-color="orange"], .color-orange, .swatch-orange, .c-orange { --pin: var(--pin-orange); }
[data-color="amber"],  .color-amber,  .swatch-amber,  .c-amber  { --pin: var(--pin-amber); }
[data-color="green"],  .color-green,  .swatch-green,  .c-green  { --pin: var(--pin-green); }
[data-color="teal"],   .color-teal,   .swatch-teal,   .c-teal   { --pin: var(--pin-teal); }
[data-color="blue"],   .color-blue,   .swatch-blue,   .c-blue   { --pin: var(--pin-blue); }
[data-color="violet"], .color-violet, .swatch-violet, .c-violet { --pin: var(--pin-violet); }
[data-color="pink"],   .color-pink,   .swatch-pink,   .c-pink   { --pin: var(--pin-pink); }
[data-color="slate"],  .color-slate,  .swatch-slate,  .c-slate  { --pin: var(--pin-slate); }

/* ------------------------------------------------------------------- reset */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* !important because this competes with layout rules on the same elements and
   loses. #pin-count carries the hidden attribute while a selection exists, yet
   still rendered at 41px inside the flex toolbar -- so "1 selected" and "29 pins"
   both squeezed in and BOTH ellipsised to "1 selec..." / "29 p...". An element
   asking to be hidden should always win; nothing here ever wants a visible
   [hidden] node. */
[hidden] { display: none !important; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 { font-size: 17px; }
h2 { font-size: 15px; }
h3, h4 { font-size: 13.5px; }

p { margin: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 999px;
}

/* ------------------------------------------------------------------ layout */

#map {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}

#sidebar {
  position: fixed;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* scroll lives in #sidebar-scroll only */
  background: var(--surface);
  color: var(--text);
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px 16px;
}

.sheet-chrome {
  flex: none;
  padding: 0 14px 4px;
}
/* Compact peek row: readable count + utility actions. Product name stays in
   the document/PWA title instead of consuming the phone's narrowest row. */
.peek-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  flex-wrap: nowrap;
}
.peek-title-row #pin-count {
  flex: 1 1 auto;
  min-width: 0;
}
.peek-title-row .header-actions {
  flex: none;
  margin-left: auto;
}
#sidebar .peek-title-row .icon-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
}
.pin-select-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  margin: 0;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.pin-select-wrap:hover {
  background: var(--surface-hover);
}
.pin-row-toggle {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 6px 8px 6px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.pin-row-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
#pin-list > li.pin-row {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
/* Empty-state CTA must keep real height (not zeroed by list button rules). */
#pin-list .empty-cta,
#pin-list button.empty-cta {
  min-height: 44px !important;
  height: auto !important;
  width: 100%;
  margin-top: 4px;
  opacity: 1;
}
.pm-empty .empty-title,
.pm-empty .empty-body {
  opacity: 1;
  color: var(--text-dim);
}
.pm-empty .empty-title {
  color: var(--text);
  font-weight: 650;
}
.pm-empty .empty-body {
  color: var(--text-dim);
}

.sheet-handle-btn {
  display: none; /* mobile only */
}

/* ------------------------------------------------------ desktop >= 860px */

@media (min-width: 860px) {
  #sidebar {
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    padding: 0;
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  }

  .sheet-chrome {
    padding: 16px 16px 4px;
  }
  .sidebar-scroll {
    padding: 0 16px 16px;
  }

  #map {
    left: var(--sidebar-w);
  }

  /* Desktop ignores sheet state attributes */
  #sidebar[data-sheet-state] {
    height: auto !important;
  }
  #sidebar-scroll[inert] {
    /* never inert on desktop */
  }
}

/* ------------------------------------------------------- mobile < 860px */

@media (max-width: 859.98px) {
  #sidebar {
    right: 0;
    bottom: 0;
    left: 0;
    /* Height driven by --sheet-h from app.js (peek|half|full). */
    height: var(--sheet-h, calc(104px + var(--safe-b)));
    padding: 0;
    border-top: 1px solid var(--border);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.32);
    transition: height var(--slow), box-shadow var(--slow);
  }

  @media (prefers-reduced-motion: reduce) {
    #sidebar {
      transition: none;
    }
  }

  .sheet-handle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    background: transparent;
    cursor: pointer;
    color: var(--text-dim);
  }
  .sheet-handle-bar {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
  }
  .sheet-handle-btn:hover .sheet-handle-bar,
  .sheet-handle-btn:focus-visible .sheet-handle-bar {
    background: var(--text-dim);
  }
  .sheet-handle-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }

  .sheet-chrome {
    padding: 0 14px 2px;
  }
  .sidebar-scroll {
    padding: 0 14px calc(12px + var(--safe-b));
  }

  /* NO :hover / :focus-within / :has(:checked) height ownership. */
}

/* ------------------------------------------ responsive place-result browser */

/* The result browser is created by app.js. Its appearance lives here rather
   than in injected hard-coded black CSS so dark/light tokens stay authoritative. */
.pm-geo {
  position: fixed;
  inset: 0;
  z-index: 1600;
  color: var(--text);
  font: 14px/1.4 var(--sans);
  pointer-events: none;
}

.pm-geo-backdrop {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  pointer-events: auto;
  animation: fade-in 140ms ease-out;
}

.pm-geo-panel {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

.pm-geo-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex: none;
  align-items: flex-start;
  gap: 12px;
  min-height: 68px;
  padding: 12px 12px 11px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.pm-geo-head-copy {
  flex: 1 1 auto;
  min-width: 0;
}
.pm-geo-title {
  color: var(--text);
  font-size: 17px;
  line-height: 1.3;
}
.pm-geo-meta {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.pm-geo button {
  margin: 0;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.pm-geo button:disabled {
  cursor: default;
  opacity: 0.45;
}
.pm-geo-close,
.pm-geo-minimize,
.pm-geo-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-weight: 600;
}
.pm-geo-close {
  flex: none;
}
.pm-geo-close:hover,
.pm-geo-minimize:hover,
.pm-geo-nav-btn:not(:disabled):hover {
  background: var(--surface-3);
  border-color: var(--accent-line);
}

.pm-geo-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.pm-geo-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  min-height: 56px;
  padding: 11px 14px 11px 12px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-inline-start: 4px solid transparent;
  border-radius: 0;
}
.pm-geo-item:hover {
  background: var(--surface-hover);
}
.pm-geo-item:focus-visible {
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: -3px;
  border-radius: 0;
}
.pm-geo-item[aria-selected="true"] {
  background: var(--accent-soft);
  border-inline-start-color: var(--accent);
}
.pm-geo-number {
  display: inline-flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  color: var(--text-dim);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.pm-geo-item[aria-selected="true"] .pm-geo-number {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
.pm-geo-item-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.pm-geo-primary {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.pm-geo-secondary {
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}
.pm-geo-kind {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.3;
  text-transform: capitalize;
}
.pm-geo-previewing {
  display: none;
  margin-top: 3px;
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
}
.pm-geo-item[aria-selected="true"] .pm-geo-previewing {
  display: inline;
}

.pm-geo-navigator {
  position: absolute;
  display: grid;
  align-items: stretch;
  gap: 7px;
  padding: 8px;
  padding-bottom: max(8px, var(--safe-b));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}
.pm-geo-nav-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 2px 7px;
}
.pm-geo-nav-position {
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
}
.pm-geo-nav-label {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Leaflet place-result markers: 44px interactive target with a compact numbered
   badge. These are temporary search affordances, visually unlike saved pins. */
.pm-map-result-marker {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 44px !important;
  height: 44px !important;
  background: transparent;
  border: 0;
}
.pm-map-result-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  font: 750 13px/1 var(--sans);
}
.pm-map-result-marker:hover .pm-map-result-number,
.pm-map-result-marker:focus .pm-map-result-number,
.pm-map-result-number.is-selected {
  width: 36px;
  height: 36px;
  border-width: 3px;
  box-shadow: 0 0 0 3px var(--accent-line), 0 3px 10px rgba(0, 0, 0, 0.6);
}
.pm-map-result-marker:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-radius: 999px;
}

/* Wide result rail is true layout: the map's right edge moves left immediately.
   There is deliberately no transition on #map, so Leaflet's ResizeObserver sees
   one settled size instead of chasing an animation. */
@media (min-width: 1180px) {
  body.pm-geo-docked #map {
    right: var(--geo-rail-w);
  }
  .pm-geo.pm-geo-wide.is-list-open {
    right: 0;
    left: auto;
    width: var(--geo-rail-w);
  }
  .pm-geo-wide .pm-geo-panel {
    inset: 0;
    padding: var(--safe-t) var(--safe-r) var(--safe-b) 0;
    border-width: 0 0 0 1px;
    border-radius: 0;
  }
  .pm-geo-wide .pm-geo-backdrop {
    display: none;
  }
  .pm-geo-wide.is-collapsed .pm-geo-navigator {
    top: calc(12px + var(--safe-t));
    right: calc(12px + var(--safe-r));
    bottom: auto;
    left: auto;
    grid-template-columns: minmax(120px, auto) auto auto;
    width: min(360px, calc(100vw - var(--sidebar-w) - 24px));
  }
  .pm-geo-wide.is-collapsed .pm-geo-prev,
  .pm-geo-wide.is-collapsed .pm-geo-next {
    display: none;
  }
}

/* Compact/tablet result list is a modal bottom sheet. The collapsed navigator
   alone accepts pointer input; the full-screen root cannot block the map. */
@media (max-width: 1179.98px) {
  .pm-geo-compact .pm-geo-panel {
    right: max(16px, var(--safe-r));
    bottom: max(16px, var(--safe-b));
    left: calc(var(--sidebar-w) + max(16px, var(--safe-l)));
    width: auto;
    max-width: 680px;
    max-height: min(76vh, 720px);
    max-height: min(76dvh, 720px);
    margin-inline: auto;
    border-radius: var(--r-xl);
    animation: sheet-in 220ms cubic-bezier(0.32, 0.72, 0, 1);
  }
  .pm-geo-compact .pm-geo-list {
    padding-bottom: 8px;
  }
  .pm-geo-compact .pm-geo-navigator {
    right: max(16px, var(--safe-r));
    bottom: max(16px, var(--safe-b));
    left: calc(var(--sidebar-w) + max(16px, var(--safe-l)));
    grid-template-columns: auto minmax(100px, 1fr) auto auto auto;
    width: auto;
    max-width: 760px;
    margin-inline: auto;
  }
}

@media (max-width: 859.98px) {
  .pm-geo-compact .pm-geo-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    max-height: 82vh;
    max-height: 82dvh;
    margin: 0;
    padding-bottom: var(--safe-b);
    border-width: 1px 0 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .pm-geo-compact .pm-geo-head {
    padding-right: max(12px, var(--safe-r));
    padding-left: max(16px, var(--safe-l));
  }
  .pm-geo-compact .pm-geo-list {
    padding-bottom: max(8px, var(--safe-b));
  }
  .pm-geo-compact .pm-geo-navigator {
    right: max(8px, var(--safe-r));
    bottom: calc(var(--sheet-h, 0px) + 8px);
    left: max(8px, var(--safe-l));
    grid-template-columns: auto minmax(0, 1fr) auto;
    width: auto;
    max-width: 620px;
    margin-inline: auto;
  }
  .pm-geo-compact .pm-geo-show-list {
    grid-column: 1 / 3;
  }
  .pm-geo-compact .pm-geo-nav-close {
    grid-column: 3;
  }
}

/* ---------------------------------------------------------- form controls */

/* Checkboxes and radios are deliberately excluded. This block is for text-ish
   form controls; applying width:100% + padding to a checkbox stretched the
   bulk-select box to the full 662px row width and shoved the pin label off the
   edge entirely. `.pin-select-cb` already sets width:18px, but `#sidebar input`
   is specificity (1,0,1) and a lone class is (0,1,0), so the global rule won.
   Narrowing the selector fixes it at the source instead of escalating with
   !important -- and stops the same thing happening to the next checkbox added. */
#sidebar input:not([type="checkbox"]):not([type="radio"]),
#sidebar textarea,
#sidebar select,
#editor input:not([type="checkbox"]):not([type="radio"]),
#editor textarea,
#editor select {
  width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 8px 11px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
}

#sidebar input::placeholder,
#editor input::placeholder,
#editor textarea::placeholder {
  color: var(--text-faint);
}

#sidebar input:not([type="checkbox"]):not([type="radio"]):hover,
#sidebar textarea:hover,
#sidebar select:hover,
#editor input:not([type="checkbox"]):not([type="radio"]):hover,
#editor textarea:hover,
#editor select:hover {
  border-color: var(--border-strong);
}

#sidebar input:not([type="checkbox"]):not([type="radio"]):focus,
#sidebar textarea:focus,
#sidebar select:focus,
#editor input:not([type="checkbox"]):not([type="radio"]):focus,
#editor textarea:focus,
#editor select:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#sidebar select,
#editor select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}

/* The editor grew a lot of fields (address, three 1-5 ratings, three tri-states,
   verified date). That pushed Save/Navigate/Delete ~220px below the fold, so the
   panel's primary action was invisible until you scrolled — worse on a phone,
   where it landed 224px down. `.editor-actions` also had no rule at all, so it
   defaulted to display:block and the three buttons stacked vertically, adding
   even more height. Pin the row to the bottom of the editor's scrollport and lay
   it out as a row so Save is always reachable without scrolling. */
.editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  gap: 8px;
  /* bleed over the panel's 16px side padding so the bar spans full width */
  margin: 14px -16px 0;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.editor-actions > button {
  flex: 1 1 0;
  min-height: 44px;
  white-space: nowrap;
}

/* Save carries the most weight, so give it a little more room than the others */
.editor-actions > #btn-save {
  flex: 1.35 1 0;
}

/* These two sat a hair under the 44px minimum tap target on mobile. */
#btn-add-mode,
#btn-export {
  min-width: 44px;
}

#editor-notes {
  min-height: 84px;
  line-height: 1.5;
  resize: vertical;
}

/* Field captions only. `.master-select-wrap` is a <label> wrapping the master
   checkbox, not a caption -- and this rule is specificity (1,0,1) against its
   class's (0,1,0), so it was winning and applying display:block plus a 5px
   bottom margin. That margin is what pushed the master checkbox off-centre and
   made it look like it was floating above the toolbar rather than sitting in it.
   Same shape as the width:100% problem that has now hit a text input, a colour
   select and a checkbox: these blanket element rules inside #sidebar/#editor
   catch controls they were never meant for. Exclude, do not escalate. */
#sidebar label:not(.master-select-wrap),
#editor label:not(.master-select-wrap) {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------------------------------------------------------------- buttons */

#sidebar button,
#editor button,
#nav-sheet button,
#nav-sheet a {
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 14px;
  min-height: 38px;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast),
              color var(--fast), transform var(--fast);
}

#sidebar button:hover,
#editor button:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

#sidebar button:active,
#editor button:active,
#nav-sheet button:active,
#nav-sheet a:active {
  transform: translateY(1px);
}

#sidebar button:disabled,
#editor button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

/* primary */
#btn-save,
#btn-search-place {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
#btn-save:hover,
#btn-search-place:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}

/* destructive */
#btn-delete {
  color: var(--danger);
  background: transparent;
  border-color: var(--border);
}
#btn-delete:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

/* quiet */
#btn-clear-filters,
#btn-close-editor {
  color: var(--text-dim);
  background: transparent;
}
#btn-clear-filters:hover,
#btn-close-editor:hover {
  color: var(--text);
  background: var(--surface-3);
}

#btn-navigate {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
#btn-navigate:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* add-mode toggle: on/off is a real state, so show it loudly */
#btn-add-mode.active,
#btn-add-mode.is-active,
#btn-add-mode.on,
#btn-add-mode.armed,
#btn-add-mode[aria-pressed="true"],
#btn-add-mode[data-active="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

body.add-mode #map,
#map.add-mode,
.leaflet-container.add-mode,
.leaflet-container.adding {
  cursor: crosshair;
}

/* -------------------------------------------------------- sidebar content */

#pin-count {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* Filter popover is a column of rows, not a wrap of chips. */
#tag-filters {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag-chip-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
/* Recolour popup swatches only — not used as a second colour block on filter rows. */
.tag-color-dot {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  flex: none;
}
.pm-tag-color-pop {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  max-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.pm-tag-color-pop .pm-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  padding: 0;
}

/* Tag *chips* elsewhere (row tags, editor). Filter rows are .tag-filter-row below —
   do NOT hide their checkboxes or paint them as pills. */

/* --------------------------------------------------------------- pin list */

#pin-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

#pin-list > li {
  position: relative;
  margin: 0 0 2px;
  /* Tighter rhythm so ~26 pins scan; left pad leaves room for the colour rail. */
  padding: 7px 10px 7px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), box-shadow var(--fast);
}

/* Left colour rail — keep this; it is the primary colour signal on the row. */
#pin-list > li[data-color]::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 3px;
  width: 3px;
  border-radius: 2px;
  background: var(--pin, var(--border-strong));
  /* Sit above selection tint; never get washed out when the row is selected. */
  z-index: 1;
  pointer-events: none;
}

#pin-list > li:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

/* Keyboard focus: ring only, no size change */
#pin-list > li:focus {
  outline: none;
}
#pin-list > li:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent-line);
}

/* Editor-open highlight — quieter than bulk multi-select */
#pin-list > li.selected,
#pin-list > li.is-selected,
#pin-list > li.active,
#pin-list > li.is-active,
#pin-list > li[aria-selected="true"],
#pin-list > li[aria-current="true"],
#pin-list > li[data-selected="true"] {
  background: var(--surface-2);
  border-color: var(--accent-line);
}

/* Bulk multi-select — calm wash, no left accent bar (rail owns the left edge) */
#pin-list > li.bulk-selected {
  background: var(--accent-soft);
  border-color: transparent;
  box-shadow: none;
}
#pin-list > li.bulk-selected:hover {
  background: var(--accent-soft);
  border-color: var(--border);
}
#pin-list > li.bulk-selected.selected {
  border-color: var(--accent-line);
}

/* rows are often a button/anchor for keyboard access — strip its chrome */
#pin-list > li > button,
#pin-list > li > a {
  display: block;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
#pin-list > li > button:hover,
#pin-list > li > a:hover {
  background: none;
  border-color: transparent;
}

#pin-list h3,
#pin-list h4,
#pin-list strong,
#pin-list b,
#pin-list .label,
#pin-list .pin-label,
#pin-list .title,
#pin-list .pm-row-label {
  display: block;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 22px;
  color: var(--text);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Secondary: notes / address preview recede */
#pin-list p,
#pin-list small,
#pin-list .notes,
#pin-list .note,
#pin-list .preview,
#pin-list .pm-row-notes {
  display: block;
  overflow: hidden;
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 400;
  color: var(--text-faint);
  white-space: nowrap;
  text-overflow: ellipsis;
}

#pin-list .distance,
#pin-list .dist,
#pin-list .miles,
#pin-list .pm-row-dist {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  white-space: nowrap;
  flex: none;
}

/* mini tag chips inside a row — secondary, not competing with the label */
#pin-list .tag,
#pin-list .chip,
#pin-list .tags > *,
#pin-list .pm-row-tags .tag-chip {
  display: inline-flex;
  align-items: center;
  margin: 0 4px 0 0;
  padding: 0 7px;
  min-height: 18px;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text-dim);
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0.92;
}

#pin-list .pm-row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin: 1px 0 0;
}

#pin-list .dot,
#pin-list .pin-dot,
#pin-list .swatch,
#pin-list .marker,
#pin-list .pm-row-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pin, var(--text-faint));
}

/* Rail is the colour signal — hide the redundant inline dot when present */
#pin-list > li[data-color] .pm-row-dot {
  display: none;
}

#pin-list:empty::after,
#pin-list .empty,
#pin-list .pm-empty {
  display: block;
  padding: 18px 4px;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}
#pin-list:empty::after { content: "No pins match."; }

/* ------------------------------------------------------------- status bar */

#status-bar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px -16px 0;
  padding: 9px 16px calc(9px + var(--safe-b));
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

#status-bar::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 3px transparent;
  transition: background var(--fast), box-shadow var(--fast);
}

#status-bar.online::before,
#status-bar.is-online::before,
#status-bar[data-state="online"]::before,
#status-bar[data-status="online"]::before {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.16);
}

#status-bar.pending::before,
#status-bar.syncing::before,
#status-bar.is-pending::before,
#status-bar[data-state="pending"]::before,
#status-bar[data-status="pending"]::before,
#status-bar[data-state="syncing"]::before {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.18);
  animation: pulse 1.6s ease-in-out infinite;
}

#status-bar.offline::before,
#status-bar.is-offline::before,
#status-bar[data-state="offline"]::before,
#status-bar[data-status="offline"]::before {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.16);
}

#status-bar.offline,
#status-bar.is-offline,
#status-bar[data-state="offline"],
#status-bar[data-status="offline"] { color: var(--danger); }

#status-bar.pending,
#status-bar.syncing,
#status-bar.is-pending,
#status-bar[data-state="pending"],
#status-bar[data-status="pending"] { color: var(--warn); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

@media (max-width: 859.98px) {
  #status-bar {
    margin: 10px -14px 0;
    padding: 10px 14px calc(10px + var(--safe-b));
  }
}

/* ----------------------------------------------------------- editor panel */

#editor {
  position: fixed;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  -webkit-overflow-scrolling: touch;
}

/* Layout primitives used by index.html (filters + editor + sidebar header) */
.field { margin-bottom: 0; }
.field-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.field-row > .field { flex: 1 1 0; min-width: 0; }
.site-attrs select { width: 100%; }

/* Global width:100% on inputs/selects breaks flex rows — text fields collapse.
   Text/search inputs grow; compact selects/buttons stay fixed. */
.field-row > input[type="text"],
.field-row > input[type="search"],
.field-row > .tag-suggest-wrap {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
}
.field-row > select,
.field-row > .tag-color-select,
.field-row > .tag-mode-select {
  flex: 0 0 auto;
  width: auto !important;
  min-width: 6.5rem;
  max-width: 8rem;
}
.field-row > button {
  flex: 0 0 auto;
  width: auto !important;
  white-space: nowrap;
}
.tag-suggest-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.tag-suggest-wrap > input {
  width: 100% !important;
}
.tag-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 1500;
  margin-top: 2px;
  max-height: 180px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
}
.tag-suggest-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  min-height: 40px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.tag-suggest-item:hover,
.tag-suggest-item:focus {
  background: var(--surface-2);
  outline: none;
}
.tag-filter-create {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Header / list rows — index.html emits these classes; without flex they stack. */
.title-row,
.header-actions,
.list-head,
.sidebar-header .title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.title-row,
.list-head {
  justify-content: space-between;
}
.header-actions {
  flex: none;
}
.list-head {
  margin-top: 8px;
}

/* Place search is primary - keep it above the fold */
.place-search {
  margin: 0 0 12px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--border);
}
.place-preview-status {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-dim);
  min-height: 1.2em;
}
.place-actions {
  margin-top: 8px;
  flex-wrap: wrap;
}
.place-radius-controls {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.place-radius-controls[data-active="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.place-radius-row {
  flex-wrap: wrap;
  align-items: center;
}
.place-radius-row > select {
  flex: 0 0 6.5rem;
  min-height: 44px;
}
#sidebar .place-radius-row > button {
  min-height: 44px;
  padding: 9px 12px;
}
.radius-filter-status {
  min-height: 1.2em;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-dim);
}

/* Always-on selection toolbar: master + count + Edit/Delete as one strip.
   nowrap is load-bearing: wrap grew the bar 49→97px on select and shoved the list. */
.list-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin: 6px 0 8px;
  /* 46, not 44. Everything is border-box and the strip has a 1px border, so a
     44px height leaves 42px of content -- and the 44px master-checkbox target
     then overflowed by 2px and visibly floated above the bar instead of sitting
     in it. 46 gives exactly 44px of content so the target fits. */
  min-height: 46px;
  height: 46px;
  padding: 0 6px 0 2px;
  box-sizing: border-box;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
/* Master select: ≥44px hit target wrapping checkbox + "Select visible" label.
   Do not hard-width to 44px — that crushed the visible label (Task 11). */
.master-select-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex: none;
  align-self: center;
  min-width: 44px;
  min-height: 44px;
  height: 100%;
  max-height: 44px;
  margin: 0;
  padding: 0 6px 0 2px;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.master-select-wrap:hover {
  background: var(--surface-hover);
}

/* Custom checkboxes — keep real <input type=checkbox> for a11y/keyboard.
   appearance:none + ::after for check / dash. Never width:100%. */
.master-select-wrap .pin-select-cb,
.pin-select-cb {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  box-sizing: border-box;
  position: relative;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  max-width: 18px;
  max-height: 18px;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--accent-ink);
  cursor: pointer;
  vertical-align: middle;
  transition: background var(--fast), border-color var(--fast), box-shadow var(--fast);
}
.pin-select-cb:hover {
  border-color: var(--accent);
}
.pin-select-cb:focus {
  outline: none;
}
.pin-select-cb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pin-select-cb:checked {
  background: var(--accent);
  border-color: var(--accent);
}
/* Checkmark */
.pin-select-cb:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 5px;
  height: 9px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
/* Indeterminate dash — master only, visually distinct from checked */
.pin-select-cb:indeterminate {
  background: var(--surface);
  border-color: var(--accent);
}
.pin-select-cb:indeterminate::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 50%;
  width: auto;
  height: 2px;
  margin-top: -1px;
  border: 0;
  border-radius: 1px;
  background: var(--accent);
  transform: none;
}

.selection-count,
.pin-count {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.selection-count {
  color: var(--text);
}

.bulk-bar {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  margin-left: auto;
  padding-left: 4px;
  border-left: 1px solid var(--border);
}
.bulk-bar .link-btn,
.bulk-bar .danger {
  flex: none;
  white-space: nowrap;
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
  margin: 0;
  font-size: 13px;
  font-weight: 550;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
}
.bulk-bar .link-btn {
  color: var(--text);
}
.bulk-bar .link-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}
/* Destructive but quiet — not a full red brick */
.bulk-bar .danger {
  color: var(--danger);
  background: transparent;
}
.bulk-bar .danger:hover {
  background: var(--danger-soft);
  border-color: rgba(229, 72, 77, 0.28);
  color: var(--danger);
}
.bulk-bar .danger:focus-visible,
.bulk-bar .link-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.pin-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 8px;
  /* Padding lives on #pin-list > li; avoid double-padding here. */
  padding: 0;
  min-height: 0;
  box-sizing: border-box;
}
/* Align checkbox to the 22px label line: (22 - 18) / 2 = 2px. Re-measure if
   line-height or box size changes. */
.pin-row > .pin-select-cb {
  margin-top: 2px;
  flex: none;
}
.pin-row-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* Coordinate-only rows still need a solid first-line height */
  min-height: 22px;
  justify-content: center;
}
.pin-row .pm-row-top {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}
.pin-row .pm-row-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* bulk-selected styling is on #pin-list > li.bulk-selected above */
.bulk-edit .editor-title {
  font-size: 1rem;
}

/* ---------- pin details glance (list expand + map tooltip/popup) ---------- */

#pin-list > li.is-expanded {
  background: var(--surface-2);
  border-color: var(--border);
}

.pm-pin-details {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: pm-expand-in 140ms ease-out;
}
.pm-pin-details.is-compact {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  gap: 5px;
  animation: none;
}
.pm-pin-tip-title {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pm-pin-ratings {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pm-rating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
}
.pm-rating-label {
  flex: 0 0 52px;
  width: 52px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.pm-rating-stars {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
}
.pm-star {
  flex: none;
  display: block;
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.6;
  color: var(--border-strong);
}
.pm-star-filled {
  fill: var(--warn);
  stroke: var(--warn);
  color: var(--warn);
}
.pm-rating-row.is-unrated .pm-star {
  opacity: 0.55;
}
.pm-rating-hint {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  font-style: italic;
}
.pm-pin-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pm-pin-meta-line {
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.35;
}
.pm-pin-coords {
  font-family: var(--mono);
  font-size: 11px;
}
.pm-pin-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.pm-pin-detail-actions .link-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
}
.pm-pin-detail-actions .link-btn:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

@keyframes pm-expand-in {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pm-pin-details { animation: none; }
}

/* Leaflet tooltip (desktop hover) */
.leaflet-tooltip.pm-pin-tip {
  padding: 8px 10px;
  max-width: 260px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font: 12px/1.35 var(--sans);
  white-space: normal;
}
.leaflet-tooltip.pm-pin-tip::before {
  border-top-color: var(--surface);
}
.leaflet-tooltip-top.pm-pin-tip::before {
  border-top-color: var(--border);
}

/* Leaflet popup (touch tap) — sit above the mobile sheet peek */
.leaflet-popup.pm-pin-popup {
  z-index: 1200;
}
.leaflet-popup.pm-pin-popup .leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 0;
}
.leaflet-popup.pm-pin-popup .leaflet-popup-content {
  margin: 10px 12px;
  min-width: 180px;
  max-width: 280px;
  font: 12.5px/1.35 var(--sans);
}
.leaflet-popup.pm-pin-popup .leaflet-popup-tip {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: none;
}
.leaflet-popup.pm-pin-popup .leaflet-popup-close-button {
  color: var(--text-dim);
  font-size: 22px;
  line-height: 44px;
  padding: 0;
  width: 44px;
  height: 44px;
  text-align: center;
}
.leaflet-popup.pm-pin-popup .leaflet-popup-close-button:hover {
  color: var(--text);
}

@media (prefers-color-scheme: light) {
  .pm-star-filled {
    fill: #c98500;
    stroke: #c98500;
  }
  .leaflet-tooltip.pm-pin-tip,
  .leaflet-popup.pm-pin-popup .leaflet-popup-content-wrapper {
    background: #fff;
  }
}

@media (prefers-reduced-motion: reduce) {
  #pin-list > li,
  .pin-select-cb {
    transition: none;
  }
}

@media (prefers-color-scheme: light) {
  /* Light: slightly stronger row hover so the list does not look washed out */
  #pin-list > li:hover {
    background: var(--surface-3);
  }
  #pin-list > li.bulk-selected {
    background: rgba(27, 127, 174, 0.09);
  }
  .list-toolbar {
    background: var(--surface);
    border-color: var(--border-strong);
  }
  .pin-select-cb {
    background: var(--surface);
    border-color: var(--border-strong);
  }
  .pin-select-cb:checked {
    background: var(--accent);
    border-color: var(--accent);
  }
}

/* Tag filter dropdown */
.tag-filter-btn {
  width: 100%;
  text-align: left;
  min-height: 38px;
  position: relative;
}
.tag-filter-pop {
  position: absolute;
  z-index: 1400;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.filters .field { position: relative; }
/* [checkbox] [colour dot = recolour] [name] — one colour surface, real checkbox */
.tag-filter-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 2px 4px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  box-sizing: border-box;
  user-select: none;
}
.tag-filter-row:hover,
.tag-filter-row:focus {
  background: var(--surface-2);
  outline: none;
}
.tag-filter-row[aria-selected="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
/* Same visual language as pin-list checkboxes (Task 7). Never 1×1 / opacity:0. */
.tag-filter-cb,
#tag-filters .tag-filter-cb {
  appearance: none;
  -webkit-appearance: none;
  position: static;
  flex: none;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  max-width: 18px;
  margin: 0;
  padding: 0;
  opacity: 1;
  pointer-events: auto;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
  cursor: pointer;
  /* 44px tap via padding on the row; box stays 18px */
}
.tag-filter-cb:checked,
#tag-filters .tag-filter-cb:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.tag-filter-cb:checked::after,
#tag-filters .tag-filter-cb:checked::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  margin: 1.5px 0 0 5px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.tag-filter-cb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Recolour control: 44×44 transparent hit box; 18–22px coloured disc inside.
   Beats `#sidebar button { min-height: 38px }` via higher specificity. */
#tag-filters button.tag-filter-swatch,
.tag-filter-row > button.tag-filter-swatch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  line-height: 0;
  font-size: 0;
  transition: background var(--fast);
}
#tag-filters button.tag-filter-swatch:hover,
.tag-filter-row > button.tag-filter-swatch:hover {
  background: var(--surface-hover);
  transform: none;
}
#tag-filters button.tag-filter-swatch:focus-visible,
.tag-filter-row > button.tag-filter-swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.tag-filter-swatch-disc {
  display: block;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28) inset;
  pointer-events: none;
}
#tag-filters button.tag-filter-swatch:hover .tag-filter-swatch-disc {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.28) inset,
    0 0 0 2px var(--accent-line);
}

/* Editor type-ahead colour chips (not filter recolour buttons). */
.tag-suggest-swatch {
  flex: none;
  display: inline-block;
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25) inset;
}
.tag-filter-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 550;
}
.tag-filter-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  align-items: center;
}
.tag-filter-create {
  display: none; /* removed from markup; keep rule harmless if residual CSS */
}
.empty-title { font-weight: 650; margin-bottom: 6px; color: var(--text); }
.empty-body { font-size: 13px; line-height: 1.4; margin-bottom: 10px; color: var(--text-dim); }
.empty-cta { width: 100%; min-height: 44px; }
.pm-empty { opacity: 1; color: var(--text-dim); }

/* The place card can include preview + radius controls. Let it scroll normally on
   phones so it cannot monopolize a half-height sheet. Sheet height remains owned
   solely by data-sheet-state / --sheet-h from app.js. */
@media (max-width: 859.98px) {
  .place-search {
    position: static;
    background: var(--surface);
  }
}
.editor-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 28px;
}
.editor-tag-chips .tag-chip {
  min-height: 32px;
}
.new-tag-row {
  align-items: center;
}
.new-tag-row select {
  width: auto;
  min-width: 5.5rem;
  flex: none;
}
.place-actions {
  margin-top: 6px;
}
.pm-muted {
  opacity: 0.6;
  font-size: 13px;
}
.pm-toast-undo {
  margin-left: 10px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
}
.tag-chip.has-tag-color.active {
  box-shadow: 0 0 0 2px var(--text);
}

/* 3×3 color grid — perfect circles, no orphan row */
#editor-color .pm-swatches {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 8px 10px;
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
#editor-color .pm-swatch {
  box-sizing: border-box;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
/* Visible circle (28px) centered in 44px tap target */
#editor-color .pm-swatch::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
  background: var(--swatch, var(--surface-3));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28) inset;
  transition: transform var(--fast), box-shadow var(--fast);
}
#editor-color .pm-swatch:hover::before {
  transform: scale(1.08);
}
#editor-color .pm-swatch.active::before {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px var(--text),
    0 0 0 1px rgba(0, 0, 0, 0.2) inset;
  transform: scale(1.06);
}
#editor-color .pm-swatch.active::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
@media (prefers-color-scheme: light) {
  #editor-color .pm-swatch.active::after {
    border-color: #111;
    box-shadow: none;
  }
}

/* Visibility belongs to app.js. We only honour the standard signals so we can
   never be the reason the panel refuses to open. */
#editor[hidden],
#editor.hidden,
#editor.is-hidden,
#editor.closed,
#editor.is-closed,
#nav-sheet[hidden],
#nav-sheet.hidden,
#nav-sheet.is-hidden,
#nav-sheet.closed,
#nav-sheet.is-closed { display: none; }

#btn-close-editor {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 13px;
  line-height: 1;
  border-radius: 999px;
}

/* keep a heading from sliding under the floating close button */
#editor > h1:first-child,
#editor > h2:first-child,
#editor > h3:first-child,
#editor > header:first-child { padding-inline-end: 44px; }

#editor-coords {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--text-faint);
  word-break: break-word;
}

/* color swatches container — grid lives on .pm-swatches */
#editor-color {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
}

#editor-color input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 860px) {
  #editor {
    top: 16px;
    right: 16px;
    width: 360px;
    max-height: calc(100vh - 32px);
    padding: 16px;
    border-radius: var(--r-lg);
    animation: panel-in 200ms cubic-bezier(0.2, 0.8, 0.3, 1);
  }
}

@media (max-width: 859.98px) {
  #editor {
    right: 0;
    bottom: 0;
    left: 0;
    max-height: 82vh;
    max-height: 82dvh;
    padding: 22px 16px calc(18px + var(--safe-b));
    border-width: 1px 0 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    animation: sheet-in 260ms cubic-bezier(0.32, 0.72, 0, 1);
  }

  /* grab-handle affordance for the editor sheet */
  #editor::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    background: var(--border-strong);
    border-radius: 2px;
  }

  #btn-close-editor { top: 16px; }
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(-8px); }
}
@keyframes sheet-in {
  from { transform: translateY(100%); }
}

/* --------------------------------------------------------------- nav sheet */

#nav-sheet {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 14px calc(16px + var(--safe-b));
  background: var(--scrim);
  -webkit-backdrop-filter: blur(6px) saturate(1.1);
  backdrop-filter: blur(6px) saturate(1.1);
  animation: fade-in 160ms ease-out;
}

/* The inner panel's class name is unknown, so match the shapes it can take.
   If none match, the option buttons below still stack and read correctly. */
#nav-sheet > div:only-child,
#nav-sheet > div:last-child:not(:first-child),
#nav-sheet > .sheet,
#nav-sheet > .sheet-inner,
#nav-sheet > .panel,
#nav-sheet > .card,
#nav-sheet > nav,
#nav-sheet > menu,
#nav-sheet > ul,
#nav-sheet > section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 440px;
  max-height: 100%;
  overflow-y: auto;
  margin: 0;
  padding: 16px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: sheet-in 240ms cubic-bezier(0.32, 0.72, 0, 1);
}

#nav-sheet h1,
#nav-sheet h2,
#nav-sheet h3 {
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

#nav-sheet li { list-style: none; }

#nav-sheet a,
#nav-sheet button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 440px;
  min-height: 48px;
  padding: 12px 15px;
  font-size: 15px;
  font-weight: 550;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
}

#nav-sheet a:hover,
#nav-sheet button:hover {
  background: var(--surface-3);
  border-color: var(--accent-line);
  color: var(--accent-strong);
}

@keyframes fade-in {
  from { opacity: 0; }
}

@media (min-width: 860px) {
  #nav-sheet {
    justify-content: center;
    padding: 24px;
  }
  #nav-sheet > div:only-child,
  #nav-sheet > div:last-child:not(:first-child),
  #nav-sheet > .sheet,
  #nav-sheet > .sheet-inner,
  #nav-sheet > .panel,
  #nav-sheet > .card,
  #nav-sheet > nav,
  #nav-sheet > menu,
  #nav-sheet > ul,
  #nav-sheet > section {
    max-width: 400px;
    animation: panel-in 180ms cubic-bezier(0.2, 0.8, 0.3, 1);
  }
}

/* -------------------------------------------------- mobile map affordances */

@media (max-width: 859.98px) {
  /* 16px avoids iOS Safari's zoom-on-focus, which also shifts the whole page */
  #sidebar input:not([type="checkbox"]):not([type="radio"]),
  #sidebar select,
  #editor input:not([type="checkbox"]):not([type="radio"]),
  #editor textarea,
  #editor select {
    min-height: 44px;
    font-size: 16px;
  }

  #sidebar button,
  #editor button {
    min-height: 44px;
    padding: 11px 16px;
  }

  #btn-close-editor {
    min-width: 44px;
    min-height: 44px;
  }

  /* Filter rows need ≥44px — do not force the old 40px chip height. */
  #tag-filters > .tag-filter-row {
    min-height: 44px;
    padding: 4px 6px;
    font-size: 13.5px;
  }

  #editor-color > * {
    width: 40px;
    height: 40px;
  }

  #pin-list > li {
    /* Keep denser rhythm on mobile too; 56px min was forcing loose empty rows. */
    min-height: 44px;
    padding: 8px 10px 8px 12px;
  }

  .map-actions {
    top: calc(10px + var(--safe-t));
    right: calc(10px + var(--safe-r));
    bottom: auto;
    left: auto;
    flex-direction: column;
  }
  /* Full sheet covers the map; hide toolbar (app.js also sets inert). */
  #sidebar[data-sheet-state="full"] ~ .map-actions,
  body:has(#sidebar[data-sheet-state="full"]) .map-actions {
    visibility: hidden;
    pointer-events: none;
  }

  .leaflet-bottom {
    bottom: calc(var(--sheet-h, 0px) + 8px) !important;
  }
  .leaflet-control-zoom a {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 18px !important;
  }
  /* Zoom controls also leave tab order when sheet is full (covered). */
  body:has(#sidebar[data-sheet-state="full"]) .leaflet-control-zoom a {
    visibility: hidden;
    pointer-events: none;
  }
}

/* Body-level map toolbar (outside sidebar) */
.map-actions {
  position: fixed;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.map-actions > * {
  pointer-events: auto;
}
.map-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.map-action-btn svg {
  flex: none;
}
.map-action-label {
  white-space: nowrap;
}
#btn-add-mode[aria-pressed="true"],
#btn-add-mode.pm-armed {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#btn-locate[aria-busy="true"] {
  opacity: 0.75;
}
.locate-status {
  position: fixed;
  z-index: 1060;
  left: 50%;
  transform: translateX(-50%);
  top: calc(12px + var(--safe-t));
  max-width: min(420px, 92vw);
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
}
.locate-status[hidden] {
  display: none !important;
}

@media (min-width: 860px) {
  .map-actions {
    top: 80px;
    left: calc(var(--sidebar-w) + 12px);
    right: auto;
  }
  .sheet-handle-btn {
    display: none !important;
  }
  /* Desktop filters always open in normal flow (JS also sets open=true). */
  #filters-disclosure {
    display: block;
  }
  #filters-disclosure > summary {
    display: none;
  }
  #filters-disclosure .filters {
    display: block !important;
  }
  /* Guard: closed details must not zero-height the filter block on desktop. */
  #filters-disclosure:not([open]) .filters {
    display: block !important;
  }
}

.place-search {
  margin: 0 0 12px;
  padding: 10px 12px 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.filters-disclosure {
  margin: 0 0 10px;
}
.filters-summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-dim);
  list-style: none;
}
.filters-summary::-webkit-details-marker {
  display: none;
}
.master-select-label {
  font-size: 13px;
  font-weight: 550;
  color: var(--text-dim);
  white-space: nowrap;
}

/* --------------------------------------------------------------- Leaflet */

.leaflet-container {
  font-family: var(--sans);
  background: var(--bg);
}

/* Nudge OSM's bright raster tiles toward the dark UI without wrecking legibility. */
@media (prefers-color-scheme: dark) {
  .leaflet-tile {
    filter: brightness(0.84) saturate(0.88) contrast(1.04);
  }
}

.leaflet-bar,
.leaflet-control-layers {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.leaflet-bar a,
.leaflet-bar a:hover,
.leaflet-bar a:focus {
  width: 32px;
  height: 32px;
  line-height: 32px;
  color: var(--text);
  background: var(--surface);
  border-bottom-color: var(--border);
}
.leaflet-bar a:hover { background: var(--surface-3); }
.leaflet-bar a.leaflet-disabled {
  color: var(--text-faint);
  background: var(--surface-2);
}

.leaflet-control-attribution {
  padding: 2px 8px;
  font-size: 10.5px;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 0;
  border-bottom: 0;
  border-top-left-radius: var(--r-xs);
}
.leaflet-control-attribution a { color: var(--accent); }

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.leaflet-popup-content-wrapper { border-radius: var(--r); }

.leaflet-top.leaflet-left { margin: 6px; }

/* Custom divIcon markers get no default box; selection ring comes from map.js
   adding a class, so give it something to land on. */
.leaflet-marker-icon {
  background: none;
  border: 0;
  transition: filter var(--fast);
}
.leaflet-marker-icon.selected,
.leaflet-marker-icon.is-selected,
.leaflet-marker-icon.pin-selected {
  filter: drop-shadow(0 0 0 var(--accent)) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
  z-index: 1000 !important;
}
.leaflet-marker-icon.dimmed,
.leaflet-marker-icon.is-dimmed { opacity: 0.25; }

@media (max-width: 859.98px) {
  .leaflet-bar a,
  .leaflet-bar a:hover,
  .leaflet-bar a:focus {
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 20px;
  }

  /* keep zoom + attribution clear of the bottom sheet's peek */
  .leaflet-bottom {
    bottom: calc(var(--peek) + var(--safe-b));
  }
  .leaflet-top.leaflet-left { margin: 8px; }
}

/* -------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
