/* ============================================
   PINHERE — Design tokens
   Style: iOS-native, Apple Maps inspired
   ============================================ */
:root {
  --app-height: 100dvh; /* remplacé en JS par la vraie hauteur visible (voir index.html) */
  --bg: #F2F2F7;
  --sheet-bg: #FFFFFF;
  --text: #1C1C1E;
  --text-secondary: #8E8E93;
  --text-tertiary: #C7C7CC;
  --accent: #2478C7;         /* bleu du logo - marque / marqueurs perso */
  --accent-dark: #1B5C9E;
  --accent-light: #3BB8E4;   /* bleu clair du logo - dégradés */
  --accent-tint: #E7F2FB;    /* fond des éléments sélectionnés (catégorie, emoji...) */
  --highlight-tint: #FDEEE3; /* teinte orange douce (bannière profil...) */
  --highlight: #F2803E;      /* orange du logo - accents secondaires */
  --blue: #007AFF;          /* actions primaires */
  --green: #34C759;
  --danger: #FF3B30;
  --border: #E5E5EA;
  --border-light: #F0F0F2;
  --map-attribution-bg: rgba(255,255,255,0.85);
  --danger-tint: #FFEDEC;
  --glass-bg: rgba(255,255,255,0.72);   /* verre dépoli (barre de recherche, boutons flottants) */
  --loading-overlay-bg: rgba(255,255,255,0.7);
  --spinner-track: rgba(0,0,0,0.1);
  --radius-sheet: 20px;
  --radius-card: 14px;
  --radius-button: 12px;
  --radius-pill: 100px;
  --shadow-sheet: 0 -2px 24px rgba(0,0,0,0.12);
  --shadow-card: 0 2px 10px rgba(0,0,0,0.06);
  --shadow-fab: 0 4px 14px rgba(36,120,199,0.4);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

/* Mode sombre : suit automatiquement le réglage du système (iOS/Android/navigateur),
   pas de bouton dans l'app — comme le veut l'OS. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --sheet-bg: #1C1C1E;
    --text: #F2F2F7;
    --text-secondary: #98989D;
    --text-tertiary: #636366;
    --accent: #3B93E0;
    --accent-dark: #2478C7;
    --accent-light: #3BB8E4;
    --accent-tint: rgba(59,147,224,0.18);
    --highlight-tint: rgba(242,128,62,0.16);
    --highlight: #F2803E;
    --blue: #0A84FF;
    --green: #30D158;
    --danger: #FF453A;
    --border: #38383A;
    --border-light: #2C2C2E;
    --map-attribution-bg: rgba(28,28,30,0.75);
    --danger-tint: rgba(255,69,58,0.16);
    --glass-bg: rgba(28,28,30,0.62);
    --loading-overlay-bg: rgba(0,0,0,0.55);
    --spinner-track: rgba(255,255,255,0.18);
    --shadow-sheet: 0 -2px 24px rgba(0,0,0,0.4);
    --shadow-card: 0 2px 10px rgba(0,0,0,0.3);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

html, body {
  margin: 0;
  padding: 0;
  height: var(--app-height);
  overscroll-behavior: none;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  position: fixed;
  inset: 0;
  height: var(--app-height);
  overflow: hidden;
}

#app { position: fixed; inset: 0; height: var(--app-height); background: var(--bg); overflow-x: hidden; }

/* Sécurité globale : aucun scroll horizontal nulle part dans l'app, seulement vertical */
.sheet-body, .add-body, .manage-body, .profile-list, .modal-sheet, .step-body {
  overflow-x: hidden;
}

.view {
  position: fixed;
  inset: 0;
  height: var(--app-height);
  display: none;
  flex-direction: column;
  background: var(--bg);
}
.view.active {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity .22s ease, transform .22s ease;
}
.view.active.view-enter {
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  transition: none;
}

button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

.hidden { display: none !important; }

/* ============ Scrollbars off ============ */
::-webkit-scrollbar { display: none; }

/* ============================================
   AUTH VIEW
   ============================================ */
#view-auth {
  background: linear-gradient(180deg, #3BB8E4 0%, #2478C7 38%, var(--bg) 38%);
  padding-top: calc(var(--safe-top) + 8px);
}

.auth-hero {
  flex: 0 0 auto;
  padding: 28px 28px 18px;
  color: white;
  text-align: center;
}
.auth-hero .logo-badge {
  width: 84px; height: 84px;
  margin: 0 auto 14px;
  background: var(--sheet-bg);
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  overflow: hidden;
}
.auth-hero .logo-badge img { width: 62px; height: 62px; object-fit: contain; }
.auth-hero h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 4px;
}
.auth-hero p {
  font-size: 14.5px;
  opacity: 0.92;
  margin: 0;
  font-weight: 500;
}

.auth-card {
  flex: 1;
  background: var(--sheet-bg);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  margin-top: 10px;
  padding: 26px 22px calc(24px + var(--safe-bottom));
  box-shadow: var(--shadow-sheet);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-button);
  padding: 3px;
  margin-bottom: 8px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 9px;
  transition: all .15s ease;
}
.auth-tab.active {
  background: var(--sheet-bg);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.btn {
  border: none;
  border-radius: var(--radius-button);
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 19px; height: 19px; flex-shrink: 0; }

.btn-google { background: white; color: #1C1C1E; border: 1.5px solid var(--border); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:disabled { opacity: 0.45; }
.btn-secondary { background: var(--bg); color: var(--text); }
.btn-text { background: transparent; color: var(--blue); padding: 10px; font-weight: 500; font-size: 14.5px; }
.btn-danger-text { background: transparent; color: var(--danger); font-weight: 500; }

.divider-row {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-tertiary); font-size: 12.5px; font-weight: 600;
  margin: 6px 0;
}
.divider-row::before, .divider-row::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.field { margin-bottom: 4px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-button);
  padding: 13px 14px;
  font-size: 15.5px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .15s ease;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); background: var(--sheet-bg); }
.field textarea { resize: none; min-height: 84px; }
.field-hint { font-size: 11.5px; color: var(--text-tertiary); margin-top: 5px; font-weight: 500; }

