/* ============================================================
   MOBILITÉ LITTORAL & SAM — Design System
   Mobile-first, responsive, production-grade
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --blue:      #0071E3;
  --blue-dark: #0057B8;
  --blue-soft: rgba(0, 113, 227, 0.12);
  --green:     #34C759;
  --orange:    #FF9500;
  --red:       #FF3B30;
  --sam:       #FF6B2B;

  --bg-sheet:  rgba(255,255,255,0.98);
  --bg-glass:  rgba(255,255,255,0.85);
  --border:    rgba(0,0,0,0.08);
  --text:      #1C1C1E;
  --text-2:    #636366;
  --text-3:    #AEAEB2;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --shadow-sm: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.18);

  --font:      'DM Sans', -apple-system, sans-serif;
  --font-mono: 'DM Mono', monospace;

  --topbar-h:  60px;
  --bubble-h:  80px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   MAP
   ============================================================ */
#map {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.mapboxgl-ctrl-bottom-right,
.mapboxgl-ctrl-bottom-left {
  bottom: calc(var(--bubble-h) + 16px) !important;
}

/* ============================================================
   GLASS
   ============================================================ */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--border);
}

/* ============================================================
   TOPBAR — mobile first
   ============================================================ */
.topbar {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  height: var(--topbar-h);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 10px 0 12px;
  gap: 8px;
}

.topbar-left { display: flex; align-items: center; flex-shrink: 0; }

.logo { display: flex; align-items: center; gap: 8px; }

.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #0071E3, #00C2FF);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  box-shadow: 0 3px 10px rgba(0,113,227,0.35);
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-main { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
.logo-sub  { font-size: 10px; font-weight: 600; color: var(--blue); }

.topbar-center {
  flex: 1;
  min-width: 0;
  position: relative;
}

.search-wrap {
  display: flex;
  align-items: center;
  background: rgba(0,0,0,0.05);
  border-radius: 16px;
  padding: 0 10px;
  height: 36px;
  transition: background 0.2s;
}
.search-wrap:hover { background: rgba(0,0,0,0.08); }

.search-icon { font-size: 16px; color: var(--text-2); margin-right: 6px; flex-shrink: 0; }
.search-input {
  border: none; background: transparent; outline: none;
  font-family: var(--font); font-size: 14px; color: var(--text);
  width: 100%;
}
.search-input::placeholder { color: var(--text-3); }

.search-clear {
  background: rgba(0,0,0,0.08); border: none; border-radius: 50%;
  width: 18px; height: 18px; font-size: 9px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); flex-shrink: 0;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
}

.search-result-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex; align-items: flex-start; gap: 8px;
  transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--blue-soft); }
.sri-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.sri-main { font-weight: 600; color: var(--text); font-size: 13px; }
.sri-sub  { font-size: 11px; color: var(--text-2); }

.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  border: none; background: rgba(0,0,0,0.05);
  border-radius: 50%; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; flex-shrink: 0;
}
.icon-btn:hover { background: rgba(0,0,0,0.1); }

.badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px;
  border-radius: 8px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

.avatar-btn {
  width: 36px; height: 36px;
  border: none; border-radius: 50%; overflow: hidden;
  cursor: pointer; padding: 0;
  box-shadow: 0 0 0 2px var(--blue);
  flex-shrink: 0;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   FLOATING BUBBLES — mobile first (barre du bas)
   ============================================================ */
.bubbles-container {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  height: var(--bubble-h);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px env(safe-area-inset-bottom, 8px);
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
  z-index: 100;
}

.bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none; background: transparent;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 14px;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
  flex: 1;
  max-width: 72px;
}

.bubble:active { transform: scale(0.92); }

.bubble-icon {
  font-size: 22px;
  line-height: 1;
}

.bubble-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}

.bubble-badge {
  position: absolute;
  top: 2px; right: 4px;
  background: var(--red); color: #fff;
  font-size: 8px; font-weight: 700;
  min-width: 14px; height: 14px;
  border-radius: 7px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

.bubble-new .bubble-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #0071E3, #00C2FF);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 22px;
  box-shadow: 0 4px 14px rgba(0,113,227,0.45);
}

/* ============================================================
   BOTTOM SHEETS — mobile first
   ============================================================ */
