/* ═══════════════════════════════════════════
   SERIANCE — Mobile CSS  (≤ 640px)
═══════════════════════════════════════════ */

@media (max-width: 640px) {

  /* ════════════════════════════════════════
     LAYOUT DE BASE
  ════════════════════════════════════════ */

  #dock { display: none !important; }
  #topbar-navstyle-btn { display: none !important; }
  /* Remplacé sur mobile par .mobile-top-bar (logo) + la ligne identité dans l'accueil mobile.
     Sélecteur renforcé (html + body.logged-in + id) pour battre la règle
     "body.logged-in #user-topbar{display:flex!important}" du <head> (même spécificité de
     classes/id, mais elle est déclarée après mobile.css dans le document). */
  html body.logged-in #user-topbar { display: none !important; }

  .main {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .section {
    padding: 0 !important;
  }

  /* Padding intérieur des sections */
  .section > * {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  /* Évite le double-padding sur les containers qui gèrent leur propre padding */
  .chantier-grid,
.card-grid,
.ndf-total-bar,
.grid-2,
#taches-toolbar,
#cal-layout {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Annule la règle générique pour les enfants de mobile-home */
  #section-mobile-home > * {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  /* Puis rétablit les paddings propres avec spécificité supérieure */
  #section-mobile-home .mobile-home-header {
    padding: 16px 14px 14px !important;
  }
  #section-mobile-home .mobile-home-grid {
    padding: 14px 0 !important;
  }

  /* ════════════════════════════════════════
     BARRE DU HAUT MOBILE (logo seul, remplace bandeau utilisateur + barre retour)
  ════════════════════════════════════════ */

  .mobile-top-bar {
    position: fixed; top: 0; left: 0; right: 0; height: 46px;
    background: var(--glass-a); backdrop-filter: var(--blur-sm); -webkit-backdrop-filter: var(--blur-sm);
    border-bottom: 1px solid var(--gb); z-index: 300;
    align-items: center; justify-content: center;
  }

  .mobile-top-bar-logo {
    display: flex; align-items: center; justify-content: center;
    height: 44px; padding: 0 18px;
    background: none; border: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-top-bar-logo:active { opacity: .6; }

  .mobile-logo-text { font-size: 1rem; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
  .mobile-logo-text .accent { color: var(--accent); }

  /* Réserve la hauteur de la barre fixe (masquée sur l'accueil, elle, n'en a pas besoin) */
  .section:not(#section-mobile-home) {
    padding-top: 46px !important;
  }

  /* Bandeau hors-ligne (#offline-banner, z-index 10001) recouvre sinon cette barre fixe (même
     principe que #user-topbar en desktop, layout.css) : logo caché et injoignable. Hauteur réelle
     posée en JS (--offline-banner-h) : le message passe souvent sur 2 lignes en français ici. */
  body.offline-active .mobile-top-bar { top: var(--offline-banner-h, 26px); }
  body.offline-active .section:not(#section-mobile-home) { padding-top: calc(46px + var(--offline-banner-h, 26px)) !important; }

  /* ════════════════════════════════════════
     ÉCRAN D'ACCUEIL MOBILE
  ════════════════════════════════════════ */

  #section-mobile-home {
    min-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  #section-mobile-home::-webkit-scrollbar { display: none; }

  .mobile-home-header {
    padding: 16px 14px 14px;
    border-radius: 12px;
    background: var(--accent);
  }
  @keyframes mhIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  /* Accueil mobile très visité (retour quasi systématique) : le mhIn ne joue qu'au tout
     premier affichage de la session (classe "boot-nav", voir layout.css/config_state.js),
     jamais à chaque retour à l'accueil. */
  body.boot-nav .mobile-home-header,
  body.boot-nav .mobile-tile {
    animation: mhIn .3s cubic-bezier(.22,1,.36,1) both;
  }
  @media (prefers-reduced-motion: reduce) {
    .mobile-home-header, .mobile-tile { animation: none !important; }
  }

  .mobile-home-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
  }

  .mobile-home-identity-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
  }

  .mobile-home-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: color-mix(in srgb, var(--on-accent) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--on-accent) 30%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .79rem;
    font-weight: 700;
    color: var(--on-accent);
    flex-shrink: 0;
  }
  .mobile-home-avatar svg, .mobile-home-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }

  .mobile-home-username {
    font-size: .85rem;
    font-weight: 700;
    color: var(--on-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-home-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--on-accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--on-accent) 22%, transparent);
    color: var(--on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background .12s;
  }

  .mobile-home-icon-btn:active {
    background: color-mix(in srgb, var(--on-accent) 24%, transparent);
  }

  .mobile-home-subtitle {
    font-size: .85rem;
    color: var(--on-accent);
    margin-top: 4px;
    font-weight: 500;
  }

  .mobile-home-subtitle.mobile-home-date {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--on-accent);
    margin-top: 0;
  }

  .mobile-home-stats {
    display: flex;
    gap: 8px;
    margin-top: 10px;
  }

  .mobile-home-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    background: color-mix(in srgb, var(--on-accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--on-accent) 22%, transparent);
    border-radius: 12px;
    padding: 5px 11px;
    font-size: .79rem;
    font-weight: 700;
    color: var(--on-accent);
    white-space: nowrap;
  }

  .mobile-home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px 0;
  }

  .mobile-tile {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--glass);
    border: 1px solid var(--gb);
    border-radius: 12px;
    cursor: pointer;
    transition: transform .1s, background .1s;
    min-height: 68px;
    min-width: 0;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }
  body.boot-nav .mobile-tile:nth-child(2) { animation-delay: .04s; }
  body.boot-nav .mobile-tile:nth-child(3) { animation-delay: .08s; }
  body.boot-nav .mobile-tile:nth-child(4) { animation-delay: .12s; }
  body.boot-nav .mobile-tile:nth-child(5) { animation-delay: .16s; }
  body.boot-nav .mobile-tile:nth-child(n+6) { animation-delay: .2s; }

  .mobile-tile:active {
    transform: scale(.96);
    background: var(--glass-h);
  }

  .mobile-tile-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
  }

  .mobile-tile-label {
    font-size: .85rem;
    font-weight: 600;
    text-align: left;
    color: var(--text);
    line-height: 1.25;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .mobile-tile-badge {
    position: absolute;
    top: 6px;
    right: 8px;
    background: var(--red);
    color: #fff;
    font-size: .79rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
  }

  /* ════════════════════════════════════════
     TYPOGRAPHIE & TITRES
  ════════════════════════════════════════ */

  .page-title {
    font-size: 1rem !important;
    margin-bottom: 10px !important;
  }

  .page-subtitle {
    font-size: .79rem;
  }

  /* ════════════════════════════════════════
     GRILLES
  ════════════════════════════════════════ */

  .chantier-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Vue grille : photo plus basse pour voir 2 chantiers par écran */
  .chantier-grid:not(.list-view) .chantier-photo { height: 104px; }

  /* Vue liste chantiers : adresse masquée sur la carte (ligne plus fine) -
     reste consultable/cliquable (Waze/Maps/copie) dans la fiche détail */
  .chantier-grid.list-view .chantier-adresse {
    display: none;
  }

  /* Toolbar Fiches chantier : 2 lignes compactes au lieu d'un empilement
     vertical (chaque contrôle avait une largeur fixe desktop) */
  .chantiers-toolbar-row {
    display: flex !important;
    flex: 1 1 100% !important;
    min-width: 0 !important;
    gap: 6px !important;
  }
  #ch-tb-search input#chantier-search {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
  }
  #ch-tb-filters select#chantier-sort {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
  }
  /* Ligne 1 : titre à gauche, bouton à droite ; cibles tactiles de 40 px ;
     bascule Conduc / Chiffrage pleine largeur ; pastilles de filtre avec fondu à droite (= ça défile) */
  #section-chantiers .chantiers-toolbar { gap: 8px !important; margin-bottom: 12px !important; }
  #section-chantiers .chantiers-toolbar > .page-title { flex: 1 1 0 !important; min-width: 0; margin-bottom: 0 !important; }
  #section-chantiers .chantiers-toolbar > .btn-primary { min-height: 40px; padding: 0 14px; }
  #ch-tb-search .btn,
  #ch-tb-search input#chantier-search,
  #ch-tb-filters select#chantier-sort { min-height: 40px; }
  #ch-tb-filters > div { flex-shrink: 0; }
  #ch-tb-filters > div .btn { min-width: 40px; min-height: 36px; justify-content: center; }
  .chantier-espace-switch { width: 100%; }
  .chantier-espace-btn { flex: 1; min-height: 40px; }
  .chantier-statut-chips {
    margin-right: -14px; padding-right: 28px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  }

  .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Les grid items ont un min-width:auto implicite → un tableau large à l'intérieur
     pousse toute la carte hors écran. On force min-width:0 pour laisser le scroll
     interne (#ndf-list, .tache-table-wrap...) faire son travail. */
  .grid-2 > * {
    min-width: 0 !important;
  }

  .card-grid {
    grid-template-columns: 1fr !important;
  }

  /* ════════════════════════════════════════
     FICHE CHANTIER (modal détail)
  ════════════════════════════════════════ */

  /* Onglets Notes/Tâches/Documents/... : scroll horizontal au lieu
     de s'empiler sur 3 lignes et manger tout l'écran */
  .ch-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x !important;
    overscroll-behavior-y: none;
  }
  .ch-tabs::-webkit-scrollbar { display: none; }
  .ch-tab {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* ════════════════════════════════════════
     SECTION TÂCHES
  ════════════════════════════════════════ */

  #taches-toolbar {
    padding-bottom: 4px !important;
    margin-bottom: 12px !important;
    gap: 5px !important;
  }

  /* Header row remplacé par la back bar sur mobile */
  #taches-header-row {
    display: none !important;
  }

  /* Vue liste : chaque ligne du tableau devient une carte repliée (titre, priorité,
     chantier, échéance, barre de progression) ; un tap la déplie (classe .open, taches.js) */
  #taches-list.tache-table-wrap { overflow: visible !important; max-width: 100%; }
  #taches-list .tache-table,
  #taches-list .tache-table tbody,
  #taches-list .tache-table td { display: block; width: 100% !important; min-width: 0 !important; }
  #taches-list .tache-table thead,
  #taches-list .tache-table colgroup { display: none; }
  #taches-list .tache-table td { border: 0; padding: 0; white-space: normal; max-width: none; background: transparent; }

  #taches-list .tache-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "titre prio" "ch date";
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 8px;
    padding: 12px 12px 14px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--text-muted);
    border-radius: 12px;
    background:
      linear-gradient(var(--pc, var(--accent)), var(--pc, var(--accent))) no-repeat left bottom / var(--p, 0%) 3px,
      var(--glass);
    cursor: pointer;
    animation: tacheCardIn .25s ease both;
  }
  #taches-list .tache-row.prio-urgente { border-left-color: var(--red); }
  #taches-list .tache-row.prio-haute   { border-left-color: var(--orange); }
  #taches-list .tache-row.prio-normale { border-left-color: var(--accent); }
  #taches-list .tache-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  @keyframes tacheCardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) { #taches-list .tache-row { animation: none; } }

  #taches-list .td-titre { grid-area: titre; font-weight: 600; }
  #taches-list .tache-table .td-prio { grid-area: prio; display: flex; align-items: center; gap: 6px; }
  #taches-list .td-prio::after {
    content: ""; width: 7px; height: 7px; margin: 0 2px 3px 2px;
    border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg); transition: transform .2s, margin .2s;
  }
  #taches-list .tache-row.open .td-prio::after { transform: rotate(-135deg); margin: 3px 2px 0 2px; }
  #taches-list .td-ch    { grid-area: ch; min-width: 0; }
  #taches-list .td-ch .tache-ch-badge { max-width: 100%; }
  #taches-list .td-date  { grid-area: date; justify-self: end; }
  #taches-list .td-notes { grid-area: notes; }
  #taches-list .td-created { grid-area: cr; }
  #taches-list .td-prog  { grid-area: prog; }
  #taches-list .td-actions { grid-area: act; }

  /* Détail : caché tant que la carte est repliée */
  #taches-list .tache-row:not(.open) .td-notes,
  #taches-list .tache-row:not(.open) .td-created,
  #taches-list .tache-row:not(.open) .td-prog,
  #taches-list .tache-row:not(.open) .td-actions { display: none; }

  #taches-list .tache-row.open {
    grid-template-areas: "titre prio" "ch date" "notes notes" "cr cr" "prog prog" "act act";
    background-color: var(--glass-a, var(--glass));
    border-top-color: var(--gb-hi, var(--border));
    border-right-color: var(--gb-hi, var(--border));
    border-bottom-color: var(--gb-hi, var(--border));
  }
  #taches-list .tache-row.open .td-titre-inner { display: block; -webkit-line-clamp: unset; overflow: visible; }
  #taches-list .tache-row.open .td-date::before { content: "Limite "; color: var(--text-muted); font-family: inherit; }
  #taches-list .tache-row.open .td-notes,
  #taches-list .tache-row.open .td-created,
  #taches-list .tache-row.open .td-prog { padding-top: 8px; border-top: 1px solid var(--border); }
  #taches-list .td-notes[data-l]::before,
  #taches-list .td-created[data-l]::before,
  #taches-list .td-prog[data-l]::before {
    content: attr(data-l); display: block; margin-bottom: 4px;
    font-size: .79rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted);
  }
  #taches-list .td-notes { font-size: .85rem; line-height: 1.5; }
  #taches-list .td-prog > div { min-width: 0 !important; }
  #taches-list .td-prog .tache-prog-slider { min-width: 0; min-height: 28px; }
  #taches-list .tache-table .tache-row.open .td-actions { display: flex; gap: 8px; padding-top: 4px; }
  #taches-list .td-actions .tache-act-btn { flex: 1; min-height: 40px; font-size: 1rem; }

  /* Membre filter inutile sur mobile */
  #taches-membre-filter {
    display: none !important;
  }

  /* Masquer les selects de tri/filtre secondaires sur mobile */
  #taches-toolbar #tache_sort,
  #taches-toolbar #tache_filter_chantier {
    display: none !important;
  }

  /* Données par moi = peu utilisé sur mobile */
  #btn-taches-donnees {
    display: none !important;
  }

  /* Post-it plus compact sur mobile */
  .postit {
    padding: 10px 8px 8px !important;
    font-size: .85rem !important;
    min-height: 90px !important;
  }

  /* ════════════════════════════════════════
     FOURNISSEURS / DOCUMENTS TECHNIQUES
  ════════════════════════════════════════ */

  /* Toolbar (titre + recherche + tri + bouton "+") en overflow-x:auto sans
     indice visuel — le bouton "+" sortait hors écran, invisible sur mobile.
     On la laisse passer à la ligne à la place. */
  #section-fournisseurs > div:first-child,
  #section-doctech > div:first-child {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
  }

  /* ════════════════════════════════════════
     SECTION CALENDRIER
  ════════════════════════════════════════ */

  #cal-layout {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* La colonne droite (invitations + ce mois) passe en bas */
  #cal-layout > div:last-child {
    order: 2;
  }

  #cal-layout > div:first-child {
    order: 1;
  }

  /* ════════════════════════════════════════
     SECTION NDF
  ════════════════════════════════════════ */

  #section-ndf .ndf-total-bar {
    margin-left: 0 !important;
    margin-right: 0 !important;
    gap: 8px !important;
  }

  #section-ndf .card:last-child .card-title ~ div {
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }

  /* Liste des trajets : scroll horizontal sur le conteneur (comme .tache-table-wrap),
     pas sur la table elle-même — évite que les boutons ✏️/⧉/✕ sortent de l'écran */
  #ndf-list {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  #ndf-list table {
    display: table !important;
    width: auto !important;
    min-width: 100%;
  }

  /* En-tête "Trajets enregistrés" : titre au-dessus, contrôles pleine largeur en dessous */
  #section-ndf .card:last-child > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  #section-ndf .card:last-child .card-title ~ div select {
    flex: 1 1 auto !important;
    min-width: 100px !important;
  }

  /* Bannière véhicule : empêcher le débordement sur petits écrans (ne pas toucher display, géré en JS) */
  #ndf-vehicle-banner {
    flex-wrap: wrap !important;
    row-gap: 4px !important;
  }

  /* ════════════════════════════════════════
     SECTION PLANNING
  ════════════════════════════════════════ */

  /* Cacher les contrôles Gantt non essentiels sur mobile */
  #gantt-zoom-controls {
    display: none !important;
  }

  /* Gantt wrapper : autoriser le scroll horizontal sur mobile */
  #planning-gantt-wrap {
    height: calc(100vh - 130px) !important;
    height: calc(100dvh - 130px) !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Le panneau gauche Gantt (DET/SST/CHANTIER/MNT/ACT, ~352px) est généré en JS avec largeurs
     fixes en pixel (planning.js, COL_DET etc.) et sticky à l'intérieur de #gantt-scroll-x —
     pas d'enfant CSS ciblable ici sans casser le rendu. On laisse le scroll horizontal natif
     de #gantt-scroll-x/#gantt-body gérer l'accès à la timeline, comme la vue Semaine. */

  /* ════════════════════════════════════════
     CARDS & FORMULAIRES
  ════════════════════════════════════════ */

  .card {
    border-radius: 14px !important;
    padding: 14px !important;
    margin-bottom: 10px !important;
  }

  .form-group label {
    font-size: .79rem !important;
  }

  /* iOS zoome sur tout champ < 16px : tous les types de saisie (time, url, tel, search,
     datetime-local, champ sans type...) y compris les champs générés par JS. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]):not([type="hidden"]):not([type="button"]):not([type="submit"]),
  textarea,
  select,
  [contenteditable="true"] {
    font-size: 16px !important; /* Évite le zoom automatique iOS sur les inputs */
    min-height: 42px !important;
    border-radius: 10px !important;
  }

  .btn {
    min-height: 40px !important;
    font-size: .85rem !important;
    border-radius: 10px !important;
  }

  .btn-sm {
    min-height: 34px !important;
    padding: 6px 12px !important;
    font-size: .79rem !important;
  }

  /* ════════════════════════════════════════
     MODALES — PLEIN ÉCRAN SUR MOBILE
  ════════════════════════════════════════ */

  .modal-overlay {
    padding-bottom: 0 !important;
    align-items: flex-end !important;
  }

  .modal-overlay.open .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Modal style sheet bottom sheet alternatif — commenter si on préfère plein écran */
  /* .modal-overlay.open .modal-sm {
    border-radius: 20px 20px 0 0 !important;
    height: auto !important;
    max-height: 90dvh !important;
  } */

  /* Article de stock : 3 lignes "2 champs côte à côte" (flex inline, pas .grid-2) - les select
     Site/Chantier affichent un nom long (ex "Entrepôt principal", nom de chantier) coupé net à
     mi-largeur. Empilées comme le reste des formulaires sous 640px. */
  #modal-stock-item > .modal > div[style*="display:flex;gap:8px"] {
    flex-direction: column !important;
    gap: 10px !important;
  }

  /* ════════════════════════════════════════
     PLANS — visionneuse : sidebar remplacée par un tiroir bas
  ════════════════════════════════════════ */
  .modal-plan-viewer { padding: 8px !important; gap: 6px !important; }
  .plans-sidebar { display: none !important; }
  .plans-mobile-list-btn { display: flex !important; align-items: center; gap: 6px; }
  .plans-mobile-drawer {
    display: block !important; position: absolute; inset: auto 0 0 0; max-height: 70vh; overflow-y: auto;
    background: var(--modal-bg); border-radius: 20px 20px 0 0; padding: 14px;
    transform: translateY(100%); transition: transform .25s ease; z-index: 3;
    box-shadow: 0 -4px 20px rgba(0,0,0,.3);
  }
  .plans-mobile-drawer.open { transform: translateY(0) !important; }

  /* ════════════════════════════════════════
     PLANS — annotation de mesures sur photo : même pattern (colonne remplacée par tiroir bas)
  ════════════════════════════════════════ */
  .plan-annot-side { display: none !important; }
  .plan-annot-mobile-btn { display: flex !important; align-items: center; gap: 6px; }
  .plan-annot-mobile-drawer {
    display: block !important; position: absolute; inset: auto 0 0 0; max-height: 60vh; overflow-y: auto;
    background: var(--modal-bg); border-radius: 20px 20px 0 0; padding: 14px;
    transform: translateY(100%); transition: transform .25s ease; z-index: 3;
    box-shadow: 0 -4px 20px rgba(0,0,0,.3);
  }
  .plan-annot-mobile-drawer.open { transform: translateY(0) !important; }

  /* ════════════════════════════════════════
     TABLES — SCROLL HORIZONTAL
  ════════════════════════════════════════ */

  table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100% !important;
  }

  /* ════════════════════════════════════════
     FAB BOUTON
  ════════════════════════════════════════ */

  #fab-tache {
    width: 52px !important;
    height: 52px !important;
    bottom: 16px !important;
    right: 16px !important;
    font-size: 1.4rem !important;
  }

  /* ════════════════════════════════════════
     NOTIFICATIONS & BADGES
  ════════════════════════════════════════ */

  #notif-panel {
    width: 100vw !important;
    max-width: none !important;
    right: 0 !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    transform: none !important;
    border-radius: 0 !important;
    max-height: none !important;
  }
  #notif-panel.open { animation-name: notifPanelInM; }
  @keyframes notifPanelInM { from { opacity: 0; } to { opacity: 1; } }
  .notif-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .notif-scroll { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .notif-btn { min-height: 36px; }
  .notif-row { min-height: 44px; }

  /* ════════════════════════════════════════
     TOPBAR
  ════════════════════════════════════════ */

  #topbar {
    padding: 0 10px !important;
  }

  /* ════════════════════════════════════════
     VISIONNEUSES PLEIN ÉCRAN (plan, repérage)
     Un flou plein écran derrière un contenu redessiné à chaque geste (zoom, déplacement) fait
     saccader puis planter le navigateur du téléphone ; le fond (92 % opaque) est quasi identique sans.
  ════════════════════════════════════════ */

  #modal-plan-viewer.modal-overlay,
  #modal-rep-editor.modal-overlay,
  #modal-doe-page-editor.modal-overlay,
  #modal-plan-viewer .modal,
  #modal-rep-editor .modal,
  #modal-doe-page-editor .modal,
  .rep-ed-panel,
  .rep-ed-dialog {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ════════════════════════════════════════
   CACHER MOBILE-HOME SUR DESKTOP
════════════════════════════════════════ */

@media (min-width: 641px) {
  #section-mobile-home { display: none !important; }
  .mobile-top-bar       { display: none !important; }
}

/* Zones tactiles : 36 px minimum sur téléphone (WCAG 2.5.8 / confort au doigt, gants de chantier) */
@media (max-width: 640px) {
  .chantier-chip, .chantier-espace-btn, .stock-site-tab { min-height: 36px; }
  .tache-act-btn { min-width: 36px; min-height: 36px; }
  .tache-prog-slider { min-height: 28px; }

  /* Boutons ‹ › et petites commandes (styles en ligne d'origine : sélecteurs par attribut) */
  #section-calendrier button[onclick^="calNav"] { width: 40px !important; height: 40px !important; }
  #section-planning button[onclick^="_heuresPanel"],
  #section-planning button[onclick="_toggleHeuresPanel()"] { width: 38px !important; height: 38px !important; }
  #doctech-view-list, #doctech-view-grid { min-width: 40px; min-height: 36px; }
  .dt-crumb { display: inline-flex; align-items: center; min-height: 32px; }

  /* Filet de sécurité : un contenu de 2 px de trop (Administration) ne fait plus glisser la page de côté */
  body { overflow-x: clip; }

  /* Administration : cases de droits par poste (étiquette entière = zone tactile) */
  #section-admin label:has(> input[type="checkbox"][data-poste]) { min-height: 36px; }
  #section-admin input[type="checkbox"][data-poste] { width: 18px !important; height: 18px !important; flex-shrink: 0; }
}