.extra-info-box {
  background: var(--accent-tint); border-radius: var(--radius-card);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 6px;
}
.extra-info-row { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; }
.extra-info-label { font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px; }

.detail-extra-info { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.detail-extra-info a, .detail-extra-info span {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--accent); text-decoration: none;
}
.detail-extra-info span { color: var(--text-secondary); }

.detail-rating-detail {
  background: var(--bg); border-radius: var(--radius-card);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 14px;
}
.detail-rating-detail-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.detail-rating-detail-row span:first-child { color: var(--text-secondary); font-weight: 600; }
.detail-rating-detail-row span:last-child { color: #FFB020; font-weight: 700; letter-spacing: 1px; }

.auth-form { display: none; flex-direction: column; gap: 12px; }
.auth-form.active { display: flex; }

.error-msg {
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  min-height: 16px;
  text-align: center;
}

.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(28,28,30,0.86);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all .25s cubic-bezier(.4,0,.2,1);
  max-width: 86%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================
   MAP VIEW
   ============================================ */
#view-map { background: var(--bg); }

#map-canvas { position: absolute; inset: 0; z-index: 1; }

.map-topbar {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  left: 16px; right: 16px;
  z-index: 20;
  display: flex;
  gap: 10px;
}
.map-search {
  flex: 1;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
}
.map-search svg { width: 17px; height: 17px; color: var(--text-secondary); flex-shrink: 0; }
.map-search input {
  border: none; outline: none; background: transparent;
  font-size: 15px; width: 100%; color: var(--text);
}
.icon-btn {
  width: 40px; height: 40px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
  flex-shrink: 0;
  position: relative;
}
.icon-btn svg { width: 19px; height: 19px; color: var(--text); }
.icon-btn img { width: 24px; height: 24px; border-radius: 7px; object-fit: contain; }
.icon-btn.active-filter svg { color: var(--accent); }
.filter-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  display: none;
}
.filter-dot.show { display: block; }

.fab {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-fab);
  position: absolute;
  right: 16px;
  z-index: 25;
  transition: transform .1s ease;
}
.fab:active { transform: scale(0.93); }
.fab svg { width: 26px; height: 26px; color: white; }

/* Bottom sheet */
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 15;
  background: var(--sheet-bg);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
  display: flex;
  flex-direction: column;
  height: 46%;
  min-height: 140px;
  max-height: 82vh;
  transition: height .32s cubic-bezier(.34,1.4,.64,1);
  touch-action: none;
}
.sheet.collapsed { height: 116px; }
.sheet.expanded { height: 82vh; }