.sheet {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  transform: translateY(100%);
  max-height: 88vh;
  background: var(--bg-sheet);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px calc(var(--bubble-h) + 16px);
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
  overscroll-behavior: contain;
}

.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 36px; height: 5px;
  background: rgba(0,0,0,0.12);
  border-radius: 3px;
  margin: 12px auto 14px;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  position: sticky;
  top: 0;
  background: var(--bg-sheet);
  padding: 6px 0 10px;
  z-index: 1;
}

.sheet-header h2 { font-size: 19px; font-weight: 700; }

.sheet-close {
  width: 28px; height: 28px;
  border: none; background: rgba(0,0,0,0.06);
  border-radius: 50%; cursor: pointer; font-size: 13px;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ============================================================
   FORMS
   ============================================================ */
.field-group { margin-bottom: 12px; }

.field-group label {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.input-field {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 15px;
  color: var(--text); background: rgba(0,0,0,0.02);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.input-field:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
  background: white;
}
textarea.input-field { resize: vertical; min-height: 68px; }
select.input-field { cursor: pointer; }

/* TYPE PILLS */
.type-pills, .histo-filters {
  display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap;
}

.pill {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--text-2); background: transparent;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.pill:active { transform: scale(0.96); }
.pill.active { background: var(--blue); border-color: var(--blue); color: white; }

/* ADDRESS ROW */
.addr-row { display: flex; align-items: center; gap: 8px; }
.addr-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.addr-dot.dep { background: var(--green); }
.addr-dot.arr { background: var(--red); }
.addr-input { flex: 1; min-width: 0; }

.locate-btn {
  width: 40px; height: 40px; flex-shrink: 0;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: white; cursor: pointer; font-size: 18px; color: var(--blue);
  display: flex; align-items: center; justify-content: center;
}

/* CALCULATE */
.btn-calc {
  width: 100%; padding: 14px;
  background: var(--blue); color: white; border: none;
  border-radius: var(--radius-md);
  font-family: var(--font); font-size: 16px; font-weight: 600;
  cursor: pointer; margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0,113,227,0.3);
  -webkit-appearance: none;
}
.btn-calc:active { opacity: 0.85; }

/* ROUTE CARDS */
.route-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 12px;
}

.route-card {
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; text-align: center;
}
.route-card.highlight { background: var(--blue-soft); border-color: rgba(0,113,227,0.2); }
.rc-icon { font-size: 16px; }
.rc-val { font-size: 15px; font-weight: 700; font-family: var(--font-mono); }
.rc-label { font-size: 9px; color: var(--text-2); font-weight: 600; }

.tarif-detail {
  background: rgba(52,199,89,0.08);
  border: 1px solid rgba(52,199,89,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 12px; color: var(--text-2);
  margin-bottom: 12px; line-height: 1.6;
}

/* BUTTONS */
.btn-row { display: flex; gap: 8px; margin-top: 14px; }

.btn-primary {
  flex: 1; padding: 13px;
  background: var(--blue); color: white; border: none;
  border-radius: var(--radius-md);
  font-family: var(--font); font-size: 15px; font-weight: 600;
  cursor: pointer; -webkit-appearance: none;
}
.btn-primary:active { opacity: 0.85; }

.btn-secondary {
  flex: 1; padding: 13px;
  background: rgba(0,0,0,0.05); color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font); font-size: 15px; font-weight: 600;
  cursor: pointer; -webkit-appearance: none;
}

.mt16 { margin-top: 16px; }

.count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: var(--blue); color: white;
  font-size: 11px; font-weight: 700; border-radius: 10px; margin-left: 6px;
}

/* ============================================================
   LOADING / EMPTY STATES
   ============================================================ */
.loading-msg, .empty-msg {
  text-align: center; padding: 32px 16px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
}
.empty-msg { font-size: 15px; }

/* ============================================================
   COURSE ITEMS
   ============================================================ */
.course-list, .histo-list { display: flex; flex-direction: column; gap: 8px; }

.course-item {
  background: rgba(0,0,0,0.02);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  transition: background 0.15s;
}

