:root {
  --brand: #1f4e5f;
  --brand-contrast: #ffffff;
  --text: #1c2326;
  --muted: #5b676d;
  --surface: #ffffff;
  --border: #d5dcdf;
  --exact: #c2410c;
  --approx: #b45309;
  --closed: #8a9499;
  --cluster: #1f4e5f;
  --user: #2563eb;
  --radius: 12px;
  --shadow: 0 6px 24px rgb(0 0 0 / 0.18);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

/* Top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) 8px
    calc(12px + var(--safe-left));
  background: var(--brand);
  color: var(--brand-contrast);
  z-index: 1000;
}

.topbar h1 {
  font-size: 1.05rem;
}

/* Wrap the subtitle before the count, never inside "1 315 établissements". */
.nowrap {
  white-space: nowrap;
}

.topbar__count {
  margin: 2px 0 0;
  font-size: 0.85rem;
  opacity: 0.85;
}

/* Map */

#map {
  flex: 1;
  min-height: 0;
}

.marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.4);
}

.marker--exact {
  background: var(--exact);
}

/* Approximate positions: hollow, so they read as "somewhere around here". */
.marker--approx {
  background: #fff;
  border: 3px dashed var(--approx);
}

.marker--closed {
  background: var(--closed);
  border-color: #fff;
  opacity: 0.8;
}

.marker--approx.marker--closed {
  background: #fff;
  border-color: var(--closed);
}

.cluster {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cluster);
  color: var(--brand-contrast);
  font-weight: 600;
  font-size: 0.8rem;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.4);
}

/* Map buttons at Apple's minimum touch target (Leaflet's touch size is 30px). */

.leaflet-touch .leaflet-control-zoom a {
  width: 44px;
  height: 44px;
  line-height: 44px;
}

/* "Locate me" button, above the zoom buttons, and the user's position. */

.locate__button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--surface);
  color: var(--brand);
  cursor: pointer;
}

.locate__button[aria-busy="true"] svg {
  animation: locate-pulse 1s ease-in-out infinite alternate;
}

@keyframes locate-pulse {
  to {
    opacity: 0.3;
  }
}

.user-accuracy {
  stroke: var(--user);
  stroke-width: 1;
  fill: var(--user);
  fill-opacity: 0.12;
}

.user-dot {
  stroke: #fff;
  stroke-width: 3;
  fill: var(--user);
  fill-opacity: 1;
}

/* Panels: a bottom sheet on phones, a side panel on wide screens. */

.panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 75dvh;
  overflow-y: auto;
  padding: 16px calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom))
    calc(16px + var(--safe-left));
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  z-index: 1100;
}

.panel h2 {
  font-size: 1.1rem;
}

.panel > h2 {
  margin-top: 20px;
}

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .panel {
    top: calc(64px + var(--safe-top));
    left: auto;
    right: 12px;
    bottom: 12px;
    width: 380px;
    max-height: none;
    border-radius: var(--radius);
  }
}

/* Buttons and filters */

.button {
  min-height: 44px; /* Apple's minimum touch target */
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-contrast);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.topbar .button {
  background: rgb(255 255 255 / 0.15);
}

.button--ghost {
  background: transparent;
  color: var(--brand);
}

.filters__group {
  margin: 8px 0 0;
  padding: 0;
  border: 0;
}

.filters__group legend {
  margin-bottom: 4px;
  font-weight: 600;
}

.filters__option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.filters__option input {
  width: 20px;
  height: 20px;
}

.filters__count {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.filters__note {
  color: var(--muted);
  font-size: 0.85rem;
}

.sources {
  padding-left: 18px;
  font-size: 0.85rem;
  color: var(--muted);
}

.sources a {
  color: var(--brand);
}

/* Establishment card */

.card__address,
.card__type {
  margin: 4px 0;
  color: var(--muted);
}

.card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.card__badges:empty {
  display: none;
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef1f2;
  font-size: 0.8rem;
}

.badge--warning {
  background: #fdf0d5;
  color: #7a4a03;
}

.card__summary {
  font-weight: 600;
}

.convictions {
  padding-left: 20px;
}

.convictions li {
  margin-bottom: 14px;
}

.conviction__meta {
  font-weight: 600;
}

.conviction__description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  color: #b91c1c;
}

/* Banners: new data available (top) and install hint (bottom). */

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left));
  background: #fdf0d5;
  color: #4a3003;
  font-size: 0.9rem;
  z-index: 1050;
}

.banner[hidden] {
  display: none;
}

.banner--bottom {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.button--small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
}

.banner .button--ghost {
  color: #4a3003;
}