.sheet-handle-area {
  padding: 8px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  cursor: grab;
}
.sheet-handle {
  width: 36px; height: 5px;
  background: var(--text-tertiary);
  border-radius: 3px;
}
.sheet-header {
  padding: 6px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sheet-title { font-size: 17px; font-weight: 700; }
.sheet-subtitle { font-size: 13px; color: var(--text-secondary); font-weight: 500; margin-top: 1px; }
.view-toggle {
  display: flex;
  background: var(--bg);
  border-radius: 9px;
  padding: 2px;
}
.view-toggle button {
  border: none; background: transparent;
  padding: 6px 12px;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  border-radius: 7px;
  display: flex; align-items: center; gap: 5px;
}
.view-toggle button.active { background: var(--sheet-bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.view-toggle svg { width: 14px; height: 14px; }

.sheet-body { flex: 1; overflow-y: auto; padding: 0 16px calc(16px + var(--safe-bottom)); }

.place-card {
  display: flex;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}
.place-card:last-child { border-bottom: none; }
.place-thumb {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: var(--accent);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
}
.place-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.place-thumb-emoji { font-size: 22px; line-height: 1; }
.place-info { flex: 1; min-width: 0; }
.place-name { font-size: 15.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-meta { font-size: 13px; color: var(--text-secondary); margin-top: 2px; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-author-tag { font-size: 11px; font-weight: 600; color: var(--accent); margin-top: 3px; }
.place-tags { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.tag-chip {
  font-size: 10.5px; font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-secondary);
}
.place-dist { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); flex-shrink: 0; text-align: right; }
.place-fav-star { flex-shrink: 0; font-size: 18px; line-height: 1; color: var(--text-tertiary); }
.place-fav-star.active { color: #FFB020; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}
.empty-state-icon-badge {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-tint) 0%, var(--highlight-tint) 100%);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.empty-state svg { width: 34px; height: 34px; color: var(--accent); }
.empty-state h3 { font-size: 15px; color: var(--text); margin: 0 0 4px; }
.empty-state p { font-size: 13.5px; margin: 0; line-height: 1.4; }

/* Leaflet attribution plus discrète, dans le style de l'app */
.leaflet-control-attribution {
  background: var(--map-attribution-bg) !important;
  backdrop-filter: blur(6px);
  font-size: 9.5px !important;
  padding: 2px 7px !important;
  border-radius: 8px 0 0 0 !important;
  color: var(--text-secondary) !important;
}
.leaflet-control-attribution a { color: var(--text-secondary) !important; }

/* Custom leaflet marker */
.rp-marker {
  width: 34px; height: 34px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  border: 2.5px solid white;
  position: relative;
}
.rp-marker-pop { animation: markerPop .42s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes markerPop {
  0% { transform: rotate(-45deg) scale(0); }
  60% { transform: rotate(-45deg) scale(1.15); }
  100% { transform: rotate(-45deg) scale(1); }
}
.rp-marker-emoji { display: inline-block; transform: rotate(45deg); font-size: 16px; line-height: 1; }
.rp-marker-followed-badge {
  position: absolute; top: -5px; right: -5px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--highlight); border: 2px solid white;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; transform: rotate(45deg);
}

/* Bulles de regroupement (clustering) — style maison plutôt que le défaut du plugin */
.rp-cluster {
  border-radius: 50%;
  background: var(--blue);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  box-shadow: 0 3px 10px rgba(36,120,199,0.45), 0 0 0 5px rgba(36,120,199,0.18);
  border: 2.5px solid white;
  animation: clusterPop .3s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes clusterPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.rp-marker.user-loc {
  background: var(--blue);
  border-radius: 50%;
  transform: none;
  width: 18px; height: 18px;
  box-shadow: 0 0 0 4px rgba(0,122,255,0.25);
}

/* Filters panel */
.filters-panel {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: var(--sheet-bg);
  display: none;
  flex-direction: column;
}
.filters-panel.active { display: flex; }
.panel-header {
  padding: calc(var(--safe-top) + 14px) 20px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.panel-header h2 { font-size: 18px; margin: 0; font-weight: 700; }
.panel-body { flex: 1; overflow-y: auto; padding: 18px 20px calc(20px + var(--safe-bottom)); }
.panel-footer { padding: 14px 20px calc(14px + var(--safe-bottom)); border-top: 1px solid var(--border-light); flex-shrink: 0; display: flex; gap: 10px; }

.filter-card {
  background: var(--bg); border-radius: var(--radius-card);
  padding: 14px; margin-bottom: 14px;
}
.filter-card-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700; color: var(--text);
  margin: 0 0 4px; background: none; border: none; width: 100%; text-align: left; padding: 0;
}
.filter-card-title span:first-child { flex: 1; }
.filter-card-title-toggle { cursor: pointer; }
.filter-card-title-toggle .chevron { width: 16px; height: 16px; color: var(--text-tertiary); transition: transform .2s ease; }
.filter-card-title-toggle.open .chevron { transform: rotate(90deg); }
.filter-card-count {
  background: var(--accent); color: white; font-size: 11px; font-weight: 800;
  min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
}
.filter-card-sub { font-size: 12px; color: var(--text-secondary); margin: 0 0 10px; line-height: 1.4; }
.filter-card .filter-chips { margin-top: 10px; }
.filter-card .filter-chips:first-of-type { margin-top: 0; }

.filter-quick-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: none; padding: 6px 0;
}
.filter-quick-icon { font-size: 18px; width: 26px; text-align: center; flex-shrink: 0; }
.filter-quick-label { flex: 1; text-align: left; font-size: 14.5px; font-weight: 600; color: var(--text); }
.filter-card-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

.filter-group { margin-bottom: 22px; }
.filter-group-title { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 10px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--border);
  background: var(--sheet-bg);
  border-radius: var(--radius-pill);
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.chip { font-size: 13.5px; line-height: 1; }
.chip.selected { background: var(--accent); border-color: var(--accent); color: white; }

/* ============================================
   ADD / EDIT PLACE VIEW
   ============================================ */
#view-add { background: var(--sheet-bg); }
.add-header {
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.add-header h2 { flex: 1; font-size: 17px; font-weight: 700; margin: 0; text-align: center; margin-right: 34px; }

.add-body { flex: 1; overflow-y: auto; padding: 16px 20px calc(16px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 16px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; margin: 4px 0 0; }

.import-row { display: flex; gap: 8px; }
.import-row input { flex: 1; }
.import-row button {
  flex-shrink: 0; width: 46px; border-radius: var(--radius-button);
  background: var(--accent); border: none; display: flex; align-items: center; justify-content: center;
}
.import-row button svg { width: 18px; height: 18px; color: white; }

.address-suggestions { display: flex; flex-direction: column; gap: 6px; margin-top: -6px; }
.address-suggestion {
  text-align: left; background: var(--bg); border: none; border-radius: var(--radius-card);
  padding: 11px 13px; font-size: 13.5px; color: var(--text); font-weight: 500; line-height: 1.4;
}
.address-suggestion:active { background: var(--border); }

.mini-map { height: 190px; border-radius: var(--radius-card); overflow: hidden; position: relative; border: 1px solid var(--border); }
.mini-map .fixed-pin {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -100%);
  z-index: 500;
  pointer-events: none;
}
.mini-map .fixed-pin svg { width: 34px; height: 34px; color: var(--accent); filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3)); }
.geoloc-btn { display: flex; align-items: center; gap: 6px; justify-content: center; font-size: 13px; color: var(--blue); font-weight: 600; background: none; border: none; padding: 8px; width: 100%; }

.photo-upload {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-card);
  aspect-ratio: 4 / 3;
  min-height: 260px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
.photo-upload svg { width: 26px; height: 26px; }
.photo-upload span { font-size: 13px; font-weight: 600; }
.photo-upload img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-remove {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.55); border: none;
  display: flex; align-items: center; justify-content: center;
}
.photo-remove svg { width: 14px; height: 14px; color: white; }

.photo-search-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; margin-top: 8px;
  border: none; background: var(--bg); border-radius: var(--radius-button);
  padding: 11px; font-size: 13px; font-weight: 600; color: var(--accent);
}
.photo-search-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.photo-search-btn:disabled { opacity: 0.5; }
.photo-source-badge {
  position: absolute; bottom: 8px; left: 8px; z-index: 5;
  background: rgba(0,0,0,0.55); color: white;
  font-size: 10px; font-weight: 700; padding: 4px 8px; border-radius: var(--radius-pill);
}

.category-select-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--bg); border: none; border-radius: var(--radius-card);
  padding: 12px 14px;
}
.category-select-btn .cat-dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 16px; line-height: 1; background: var(--accent); color: white;
}
.category-select-btn span { flex: 1; text-align: left; font-size: 14.5px; font-weight: 600; color: var(--text); }
.category-select-btn .chevron { width: 16px; height: 16px; color: var(--text-tertiary); flex-shrink: 0; }

