/* ==================================================================
   RL Inspections — styles de l'application mobile dédiée (m-*)
   Rendue par public/js/mobile/mobile-app.jsx sous 760 px.
   ================================================================== */

:root {
  --m-bg: #f2f2f7;
  --m-card: #ffffff;
  --m-border: #e3e6ee;
  --m-text: #111827;
  --m-text2: #4b5563;
  --m-text3: #8a8f9c;
  --m-accent: #2563eb;
  --m-danger: #dc2626;
  --m-radius: 14px;
  --m-header-h: 52px;
  --m-tabbar-h: 62px;
  --m-safe-top: env(safe-area-inset-top, 0px);
  --m-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Base mobile (partagé avec la page de connexion) ---------- */
@media (max-width: 760px) {
  html.mobile-native,
  html.mobile-native body {
    background: var(--m-bg);
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
  }
  /* Page de connexion (hors app mobile) : scroll document normal. */
  html:not(.m-app-active) body {
    overflow-y: auto !important;
    overflow-x: hidden;
    height: auto;
    min-height: 100%;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  html.mobile-native input,
  html.mobile-native select,
  html.mobile-native textarea {
    font-size: 16px; /* anti-zoom iOS */
  }
}

/* ---------- Shell ----------
   L'app est un conteneur figé (position:fixed inset:0) : le header et la
   barre d'onglets sont dans le flux, seul .m-content scrolle. Aucun élément
   fixed ne dépend du scroll de page → pas de barre qui « remonte » sur iOS. */
html.m-app-active,
html.m-app-active body {
  overflow: hidden;
  height: 100%;
}

.m-app {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* 100dvh suit la barre d'outils Safari qui se replie : la barre d'onglets
     colle toujours au bas réellement visible (inset:0 laissait un vide). */
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--m-bg);
  color: var(--m-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

/* Header clair, fondu avec la barre d'état / Dynamic Island (Safari : theme-color clair). */
.m-header {
  flex-shrink: 0;
  min-height: calc(var(--m-header-h) + var(--m-safe-top));
  padding: var(--m-safe-top) 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(242, 242, 247, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
  color: var(--m-text);
}
.m-header-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--m-text);
}
.m-offline-dot {
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  padding: 3px 8px;
  border-radius: 999px;
}

/* App installée (standalone) : la barre d'état suit theme-color (clair) sur iOS 15+,
   le header clair se fond avec — même look que dans Safari. */

.m-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 12px 14px 26px;
  position: relative;
}
.m-content--pulling {
  overscroll-behavior-y: none;
}
.m-ptr {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding-bottom: 6px;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.m-ptr-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--m-text3);
}
.m-ptr-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--m-accent);
  border-radius: 50%;
  opacity: 0;
}
.m-ptr--active .m-ptr-spinner {
  opacity: 1;
  animation: m-ptr-spin 0.7s linear infinite;
}
@keyframes m-ptr-spin {
  to { transform: rotate(360deg); }
}
/* Clavier ouvert (overlay) : on dégage l'espace pour garder le champ visible. */
html.keyboard-open .m-content {
  padding-bottom: calc(26px + var(--keyboard-inset, 0px));
}
.m-content-inner {
  max-width: 640px;
  margin: 0 auto;
}

.m-loading {
  padding: 60px 0;
  text-align: center;
  color: var(--m-text3);
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Écran bloquant (mise à jour, calendrier requis) ---------- */
.m-blocking {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: calc(var(--m-safe-top) + 24px) 28px calc(var(--m-safe-bottom) + 24px);
  text-align: center;
}
.m-blocking-title { font-size: 21px; font-weight: 800; letter-spacing: -0.3px; }
.m-blocking-text { font-size: 14px; color: var(--m-text2); line-height: 1.55; max-width: 340px; }
.m-blocking .m-btn { max-width: 300px; }

/* Flèche flottante « remonter en haut » (au-dessus de la barre d'onglets) */
.m-scrolltop {
  position: absolute;
  right: 14px;
  bottom: calc(var(--m-tabbar-h) + max(var(--m-safe-bottom), 8px) + 14px);
  z-index: 150;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--m-accent);
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.22);
  cursor: pointer;
  animation: m-fade-in 0.18s ease;
}
.m-scrolltop:active { opacity: 0.7; }