.ci-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.ci-icon.medical   { background: rgba(255,59,48,0.12); }
.ci-icon.courses   { background: rgba(0,113,227,0.12); }
.ci-icon.vacances  { background: rgba(255,149,0,0.12); }
.ci-icon.sam       { background: rgba(255,107,43,0.12); }
.ci-icon.beneficiaire { background: rgba(52,199,89,0.12); }

.ci-content { flex: 1; min-width: 0; }
.ci-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.ci-route {
  font-size: 11px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 1px;
}

.ci-meta { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ci-time  { font-size: 10px; color: var(--text-2); }
.ci-price { font-size: 13px; font-weight: 700; color: var(--blue); }

.ci-actions { display: flex; gap: 4px; margin-top: 4px; }

.btn-statut {
  padding: 3px 7px; font-size: 11px; font-weight: 700;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: white; cursor: pointer; color: var(--text-2);
  transition: all 0.15s;
}
.btn-statut:hover { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.btn-statut.done:hover { background: rgba(52,199,89,0.12); border-color: var(--green); color: var(--green); }

.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; margin-right: 4px; flex-shrink: 0;
}
.status-dot.en-cours { background: var(--green); }
.status-dot.attente  { background: var(--orange); }
.status-dot.termine  { background: var(--text-3); }

/* ============================================================
   BÉNÉVOLES GRID
   ============================================================ */
.benevoles-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

.bv-card {
  background: rgba(0,0,0,0.02); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 10px;
  text-align: center; cursor: pointer;
}

.bv-avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; margin: 0 auto 6px; }
.bv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bv-name  { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.bv-phone { font-size: 11px; color: var(--text-2); margin-bottom: 3px; }
.bv-status { font-size: 10px; font-weight: 700; margin-bottom: 8px; }
.bv-status.dispo  { color: var(--green); }
.bv-status.occupe { color: var(--orange); }

.bv-toggle-row { display: flex; justify-content: center; }

.btn-bv-statut {
  padding: 4px 10px; font-size: 10px; font-weight: 600;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: white; cursor: pointer; color: var(--text-2);
  font-family: var(--font);
}

/* ============================================================
   STATS
   ============================================================ */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.stat-card {
  background: rgba(0,0,0,0.02); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-card.full {
  grid-column: 1 / -1; flex-direction: row;
  align-items: center; justify-content: space-between;
}

.stat-val {
  font-size: 26px; font-weight: 800;
  font-family: var(--font-mono); color: var(--blue);
}
.stat-val.green { color: var(--green); }
.stat-val.red   { color: var(--red); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-2); }

/* ============================================================
   PROFILE PANEL
   ============================================================ */
.profile-panel {
  position: fixed; top: 76px; right: 10px;
  width: min(230px, calc(100vw - 20px));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 300; padding: 14px;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.profile-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.profile-avatar { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--blue); }
.profile-name { font-size: 14px; font-weight: 700; }
.profile-role { font-size: 11px; color: var(--blue); font-weight: 600; }

.profile-menu { display: flex; flex-direction: column; gap: 1px; }

.pmenu-item {
  width: 100%; padding: 9px 10px; text-align: left;
  border: none; background: transparent;
  font-family: var(--font); font-size: 13px; color: var(--text);
  cursor: pointer; border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.pmenu-item:hover { background: rgba(0,0,0,0.05); }
.pmenu-item.danger { color: var(--red); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  z-index: 400;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}

.modal {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }

.tarif-preview {
  background: rgba(0,0,0,0.03); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 14px;
}
.tp-row {
  display: flex; justify-content: space-between;
  font-size: 13px; padding: 3px 0;
}
.tp-val { font-weight: 700; color: var(--blue); font-family: var(--font-mono); }

/* ============================================================
   NOTIFICATIONS PANEL
   ============================================================ */
.notif-panel {
  position: fixed; top: 76px; right: 52px;
  width: min(290px, calc(100vw - 20px));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 300;
  overflow: hidden; animation: slideDown 0.2s ease;
}

.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px; border-bottom: 1px solid var(--border);
}
.notif-header h3 { font-size: 14px; font-weight: 700; }
.notif-clear-all {
  font-size: 11px; color: var(--blue); border: none; background: transparent;
  cursor: pointer; font-weight: 600; font-family: var(--font);
}

.notif-list { max-height: 280px; overflow-y: auto; }

.notif-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; position: relative;
}
.notif-item:hover { background: rgba(0,0,0,0.03); }
.notif-item.unread { background: var(--blue-soft); }
.notif-item.unread::before {
  content: ''; position: absolute; left: 5px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--blue);
}
.ni-icon { font-size: 18px; flex-shrink: 0; }
.ni-content { flex: 1; min-width: 0; }
.ni-title { font-size: 12px; font-weight: 600; margin-bottom: 1px; }
.ni-body  { font-size: 11px; color: var(--text-2); line-height: 1.4; }
.ni-time  { font-size: 10px; color: var(--text-3); margin-top: 2px; }