.cat-picker-group-title {
  font-size: 11.5px; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.3px; margin: 16px 2px 8px;
}
.cat-picker-group-title:first-child { margin-top: 2px; }
.cat-picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat-picker-tile {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg); border: 1.5px solid transparent; border-radius: var(--radius-card);
  padding: 9px 10px; text-align: left;
}
.cat-picker-tile.selected { border-color: var(--accent); background: var(--accent-tint); }
.cat-picker-tile.add-new { border-style: dashed; border-color: var(--border); color: var(--text-secondary); }
.cat-picker-tile .cat-dot {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px; line-height: 1;
}
.cat-picker-tile .cat-dot svg { width: 14px; height: 14px; color: currentColor; }
.cat-picker-tile span {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.category-card.add-new .cat-dot { background: var(--bg); }
.category-card.add-new .cat-dot svg { color: var(--text-secondary); }

.list-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.list-chip {
  border: 1.5px solid var(--border); background: var(--sheet-bg); border-radius: var(--radius-pill);
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.list-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.list-chip.selected { background: var(--accent); border-color: var(--accent); color: white; }

.rating-picker { display: flex; gap: 6px; }
.rating-picker button { background: none; border: none; padding: 2px; }
.rating-picker svg { width: 26px; height: 26px; color: var(--border); }
.rating-picker button.on svg { color: #FFB020; }

.rating-detailed { display: flex; flex-direction: column; gap: 10px; }
.rating-detailed-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rating-detailed-label { font-size: 13.5px; font-weight: 600; color: var(--text); flex-shrink: 0; }
.rating-detailed-stars { display: flex; gap: 4px; }
.rating-detailed-stars button { background: none; border: none; padding: 1px; }
.rating-detailed-stars svg { width: 20px; height: 20px; color: var(--border); }
.rating-detailed-stars button.on svg { color: #FFB020; }

.visited-toggle { display: flex; background: var(--bg); border-radius: var(--radius-button); padding: 3px; gap: 3px; }
.visited-toggle-btn {
  flex: 1; border: none; background: transparent; border-radius: 9px;
  padding: 11px 6px; font-size: 13.5px; font-weight: 600; color: var(--text-secondary);
}
.visited-toggle-btn.active { background: var(--sheet-bg); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.to-visit-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; background: var(--highlight); color: white;
  flex-shrink: 0;
}

.add-footer {
  display: flex; gap: 10px;
  padding: 12px 20px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}
.add-footer .btn { flex: 1; }

/* ============================================
   DETAIL VIEW
   ============================================ */
#view-detail { background: var(--sheet-bg); }
.detail-photo { height: 44vh; position: relative; flex-shrink: 0; background: var(--accent); overflow: hidden; }
.detail-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.detail-photo .no-photo { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--accent-light) 0%, var(--accent-dark) 100%); }
.detail-photo .no-photo svg { width: 54px; height: 54px; color: rgba(255,255,255,0.55); }
.detail-photo-gradient {
  position: absolute; left: 0; right: 0; bottom: 0; height: 65%;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.32) 45%, rgba(0,0,0,0) 100%);
  pointer-events: none; z-index: 1;
}
.detail-photo-nav {
  position: absolute; top: calc(var(--safe-top) + 10px); left: 16px; right: 16px;
  display: flex; justify-content: space-between; z-index: 5;
}
.detail-back, .detail-fav {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.28);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: none; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.detail-back svg { width: 18px; height: 18px; color: white; }
.detail-fav svg { width: 19px; height: 19px; color: white; }
.detail-fav.active svg { color: #FFB020; }
.detail-photo-overlay {
  position: absolute; left: 20px; right: 20px; bottom: 18px; z-index: 3;
}

.detail-sheet {
  flex: 1;
  background: var(--sheet-bg);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  margin-top: -20px;
  position: relative;
  z-index: 2;
  overflow-y: auto;
  padding: 20px 20px calc(30px + var(--safe-bottom));
}
.detail-name { font-size: 25px; font-weight: 800; letter-spacing: -0.5px; margin: 8px 0 0; color: white; text-shadow: 0 2px 10px rgba(0,0,0,0.35); }
.detail-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-cat-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 700; color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.detail-cat-badge svg { width: 13px; height: 13px; }
.detail-list-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 700;
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
}
.detail-list-badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.detail-address-row { display: flex; align-items: flex-start; gap: 6px; color: var(--text-secondary); font-size: 13.5px; font-weight: 500; margin-bottom: 14px; }
.detail-address-row svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.detail-desc { font-size: 14.5px; line-height: 1.55; color: var(--text); margin-bottom: 20px; white-space: pre-wrap; }
.detail-actions-row { display: flex; gap: 10px; margin-bottom: 20px; }
.detail-action-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg); border: none; border-radius: var(--radius-card); padding: 12px 6px;
  font-size: 11.5px; font-weight: 600; color: var(--text);
}
.detail-action-btn svg { width: 20px; height: 20px; color: var(--accent); }

/* ---- Réactions rapides ---- */
.detail-reactions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.reaction-btn {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg); border: 1.5px solid transparent; border-radius: var(--radius-pill);
  padding: 6px 11px; font-size: 15px;
}
.reaction-btn .reaction-count { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.reaction-btn.mine { background: var(--accent-tint); border-color: var(--accent); }
.reaction-btn.mine .reaction-count { color: var(--accent); }
.reaction-btn-add {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-tint); border: 1.5px dashed var(--accent); display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.reaction-btn-add svg { width: 16px; height: 16px; stroke-width: 2.5; }
.reaction-picker { display: flex; gap: 4px; background: var(--sheet-bg); border-radius: var(--radius-pill); padding: 4px; box-shadow: var(--shadow-card); }
.reaction-picker button { width: 32px; height: 32px; border-radius: 50%; background: none; border: none; font-size: 18px; }
.reaction-picker button:active { background: var(--bg); }

/* ---- Commentaires ---- */
.detail-comments-section { margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--border-light); }
.detail-comments-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.comment-row { display: flex; gap: 9px; align-items: flex-start; }
.comment-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: white; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-bubble { background: var(--bg); border-radius: var(--radius-card); padding: 8px 12px; flex: 1; position: relative; }
.comment-author-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.comment-author-name { font-size: 12.5px; font-weight: 700; color: var(--text); }
.comment-time { font-size: 10.5px; color: var(--text-tertiary); flex-shrink: 0; }
.comment-text { font-size: 13.5px; color: var(--text); line-height: 1.4; margin-top: 2px; word-break: break-word; }
.comment-delete { position: absolute; top: 6px; right: 6px; background: none; border: none; color: var(--text-tertiary); opacity: 0; transition: opacity .15s; }
.comment-row:hover .comment-delete, .comment-row:active .comment-delete { opacity: 1; }
.comment-report { position: absolute; top: 6px; right: 6px; background: none; border: none; color: var(--text-tertiary); opacity: 0.45; }
.comment-report svg { width: 13px; height: 13px; }
.comment-report.reported { color: var(--danger); opacity: 1; }