/* ---------- Barre d'onglets ---------- */
.m-tabbar {
  flex-shrink: 0;
  min-height: calc(var(--m-tabbar-h) + max(var(--m-safe-bottom), 8px));
  padding: 4px 2px max(var(--m-safe-bottom), 8px);
  display: flex;
  background: rgba(249, 249, 251, 0.96);
  border-top: 0.5px solid rgba(0, 0, 0, 0.12);
}
/* Réinitialise les styles globaux button (index.html : min-height 40px, box-shadow
   au survol) qui peignaient un rectangle blanc autour de la pastille bleue. */
html.m-app-active .m-tabbar .m-tab,
html.m-app-active .m-tabbar .m-tab:hover,
html.m-app-active .m-tabbar .m-tab:active,
html.m-app-active .m-tabbar .m-tab:focus,
html.m-app-active .m-tabbar .m-tab:focus-visible,
html.m-app-active .m-tabbar .m-tab.is-hovered,
html.m-app-active .m-tabbar .m-tab.is-active,
html.m-app-active .m-tabbar .m-tab.is-active:hover,
html.m-app-active .m-tabbar .m-tab.is-active:active {
  flex: 1;
  min-width: 0;
  min-height: 0 !important;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1px;
  margin: 0;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  transform: none !important;
  will-change: auto !important;
  background: transparent !important;
  background-color: transparent !important;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  color: #8e8e93;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.15s ease !important;
}
/* Pastille arrondie : SEUL élément coloré (le bouton parent reste transparent). */
.m-tab-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 4px 3px 3px;
  border-radius: 14px;
  background: transparent;
  transition: background 0.15s ease;
  pointer-events: none;
}
.m-tab.is-active { color: var(--m-accent); }
.m-tab.is-active .m-tab-inner {
  background: rgba(37, 99, 235, 0.14);
}
.m-tab-icon { position: relative; display: inline-flex; flex-shrink: 0; }
.m-tab-label {
  width: 100%;
  line-height: 1.12;
  max-width: 100%;
  text-align: center;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  font-size: 9px;
  letter-spacing: -0.01em;
  padding-bottom: 1px;
}
.m-tab-badge {
  position: absolute;
  top: -4px; right: -10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--m-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Pages ---------- */
.m-page { display: flex; flex-direction: column; gap: 10px; }

.m-hero { padding: 6px 2px 2px; }
.m-hero-hello {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.m-hero-date {
  font-size: 14px;
  color: var(--m-text3);
  font-weight: 600;
  margin-top: 2px;
}

.m-section-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--m-text3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 10px 2px 0;
}
.m-day-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--m-text2);
  margin: 8px 2px 6px;
}
.m-day-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Bandeau « prochaine visite » (Accueil) */
.m-next-visit {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.m-next-visit-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  border: none;
  border-radius: var(--m-radius);
  padding: 12px 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18), 0 1px 2px rgba(16, 24, 40, 0.05);
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.m-next-visit-main:active { opacity: 0.92; }
.m-next-visit-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: var(--m-accent);
}
.m-next-visit-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.m-next-visit-sub {
  font-size: 12px;
  color: var(--m-text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.m-next-visit-nav {
  flex-shrink: 0;
  width: 48px;
  border: none;
  border-radius: var(--m-radius);
  background: var(--m-accent);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}
.m-next-visit-nav:active { opacity: 0.9; }
.m-count-line { font-size: 12px; color: var(--m-text3); font-weight: 600; padding: 0 2px; }

.m-empty {
  background: var(--m-card);
  border-radius: var(--m-radius);
  padding: 22px 16px;
  text-align: center;
  color: var(--m-text3);
  font-size: 13px;
  font-weight: 600;
}
.m-empty-line { color: var(--m-text3); font-size: 13px; padding: 4px 0; }

/* ---------- Cartes ---------- */
.m-card {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--m-card);
  border: none;
  border-radius: var(--m-radius);
  padding: 13px 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.m-card:active { background: #f6f7fa; }
.m-card--urgent { box-shadow: inset 0 0 0 1.5px #fca5a5, 0 1px 2px rgba(16, 24, 40, 0.05); }
.m-card-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 52px;
  flex-shrink: 0;
}
.m-card-time { font-size: 15px; font-weight: 800; color: var(--m-accent); }
.m-card-date { font-size: 11px; color: var(--m-text3); font-weight: 600; }
.m-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.m-card-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-card-sub {
  font-size: 13px;
  color: var(--m-text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-card-addr {
  font-size: 12px;
  color: var(--m-text3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.m-card-insp, .m-card-next { font-size: 12px; color: var(--m-text3); font-weight: 600; }
.m-card-chev {
  align-self: center;
  color: #c7c7cc;
  font-size: 22px;
  font-weight: 600;
  flex-shrink: 0;
}

.m-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.m-pill--urgent { background: #fee2e2; color: #b91c1c; }
.m-pill--neutral { background: #eef0f4; color: var(--m-text2); }

/* ---------- Alerte approbations (accueil) ---------- */
.m-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  text-align: left;
  background: #fff7ed;
  box-shadow: inset 0 0 0 1px #fdba74;
  border-radius: var(--m-radius);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #9a3412;
  cursor: pointer;
}
.m-alert-badge {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #ea580c;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.m-alert .m-card-chev { margin-left: auto; color: #fdba74; }

/* ---------- Segmented control / chips / recherche ---------- */
.m-segment {
  display: flex;
  background: #e3e4ea;
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}
.m-segment button {
  flex: 1;
  border: none;
  background: none;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--m-text2);
  cursor: pointer;
  min-height: 34px;
}
.m-segment button.is-active {
  background: #fff;
  color: var(--m-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.m-search {
  width: 100%;
  border: none;
  background: #e3e4ea;
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 16px;
  color: var(--m-text);
  -webkit-appearance: none;
  appearance: none;
}
.m-search::placeholder { color: #8e8e93; }
.m-search:focus { outline: 2px solid var(--m-accent); outline-offset: 1px; background: #fff; }

.m-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px;
  margin: 0 -2px;
  scrollbar-width: none;
}
.m-chips::-webkit-scrollbar { display: none; }
.m-chip {
  flex-shrink: 0;
  border: none;
  background: #fff;
  color: var(--m-text2);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  min-height: 34px;
}
.m-chip.is-active { background: var(--m-accent); color: #fff; }
.m-chip--jump { color: var(--m-accent); }
.m-chip--danger { color: #b91c1c; }
.m-chip--danger.is-active { background: var(--m-danger); color: #fff; }

/* Rangée de sélecteurs (filtres projet/type/tri des approbations) */
.m-select-row {
  display: flex;
  gap: 6px;
}
.m-select-row select {
  flex: 1;
  min-width: 0;
  border: none;
  background: #fff;
  border-radius: 11px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--m-text2);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  -webkit-appearance: none;
  appearance: none;
}

.m-card-next--late { color: #b91c1c; }
.m-card-next--today { color: var(--m-accent); font-weight: 800; }

/* Carte d'inspection dont la visite est aujourd'hui */
.m-card--today {
  box-shadow: inset 3px 0 0 var(--m-accent), 0 1px 2px rgba(16, 24, 40, 0.06);
  background: #f6f9ff;
}

/* ---------- Calendrier (agenda) ---------- */
.m-month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--m-card);
  border-radius: var(--m-radius);
  padding: 6px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.m-month-nav > button {
  border: none;
  background: #eef0f4;
  border-radius: 10px;
  width: 42px;
  height: 38px;
  font-size: 20px;
  font-weight: 700;
  color: var(--m-accent);
  cursor: pointer;
  flex-shrink: 0;
}
.m-month-nav .m-month-title {
  flex: 1;
  width: auto;
  background: none;
  font-size: 16px;
  font-weight: 800;
  color: var(--m-text);
  letter-spacing: -0.2px;
}
.m-today-btn {
  border: none;
  background: #e8f0fe;
  color: var(--m-accent);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.m-agenda-day { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; scroll-margin-top: 10px; }
.m-agenda-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 2px;
}
.m-agenda-num { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }
.m-agenda-wd { font-size: 12px; font-weight: 700; color: var(--m-text3); text-transform: uppercase; }

/* Aujourd'hui : numéro dans une pastille bleue (style iOS) + bloc surligné. */
.m-agenda-head--today .m-agenda-num {
  background: var(--m-accent);
  color: #fff;
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.m-agenda-head--today { align-items: center; }
.m-agenda-head--today .m-agenda-wd { color: var(--m-accent); }
.m-agenda-day--today {
  background: #e8f0fe;
  border-radius: var(--m-radius);
  padding: 10px;
  margin-left: -10px;
  margin-right: -10px;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}
.m-vacation {
  background: #f5f3ff;
  box-shadow: inset 0 0 0 1px #ddd6fe;
  color: #6d28d9;
  border-radius: var(--m-radius);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
}

/* Départ / retour de déplacement (agenda) */
.m-travel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  border: none;
  border-radius: var(--m-radius);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.m-travel-title { font-size: 13px; font-weight: 800; }
.m-travel-sub { font-size: 12px; font-weight: 600; opacity: 0.75; }
.m-travel:active { opacity: 0.7; }
.m-travel--depart {
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px #bfdbfe;
  color: #1d4ed8;
}
.m-travel--retour {
  background: #f0fdf4;
  box-shadow: inset 0 0 0 1px #bbf7d0;
  color: #166534;
}

/* ---------- Profil ---------- */
.m-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 0 6px;
}
.m-profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2563eb, #1e40af);
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.m-profile-name { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; }
.m-profile-role { font-size: 13px; color: var(--m-text3); font-weight: 600; }
.m-note {
  font-size: 12px;
  color: var(--m-text3);
  line-height: 1.55;
  padding: 0 6px;
}

/* ---------- Boutons ---------- */
.m-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.m-btn:disabled { opacity: 0.55; cursor: default; }
.m-btn--primary { background: var(--m-accent); color: #fff; }
.m-btn--danger { background: #fee2e2; color: var(--m-danger); }

/* ---------- Bottom sheet ---------- */
html.m-sheet-open,
html.m-sheet-open body { overflow: hidden; }

.m-sheet-overlay {
  /* Fenêtre flottante CENTRÉE : rien n'est ancré au bord inférieur, donc
     aucun bug de viewport iOS (Safari ou installée) ne peut laisser de vide. */
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(var(--m-safe-top), 14px) 12px max(var(--m-safe-bottom), 14px);
  animation: m-fade-in 0.2s ease;
}
.m-sheet-overlay--closing { animation: m-fade-out 0.2s ease forwards; }

.m-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  background: var(--m-bg);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.4);
  display: flex;
  flex-direction: column;
  animation: m-pop-in 0.22s cubic-bezier(0.32, 0.72, 0.25, 1);
}
/* Clavier ouvert : on remonte la fenêtre pour garder le champ visible. */
html.keyboard-open .m-sheet {
  margin-bottom: var(--keyboard-inset, 0px);
  max-height: calc(100% - var(--keyboard-inset, 0px));
}
.m-sheet--closing { animation: m-pop-out 0.18s ease forwards; }

.m-sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
  flex-shrink: 0;
}
.m-sheet-title {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #e3e4ea;
  color: var(--m-text2);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
}
.m-sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.m-sheet-footer {
  flex-shrink: 0;
  padding: 10px 16px 14px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  background: rgba(249, 249, 251, 0.94);
  border-radius: 0 0 18px 18px;
}
.m-sheet-status {
  align-self: flex-start;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

@keyframes m-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes m-slide-down { from { transform: translateY(0); } to { transform: translateY(100%); } }
@keyframes m-pop-in { from { transform: scale(0.94) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
@keyframes m-pop-out { from { transform: scale(1); opacity: 1; } to { transform: scale(0.95) translateY(8px); opacity: 0; } }
@keyframes m-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes m-fade-out { from { opacity: 1; } to { opacity: 0; } }

/* ---------- Choix de l'app d'itinéraire ---------- */
.m-mapchooser {
  position: absolute;
  inset: 0;
  z-index: 240;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: m-fade-in 0.15s ease;
}
.m-mapchooser-card {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.4);
  animation: m-pop-in 0.18s cubic-bezier(0.32, 0.72, 0.25, 1);
}
.m-mapchooser-title {
  padding: 16px 16px 2px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}
.m-mapchooser-addr {
  padding: 0 16px 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--m-text2);
}
.m-mapchooser-opt {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  background: none;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: var(--m-accent);
  text-decoration: none;
  cursor: pointer;
}
.m-mapchooser-opt:active { background: #f2f2f7; }
.m-mapchooser-opt--primary {
  color: var(--m-accent);
  font-weight: 800;
}
.m-mapchooser-cancel { font-weight: 800; color: var(--m-text2); }

/* ---------- Sections de fiche ---------- */
.m-section {
  background: var(--m-card);
  border-radius: var(--m-radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.m-section--card { box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
.m-section-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--m-text3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.m-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 0.5px solid var(--m-border);
}
.m-field:last-child { border-bottom: none; }
.m-field-label { font-size: 13px; color: var(--m-text3); font-weight: 600; flex-shrink: 0; }
.m-field-value {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
  min-width: 0;
}
.m-field-value--multi { text-align: left; white-space: pre-wrap; width: 100%; }
.m-field:has(.m-field-value--multi) { flex-direction: column; align-items: stretch; gap: 4px; }

/* ---------- Visites (fiche inspection) ---------- */
.m-visit {
  border-radius: 12px;
  background: #f6f7fa;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.m-visit:last-child { margin-bottom: 0; }
.m-visit--active { background: #e8f0fe; box-shadow: inset 0 0 0 1.5px #93c5fd; }
.m-visit-head { display: flex; align-items: baseline; gap: 10px; }
.m-visit-date { font-size: 14px; font-weight: 800; }
.m-visit-time { font-size: 13px; font-weight: 700; color: var(--m-accent); }
.m-visit-addr {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--m-text2);
  line-height: 1.45;
}
.m-visit-actions { display: flex; gap: 8px; }
.m-mini-btn {
  border: none;
  background: #fff;
  color: var(--m-accent);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  min-height: 30px;
  display: inline-flex;
  align-items: center;
}
.m-visit-contact { font-size: 13px; color: var(--m-text2); font-weight: 600; }

/* ---------- Documents ---------- */
.m-doc {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 0;
  border: none;
  border-bottom: 0.5px solid var(--m-border);
  background: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  color: var(--m-text);
}
.m-doc:active { opacity: 0.6; }
.m-doc:last-child { border-bottom: none; }
.m-doc-ico {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 800;
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 7px;
  padding: 5px 6px;
  min-width: 30px;
  text-align: center;
  line-height: 1.1;
}
.m-doc-ico--ncr { color: #9a3412; background: #ffedd5; }
.m-doc-ico--file { color: #1d4ed8; background: #e8f0fe; }
.m-doc-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-doc-date {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--m-text3);
  font-weight: 600;
}

/* ---------- Approbateurs ---------- */
.m-approver {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--m-border);
}
.m-approver:last-child { border-bottom: none; }
.m-approver-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #fca5a5;
}
.m-approver-dot--approved { background: #22c55e; }
.m-approver-dot--processing { background: #f59e0b; }
.m-approver-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.m-approver-state { font-size: 12px; color: var(--m-text3); font-weight: 700; }

/* ---------- Visualiseur de document (plein écran, dans l'app) ---------- */
.m-docviewer {
  position: absolute;
  inset: 0;
  z-index: 260;
  display: flex;
  flex-direction: column;
  background: #f2f2f7;
  animation: m-fade-in 0.18s ease;
}
.m-docviewer-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--m-safe-top) + 8px) 14px 10px;
  background: rgba(242, 242, 247, 0.95);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.12);
}
.m-docviewer-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-docviewer-frame {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: none;
  background: #fff;
  padding-bottom: var(--m-safe-bottom);
}

/* ---------- Toast ---------- */
.m-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--m-tabbar-h) + max(var(--m-safe-bottom), 8px) + 14px);
  transform: translateX(-50%);
  z-index: 300;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  max-width: calc(100vw - 40px);
  animation: m-fade-in 0.2s ease;
}

/* ---------- Fuseau horaire (profil) ---------- */
.m-tz { display: flex; flex-direction: column; gap: 8px; }
.m-tz-label { font-size: 13px; font-weight: 700; color: var(--m-text3); }
.m-tz-select {
  width: 100%;
  border: 0.5px solid var(--m-border);
  background: #f6f7fa;
  border-radius: 11px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--m-text);
  appearance: none;
  -webkit-appearance: none;
}
.m-tz-hint { font-size: 12px; color: var(--m-text3); line-height: 1.4; }

/* Push / widget glance */
.m-push { display: flex; flex-direction: column; gap: 10px; }
.m-push-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--m-text2);
}
.m-push-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}
.m-push-dot.is-on { background: #16a34a; }
.m-push-hint {
  font-size: 12px;
  color: var(--m-text3);
  line-height: 1.45;
}
.m-push-hint--warn { color: #b45309; }
.m-push-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.m-push-rows { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.m-push-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--m-border, rgba(0,0,0,.06));
}
.m-push-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-push-row-label { font-size: 14px; font-weight: 700; color: var(--m-text); }
.m-push-row-sub { font-size: 11px; color: var(--m-text3); line-height: 1.35; }
.m-push-toggle {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: #2563eb;
}
.m-btn--ghost {
  background: transparent;
  color: var(--m-text2);
  border: 1px solid var(--m-border, rgba(0,0,0,.12));
}