.notif-empty { padding: 24px; text-align: center; color: var(--text-3); }
.notif-empty span { font-size: 28px; display: block; margin-bottom: 6px; }
.notif-empty p { font-size: 12px; }

/* ============================================================
   AUTOCOMPLETE DROPDOWN
   ============================================================ */
.addr-dropdown {
  position: fixed; z-index: 9999;
  background: white; border-radius: 12px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(0,0,0,0.08);
  overflow: hidden;
  max-height: 220px; overflow-y: auto;
}
.addr-dropdown-item {
  padding: 10px 14px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid rgba(0,0,0,0.05); line-height: 1.4;
  transition: background 0.15s;
}
.addr-dropdown-item:last-child { border-bottom: none; }
.addr-dropdown-item:hover { background: var(--blue-soft); }
.addr-dropdown-item strong { color: var(--text); }
.addr-dropdown-item span { color: var(--text-2); font-size: 11px; }

/* ============================================================
   SQL BLOCK
   ============================================================ */
.sql-block {
  position: relative; background: #1a1a2e;
  border-radius: var(--radius-sm); padding: 14px;
  overflow: auto; max-height: 220px;
}
.sql-block pre {
  font-family: var(--font-mono); font-size: 10px; color: #a8dadc;
  white-space: pre; margin: 0; line-height: 1.7;
}
.sql-copy {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.1); border: none;
  color: white; font-size: 11px; padding: 4px 10px;
  border-radius: 6px; cursor: pointer; font-family: var(--font);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(var(--bubble-h) + 12px);
  left: 50%; transform: translateX(-50%) translateY(10px);
  background: rgba(28,28,30,0.92); color: white;
  padding: 11px 18px; border-radius: 20px;
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 500; white-space: nowrap;
  backdrop-filter: blur(12px);
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   SHEET OVERLAY
   ============================================================ */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.25); z-index: 150; display: none;
}
.sheet-overlay.visible { display: block; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.route-progress-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  z-index: 999; display: none;
  animation: progress 1.5s ease-in-out infinite;
}
@keyframes progress {
  0%   { clip-path: inset(0 100% 0 0); }
  50%  { clip-path: inset(0 0% 0 0); }
  100% { clip-path: inset(0 0 0 100%); }
}

/* ============================================================
   MAPBOX OVERRIDES
   ============================================================ */
.mapboxgl-ctrl-geocoder { display: none !important; }

/* ============================================================
   TABLET (600px+)
   ============================================================ */
@media (min-width: 600px) {
  :root { --topbar-h: 64px; }

  .topbar { top: 12px; left: 12px; right: 12px; padding: 0 12px 0 16px; gap: 12px; }
  .logo-icon { width: 36px; height: 36px; font-size: 18px; }
  .logo-main { font-size: 14px; }

  .bubbles-container {
    bottom: 20px; left: 50%; right: auto;
    transform: translateX(-50%);
    width: auto; height: auto;
    border-radius: 50px;
    border: 1px solid var(--border);
    border-top: 1px solid var(--border);
    padding: 8px 16px;
    gap: 4px;
  }

  .bubble { max-width: none; padding: 8px 14px; }
  .bubble-label { font-size: 10px; }

  .sheet {
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 0 20px 32px;
  }
  .sheet.open { transform: translateX(-50%) translateY(0); }

  .route-cards { grid-template-columns: 1fr 1fr 1fr 1fr; }

  .toast { bottom: 90px; }

  .modal-overlay { align-items: center; padding: 20px; }
  .modal { border-radius: var(--radius-xl); padding: 24px; }
}