/* ---- Fil d'activité ---- */
.activity-row {
  display: flex; align-items: flex-start; gap: 11px; width: 100%;
  background: white; border: none; border-radius: var(--radius-card);
  padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow-card); text-align: left;
}
.activity-icon { font-size: 19px; width: 28px; text-align: center; flex-shrink: 0; margin-top: 1px; }
.activity-text { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text); line-height: 1.4; }
.activity-text b { font-weight: 700; }
.activity-snippet { font-size: 12px; color: var(--text-secondary); margin-top: 3px; background: var(--bg); border-radius: 8px; padding: 5px 8px; }
.activity-time { font-size: 10.5px; color: var(--text-tertiary); flex-shrink: 0; margin-top: 2px; white-space: nowrap; }

/* ---- Classement amical ---- */
.leaderboard-row {
  display: flex; align-items: center; gap: 10px;
  background: white; border-radius: var(--radius-card);
  padding: 9px 12px; margin-bottom: 6px; box-shadow: var(--shadow-card);
}
.leaderboard-row.me { background: var(--accent-tint); }
.leaderboard-rank { font-size: 15px; font-weight: 800; width: 26px; text-align: center; flex-shrink: 0; color: var(--text-secondary); }
.leaderboard-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaderboard-count { font-size: 13.5px; font-weight: 800; color: var(--accent); flex-shrink: 0; }
.leaderboard-count span { font-size: 10.5px; font-weight: 600; color: var(--text-tertiary); }

.activity-error-box {
  margin-top: 10px; padding: 10px 12px; background: var(--bg); border-radius: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; color: var(--text);
  text-align: left; line-height: 1.5; word-break: break-word; user-select: text;
  max-width: 320px;
}
.comment-delete svg { width: 13px; height: 13px; }
.comments-empty { font-size: 13px; color: var(--text-tertiary); text-align: center; padding: 10px 0; }
.comment-input-row { display: flex; gap: 8px; align-items: center; }
.comment-input-row input {
  flex: 1; background: var(--bg); border: none; border-radius: var(--radius-pill);
  padding: 10px 16px; font-size: 13.5px; color: var(--text);
}
.comment-input-row button {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); border: none; display: flex; align-items: center; justify-content: center;
}
.comment-input-row button svg { width: 15px; height: 15px; }

.detail-author {
  display: flex; align-items: center; gap: 10px;
  padding-top: 16px; border-top: 1px solid var(--border-light);
}
.author-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.author-name { font-size: 13px; font-weight: 600; }
.author-sub { font-size: 11.5px; color: var(--text-secondary); }

.owner-actions { display: flex; gap: 10px; margin-top: 16px; }
.owner-actions .btn { flex: 1; }

/* ============================================
   CATEGORIES / LISTS MANAGEMENT VIEWS
   ============================================ */
#view-categories, #view-lists { background: var(--bg); }
.manage-header {
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  display: flex; align-items: center; gap: 10px;
  background: var(--sheet-bg);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.manage-header h2 { flex: 1; font-size: 17px; font-weight: 700; margin: 0; text-align: center; margin-right: 34px; }
.manage-body { flex: 1; overflow-y: auto; padding: 16px 20px calc(20px + var(--safe-bottom)); }

.manage-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--sheet-bg); border-radius: var(--radius-card);
  padding: 12px 14px; margin-bottom: 10px;
  box-shadow: var(--shadow-card);
}
.manage-row .cat-dot { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; line-height: 1; }
.manage-row .cat-dot svg { width: 16px; height: 16px; color: white; }
.manage-row .row-title { flex: 1; font-size: 14.5px; font-weight: 600; }
.manage-row .row-sub { font-size: 12px; color: var(--text-secondary); margin-top: 1px; font-weight: 500; }
.manage-row-actions { display: flex; gap: 6px; }
.manage-row-actions button {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center; background: var(--bg);
}
.manage-row-actions button svg { width: 14px; height: 14px; color: var(--text-secondary); }
.manage-row-actions button.danger svg { color: var(--danger); }

.btn-add-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px dashed var(--border); border-radius: var(--radius-card);
  padding: 13px; font-size: 14px; font-weight: 600; color: var(--accent);
  background: transparent; width: 100%; margin-top: 4px;
}
.btn-add-row svg { width: 16px; height: 16px; }

/* Modal (category/list editor) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 60; display: none; align-items: flex-end; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-sheet {
  background: var(--sheet-bg); width: 100%; max-width: 480px;
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding: 20px 20px calc(20px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 14px;
  max-height: 86vh; overflow-y: auto;
}
.modal-title { font-size: 17px; font-weight: 700; margin: 0; }
.color-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.color-swatch { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 2.5px solid transparent; }
.color-swatch.selected { border-color: var(--text); }

.accent-color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 4px 0 8px; }
.accent-color-swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: none; }
.accent-color-dot {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid transparent;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.accent-color-swatch.selected .accent-color-dot { border-color: var(--text); }
.accent-color-dot svg { width: 18px; height: 18px; color: white; opacity: 0; }
.accent-color-swatch.selected .accent-color-dot svg { opacity: 1; }
.accent-color-label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; max-height: 260px; overflow-y: auto; }
.icon-swatch {
  aspect-ratio: 1; border-radius: var(--radius-card); border: 1.5px solid var(--border);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1;
}
.icon-swatch.selected { border-color: var(--accent); background: var(--accent-tint); }
.detailed-rating-toggle {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: none; border-radius: var(--radius-card);
  padding: 13px 14px; text-align: left; width: 100%;
}
.detailed-rating-toggle-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.detailed-rating-toggle-title { font-size: 14px; font-weight: 700; color: var(--text); }
.detailed-rating-toggle-sub { font-size: 11.5px; color: var(--text-secondary); line-height: 1.35; }
.switch {
  width: 46px; height: 27px; border-radius: 14px; background: var(--border);
  flex-shrink: 0; position: relative; transition: background .2s ease;
}
.switch-knob {
  position: absolute; top: 2px; left: 2px; width: 23px; height: 23px; border-radius: 50%;
  background: white; box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  transition: transform .2s cubic-bezier(.34,1.4,.64,1);
}
.switch.on { background: var(--green); }
.switch.on .switch-knob { transform: translateX(19px); }

.modal-footer { display: flex; gap: 10px; }
.modal-footer .btn { flex: 1; }

.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.member-row .author-avatar { width: 30px; height: 30px; font-size: 11.5px; }
.member-row span { flex: 1; font-size: 13.5px; font-weight: 500; }
.member-row button { background: none; border: none; }
.member-row button svg { width: 15px; height: 15px; color: var(--danger); }
.share-link-box {
  display: flex; align-items: center; gap: 8px; background: var(--bg);
  border-radius: var(--radius-button); padding: 11px 13px;
}
.share-link-box input { flex: 1; border: none; background: transparent; font-size: 12.5px; color: var(--text-secondary); outline: none; }
.share-link-box button { flex-shrink: 0; background: var(--accent); border: none; border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 700; color: white; }

/* ============================================
   PROFILE VIEW
   ============================================ */
#view-profile { background: var(--bg); }
.profile-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.profile-header {
  background: linear-gradient(135deg, var(--accent-tint) 0%, var(--highlight-tint) 100%);
  padding: calc(var(--safe-top) + 18px) 20px 20px;
  display: flex; flex-direction: column; align-items: center;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  position: relative;
}
.profile-close {
  position: absolute; top: calc(var(--safe-top) + 14px); left: 16px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
}
.profile-close svg { width: 16px; height: 16px; }
.profile-avatar-wrap {
  position: relative;
  width: 76px; height: 76px;
  margin: 0 auto 10px;
  cursor: pointer;
}
.profile-avatar {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-edit-badge {
  position: absolute; bottom: -2px; right: -2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--accent); border: 2.5px solid white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
}
.profile-avatar-edit-badge svg { width: 13px; height: 13px; }
.profile-avatar-input { display: none; }
.profile-name { font-size: 19px; font-weight: 700; }
.profile-header-actions { display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.profile-edit-btn { font-size: 13px; color: var(--blue); font-weight: 600; background: none; border: none; margin-top: 4px; }
.profile-edit-btn-remove { color: var(--danger); }
.profile-stats { display: flex; gap: 28px; margin-top: 16px; }
.profile-stat { text-align: center; }
.profile-stat b { display: block; font-size: 18px; font-weight: 800; }
.profile-stat span { font-size: 11.5px; color: var(--text-secondary); font-weight: 600; }

.profile-menu { padding: 14px 16px; }
.profile-menu-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--sheet-bg); border-radius: var(--radius-card);
  padding: 14px 16px; margin-bottom: 10px; border: none; width: 100%;
  box-shadow: var(--shadow-card);
  position: relative; z-index: 1;
}
.profile-menu-item svg { width: 19px; height: 19px; color: var(--accent); flex-shrink: 0; }
.profile-menu-item span { flex: 1; text-align: left; font-size: 14.5px; font-weight: 600; color: var(--text); }
.profile-menu-item .chevron { width: 15px !important; height: 15px !important; color: var(--text-tertiary) !important; }

.profile-footer { padding: 6px 20px calc(20px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 14px; }
.profile-version { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-tertiary); }

.profile-stat-btn { border: none; background: none; cursor: pointer; }

/* ============================================
   MES LIEUX & FAVORIS VIEW
   ============================================ */
.my-places-tabs { display: flex; background: var(--sheet-bg); border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.my-places-tab { flex: 1; border: none; background: none; padding: 13px 0; font-size: 14px; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid transparent; display: flex; align-items: center; justify-content: center; gap: 5px; }
.my-places-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.my-places-tab .menu-badge { min-width: 16px; height: 16px; font-size: 9.5px; padding: 0 4px; margin-right: 0; }
.my-places-sort {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px;
  background: var(--sheet-bg); border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.my-places-sort .chip { padding: 7px 12px; font-size: 12.5px; }

.pc-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--sheet-bg); border-radius: var(--radius-card);
  padding: 10px; margin-bottom: 10px;
  box-shadow: var(--shadow-card);
}
.pc-thumb {
  width: 48px; height: 48px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  position: relative;
}
.pc-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pc-thumb-emoji { font-size: 20px; line-height: 1; }
.pc-info { flex: 1; min-width: 0; }
.pc-name { font-size: 14.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-meta .pc-star { color: #FFB020; flex-shrink: 0; }
.pc-dist { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); flex-shrink: 0; }
.pc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pc-actions button {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center; background: var(--bg);
}
.pc-actions button svg { width: 14px; height: 14px; color: var(--text-secondary); }
.pc-actions button.danger svg { color: var(--danger); }
.pc-actions button.danger { background: var(--danger-tint); }

/* Spinner */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.dark { border-color: var(--spinner-track); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0; background: var(--loading-overlay-bg);
  display: none; align-items: center; justify-content: center; z-index: 9998;
  backdrop-filter: blur(2px);
}
.loading-overlay.show { display: flex; }

/* ============================================
   STATISTIQUES
   ============================================ */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.stats-card {
  background: var(--sheet-bg); border-radius: var(--radius-card); padding: 16px 14px;
  box-shadow: var(--shadow-card); text-align: center;
}
.stats-card b { display: block; font-size: 24px; font-weight: 800; color: var(--accent); }
.stats-card span { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.stats-section-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; margin: 20px 0 10px; }
.stats-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stats-bar-emoji { font-size: 17px; flex-shrink: 0; width: 22px; text-align: center; }
.stats-bar-name { font-size: 13px; font-weight: 600; width: 92px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-bar-track { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.stats-bar-fill { height: 100%; border-radius: 4px; }
.stats-bar-count { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); width: 26px; text-align: right; flex-shrink: 0; }

.admin-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.admin-action-btn {
  border: none; border-radius: var(--radius-card); padding: 16px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--sheet-bg); box-shadow: var(--shadow-card); color: var(--text);
}
.admin-action-btn svg { width: 22px; height: 22px; color: var(--accent); margin-bottom: 2px; }
.admin-action-btn.primary { background: var(--accent); color: white; box-shadow: 0 4px 14px var(--accent-tint); }
.admin-action-btn.primary svg { color: white; }
.admin-action-label { font-size: 13.5px; font-weight: 800; }
.admin-action-sub { font-size: 10.5px; font-weight: 600; opacity: 0.75; text-align: center; }
.stats-empty { text-align: center; color: var(--text-secondary); font-size: 13.5px; padding: 20px; }

.badges-summary {
  text-align: center; font-size: 14px; font-weight: 700; color: var(--accent);
  background: var(--accent-tint); border-radius: var(--radius-pill);
  padding: 10px; margin-bottom: 16px;
}

/* ---- Salle des trophées ---- */
.trophy-summary { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0 22px; }
.trophy-summary-ring {
  --pct: 0;
  width: 96px; height: 96px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--border) 0);
  display: flex; align-items: center; justify-content: center;
}
.trophy-summary-ring span {
  width: 80px; height: 80px; border-radius: 50%; background: var(--sheet-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: var(--text);
}
.trophy-summary-ring span small { font-size: 12px; font-weight: 700; color: var(--text-tertiary); margin-left: 1px; }
.trophy-summary-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; }