/* ============================================================
   DESKTOP (900px+)
   ============================================================ */
@media (min-width: 900px) {
  :root { --topbar-h: 64px; }

  .topbar { top: 16px; left: 16px; right: 16px; }

  .bubbles-container {
    left: auto; right: 16px; bottom: 50%;
    transform: translateY(50%);
    flex-direction: column;
    border-radius: 30px;
    padding: 10px 8px;
    gap: 2px;
    width: auto; height: auto;
    border: 1px solid var(--border);
    border-top: 1px solid var(--border);
  }

  .bubble { padding: 10px 12px; max-width: none; width: 64px; }
  .bubble-label { font-size: 9px; }

  .sheet {
    left: 16px;
    transform: translateX(0) translateY(100%);
    max-width: 420px;
    max-height: calc(100vh - 100px);
  }
  .sheet.open { transform: translateX(0) translateY(0); }

  .toast { bottom: 32px; }

  .mapboxgl-ctrl-bottom-right,
  .mapboxgl-ctrl-bottom-left { bottom: 24px !important; }
}

/* ============================================================
   VERY SMALL PHONES (< 360px)
   ============================================================ */
@media (max-width: 359px) {
  .logo-text { display: none; }
  .topbar { padding: 0 8px; gap: 6px; }
  .bubble-label { display: none; }
  .bubble { padding: 6px 8px; }
  .bubbles-container { padding: 0 4px env(safe-area-inset-bottom, 4px); }
  .route-cards { grid-template-columns: 1fr 1fr; }
  .benevoles-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(135deg, #0057B8 0%, #0071E3 50%, #00C2FF 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.login-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 380px;
    border-radius: var(--radius-xl);
    padding: 32px 28px 28px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center; margin-bottom: 28px;
}

.login-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #0071E3, #00C2FF);
  border-radius: 18px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  box-shadow: 0 8px 24px rgba(0,113,227,0.4);
}

.login-title {
  font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 2px;
}

.login-sub {
  font-size: 14px; font-weight: 600; color: var(--blue);
}

.login-error {
  background: rgba(255,59,48,0.1);
  border: 1px solid rgba(255,59,48,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px; color: var(--red);
  margin-bottom: 12px;
}

.login-hint {
  text-align: center; font-size: 12px;
  color: var(--text-3); margin-top: 14px;
}

/* PASSWORD FIELD */
.pwd-wrap {
  position: relative; display: flex; align-items: center;
}
.pwd-wrap .input-field { padding-right: 44px; }

.pwd-toggle {
  position: absolute; right: 10px;
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--text-2); padding: 4px;
  line-height: 1;
}

/* ============================================================
   ROLE BADGE
   ============================================================ */
.role-badge {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  background: rgba(255,149,0,0.15);
  border: 1px solid rgba(255,149,0,0.3);
  color: var(--orange);
  font-size: 11px; font-weight: 700;
  padding: 5px 14px; border-radius: 20px;
  z-index: 99;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

/* ============================================================
   COMPTES LIST (modal gérer comptes)
   ============================================================ */
.comptes-list {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 16px; max-height: 200px; overflow-y: auto;
}

.compte-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.compte-info { display: flex; flex-direction: column; gap: 2px; }
.compte-info strong { font-size: 13px; font-weight: 600; }
.compte-email { font-size: 11px; color: var(--text-2); }

.compte-role {
  font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 10px;
}
.compte-role.admin    { background: rgba(0,113,227,0.1); color: var(--blue); }
.compte-role.benevole { background: rgba(52,199,89,0.1); color: var(--green); }

.modal-divider {
  border: none; border-top: 1px solid var(--border); margin: 16px 0;
}

/* ============================================================
   STATUT DONE TAG (historique)
   ============================================================ */
.statut-done {
  font-size: 10px; font-weight: 600; color: var(--green);
  background: rgba(52,199,89,0.1); border-radius: 8px;
  padding: 3px 8px; white-space: nowrap;
}

/* ============================================================
   FORGOT PASSWORD BUTTON
   ============================================================ */
.btn-forgot {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  margin-top: 4px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.btn-forgot:hover { background: var(--blue-soft); }