.trophy-group-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 800; color: var(--text); text-transform: uppercase; letter-spacing: 0.3px;
  margin: 4px 0 10px;
}
.trophy-group-count { font-size: 11.5px; font-weight: 700; color: var(--text-tertiary); }

.badges-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-bottom: 20px; }
.badge-tile {
  background: white; border-radius: var(--radius-card); padding: 14px 8px 10px;
  text-align: center; position: relative; box-shadow: var(--shadow-card);
  transition: transform .15s ease;
}
.badge-tile.locked { filter: grayscale(1); opacity: 0.4; }
.badge-tile.unlocked {
  background: linear-gradient(160deg, var(--tier-light) 0%, var(--tier-color) 100%);
  box-shadow: 0 4px 14px var(--tier-glow);
}
.badge-tile.unlocked .badge-name { color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.badge-tile-new { animation: badgeNewPulse 1.6s ease-in-out 2; }
@keyframes badgeNewPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.badge-new-dot {
  position: absolute; top: -4px; left: -4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--sheet-bg);
}
.badge-emoji { font-size: 28px; line-height: 1; margin-bottom: 6px; }
.badge-name { font-size: 10.5px; font-weight: 700; color: var(--text); line-height: 1.25; }
.badge-check {
  position: absolute; top: 6px; right: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(255,255,255,0.9); color: var(--green);
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.badge-progress-bar { width: 100%; height: 4px; border-radius: 2px; background: var(--border); margin-top: 6px; overflow: hidden; }
.badge-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s ease; }
.badge-progress { font-size: 9.5px; font-weight: 700; color: var(--text-tertiary); margin-top: 3px; }

/* ============================================
   CONFETTIS (paliers atteints)
   ============================================ */
.confetti-container { position: fixed; inset: 0; pointer-events: none; z-index: 10000; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -12px; width: 8px; height: 14px; opacity: 0.95;
  animation-name: confettiFall;
  animation-timing-function: cubic-bezier(.25,.46,.45,.94);
  animation-fill-mode: forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(112vh) translateX(var(--drift)) rotate(var(--rot)); opacity: 0.5; }
}

/* ============================================
   COCHE DE SUCCÈS (enregistrement confirmé)
   ============================================ */
.success-check-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0;
}
.success-check-overlay.show { opacity: 1; }

/* ============================================
   ÉCRAN DE DÉMARRAGE (boot splash)
   ============================================ */
#boot-splash {
  position: fixed; inset: 0; height: var(--app-height); z-index: 100000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: linear-gradient(160deg, #3BB8E4 0%, #2478C7 100%);
  transition: opacity .4s ease;
}
#boot-splash.hide { opacity: 0; pointer-events: none; }
.boot-splash-badge {
  width: 96px; height: 96px; border-radius: 26px;
  background: white; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  animation: bootBadgeIn .5s cubic-bezier(.34,1.56,.64,1);
}
.boot-splash-badge img { width: 70px; height: 70px; object-fit: contain; }
.boot-splash-slogan {
  color: rgba(255,255,255,0.92); font-size: 14px; font-weight: 600;
  text-align: center; max-width: 240px; line-height: 1.4;
  animation: bootBadgeIn .5s cubic-bezier(.34,1.56,.64,1) .08s both;
}
.boot-splash-version {
  position: absolute; left: 0; right: 0;
  bottom: calc(22px + var(--safe-bottom));
  text-align: center;
  color: rgba(255,255,255,0.6); font-size: 11.5px; font-weight: 600; letter-spacing: 0.3px;
}
@keyframes bootBadgeIn {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.success-check-circle { width: 84px; height: 84px; }
.success-check-circle svg { width: 100%; height: 100%; }
.success-check-circle-bg {
  fill: none; stroke: var(--green); stroke-width: 3;
  stroke-dasharray: 151; stroke-dashoffset: 151;
  transform-origin: center; transform: scale(0.7);
  filter: drop-shadow(0 4px 14px rgba(0,0,0,0.25));
}
.success-check-mark {
  stroke: var(--green); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40;
}
.success-check-overlay.show .success-check-circle-bg {
  animation: successCircleIn .35s cubic-bezier(.34,1.56,.64,1) forwards;
}
.success-check-overlay.show .success-check-mark {
  animation: successMarkIn .3s ease .28s forwards;
}
@keyframes successCircleIn {
  0% { stroke-dashoffset: 151; transform: scale(0.6); fill: rgba(52,199,89,0.12); }
  100% { stroke-dashoffset: 0; transform: scale(1); fill: rgba(52,199,89,0.12); }
}
@keyframes successMarkIn {
  to { stroke-dashoffset: 0; }
}

/* ============================================
   SOCIAL — recherche, abonnements, notifications
   ============================================ */
.icon-btn-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}
.menu-badge {
  flex: 0 0 auto !important;
  text-align: center !important;
  background: var(--danger); color: white;
  font-size: 11px; font-weight: 800;
  min-width: 20px; height: 20px; border-radius: 10px;
  padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  margin-right: 4px;
}

.people-search-bar { padding: 14px 16px 4px; background: var(--sheet-bg); }

.person-row {
  display: flex; align-items: center; gap: 12px;
  background: white; border-radius: var(--radius-card);
  padding: 11px 14px; margin-bottom: 10px;
  box-shadow: var(--shadow-card);
}
.person-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; overflow: hidden;
}
.person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-info { flex: 1; min-width: 0; }
.person-pseudo { font-size: 14.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verified-badge { width: 15px; height: 15px; vertical-align: -2px; margin-left: 3px; flex-shrink: 0; display: inline-block; }
.profile-name .verified-badge { width: 18px; height: 18px; vertical-align: -3px; }
.author-name .verified-badge { width: 13px; height: 13px; vertical-align: -1px; }
.person-sub { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.person-new-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex-shrink: 0;
}
.btn-follow {
  flex-shrink: 0; border: none; border-radius: var(--radius-pill);
  padding: 8px 16px; font-size: 12.5px; font-weight: 700;
  background: var(--accent); color: white;
}
.btn-follow.following { background: var(--bg); color: var(--text-secondary); }

/* ============================================
   MODAL : conflit de pseudo
   ============================================ */
.pseudo-conflict-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0 0 4px; }
.announcement-icon { font-size: 40px; text-align: center; margin-bottom: 4px; }

/* ============================================
   GRAND ÉCRAN (iPad, ordinateur)
   Sur mobile, rien ne change ici (tout est sous ces media queries).
   Approche : un vrai site web adaptatif, pas une maquette de téléphone recentrée.
   ============================================ */
@media (min-width: 900px) {
  /* ---- Carte principale : liste en colonne fixe à gauche, carte sur le reste de la
     largeur — plus de tiroir qu'on tire à la main, la liste est toujours visible. ---- */
  #view-map .sheet {
    position: absolute; left: 0; top: 0; bottom: 0; right: auto;
    width: 420px; height: 100% !important; max-height: none;
    border-radius: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.08);
    transition: none;
  }
  #view-map .sheet-handle-area, #view-map .view-toggle { display: none; }
  #view-map .sheet-header { padding-top: calc(var(--safe-top) + 20px); }
  #view-map #map-canvas { position: absolute; left: 420px; right: 0; top: 0; bottom: 0; width: auto; height: auto; }
  #view-map .map-topbar { left: 436px; }
  #view-map .filters-panel { left: 420px; }
  #view-map .fab { bottom: 24px !important; }
  #view-map #btn-locate { bottom: 24px !important; }

  /* ---- Tous les autres écrans : en-tête ET contenu à la MÊME largeur, centrés, pour
     rester alignés l'un avec l'autre (largeurs différentes = mise en page bancale).
     `width: 100%` est indispensable : sans lui, un enfant flex avec juste max-width
     peut se réduire à son contenu minimal au lieu de remplir l'espace disponible
     (c'est ce qui cassait la fiche lieu — les boutons retour/favori disparaissaient
     avec elle puisqu'ils sont positionnés par rapport à ce bloc). ---- */
  .manage-header, .add-header, .profile-header,
  .manage-body, .add-body, .profile-scroll, .panel-header, .panel-body {
    max-width: 680px;
    width: 100%;
    margin-left: auto; margin-right: auto;
  }
  .detail-photo, .detail-sheet {
    max-width: 900px;
    width: 100%;
    margin-left: auto; margin-right: auto;
  }
  #view-detail { align-items: center; background: var(--bg); }
}

/* ============================================
   BANNIÈRE "AJOUTER À L'ÉCRAN D'ACCUEIL"
   (navigateur mobile uniquement — jamais en PWA déjà installée)
   ============================================ */
.a2hs-banner {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  z-index: 9997;
  background: var(--sheet-bg);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  padding: 14px 40px 14px 14px;
  display: flex; align-items: center; gap: 12px;
  transform: translateY(120%);
  transition: transform .35s cubic-bezier(.34,1.4,.64,1);
}
.a2hs-banner.show { transform: translateY(0); }
.a2hs-icon { width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.a2hs-text { flex: 1; min-width: 0; }
.a2hs-title { font-size: 14px; font-weight: 800; color: var(--text); }
.a2hs-sub { font-size: 12px; color: var(--text-secondary); line-height: 1.35; margin-top: 2px; }
.a2hs-inline-icon { width: 13px; height: 13px; vertical-align: -2px; color: var(--accent); }
.a2hs-close {
  position: absolute; top: 10px; right: 10px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg); border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
}
.a2hs-close svg { width: 12px; height: 12px; }
.a2hs-install-btn {
  flex-shrink: 0; background: var(--accent); color: white; border: none;
  border-radius: var(--radius-pill); padding: 9px 16px; font-size: 13px; font-weight: 700;
}

/* ============================================
   NOUVEAUTÉS (journal des versions)
   ============================================ */
.changelog-entry {
  background: white; border-radius: var(--radius-card);
  padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow-card);
}
.changelog-version {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-tint); color: var(--accent);
  font-size: 12.5px; font-weight: 800; letter-spacing: 0.2px;
  padding: 4px 10px; border-radius: var(--radius-pill); margin-bottom: 10px;
}
.changelog-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.changelog-list li {
  font-size: 13.5px; color: var(--text); line-height: 1.4;
  padding-left: 16px; position: relative;
}
.changelog-list li::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
