/* DSA CRM v11.32 — Finition Apple et adaptation à tous les appareils. */

/* ══════════════════════════════════════════════════════════════════════════
   1. BADGES RÉSERVÉ / LIVRÉ
   ══════════════════════════════════════════════════════════════════════════ */
.badge.v1132-reserve,.badge.v1132-livre{
  border-radius:980px;font-weight:600;letter-spacing:.01em;
  border:1px solid transparent;white-space:nowrap
}
.badge.v1132-reserve{background:#fff4e5;color:#9a5b00;border-color:#ffdcae}
.badge.v1132-livre{background:#e7f6ec;color:#136c33;border-color:#b8e3c6}

/* ══════════════════════════════════════════════════════════════════════════
   2. FINITION APPLE
   Police système d'Apple quand elle existe, repli sur Inter ailleurs.
   Rayons, ombres et transitions homogènes, sans réécrire les couleurs.
   ══════════════════════════════════════════════════════════════════════════ */
:root{
  --v1132-r-sm:9px; --v1132-r-md:13px; --v1132-r-lg:17px;
  --v1132-ease:cubic-bezier(.22,.61,.36,1);
  --v1132-sh-1:0 .5px 1px rgba(0,0,0,.05),0 1px 3px rgba(0,0,0,.05);
  --v1132-sh-2:0 2px 6px rgba(0,0,0,.06),0 10px 28px rgba(0,0,0,.09);
}
body,button,input,select,textarea{
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display",
              "Inter","Montserrat",system-ui,"Segoe UI",Roboto,sans-serif;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;
}
h1,h2,h3,h4{ letter-spacing:-.021em; }

/* Boutons : rayon constant, appui perceptible, cible tactile suffisante. */
.btn,button:not(.v1127-x):not(.mandat-tab){
  border-radius:var(--v1132-r-sm)!important;
  transition:background .18s var(--v1132-ease),
             transform .12s var(--v1132-ease),
             box-shadow .18s var(--v1132-ease)!important;
}
.btn:active,button:not(.v1127-x):active{ transform:scale(.975)!important; }
.btn:focus-visible,button:focus-visible,a:focus-visible{
  outline:none!important;
  box-shadow:0 0 0 3.5px rgba(139,26,47,.24)!important;
}

/* Champs : rayon et anneau de mise au point homogènes. */
input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea{
  border-radius:var(--v1132-r-sm)!important;
  transition:border-color .16s var(--v1132-ease),box-shadow .16s var(--v1132-ease)!important;
}
input:focus,select:focus,textarea:focus{
  outline:none!important;
  box-shadow:0 0 0 3.5px rgba(139,26,47,.13)!important;
}

/* Cartes et panneaux : bord ténu, ombre douce, coins généreux. */
.card,.panel,.box,.kpi,.tile,.mandat-section{
  border-radius:var(--v1132-r-lg)!important;
  box-shadow:var(--v1132-sh-1)!important;
}

/* Fenêtres modales : ressort discret à l'ouverture. */
.mo,.modal,.mo-box,.modal-box{ border-radius:var(--v1132-r-lg)!important; }
.mo-box,.modal-box{ animation:v1132In .26s var(--v1132-ease) both; }
@keyframes v1132In{ from{opacity:0;transform:translateY(10px) scale(.985)} to{opacity:1;transform:none} }

/* Onglets de la fiche mandat : pastille glissante façon iOS. */
.mandat-tab{
  border-radius:980px!important;
  transition:background .18s var(--v1132-ease),color .18s var(--v1132-ease)!important;
}

/* Défilement fluide et sans à-coups sur iOS. */
*{ -webkit-tap-highlight-color:transparent; }
.doc-grid,.v9-gcal-scroll,.tbl-wrap,.table-wrap{ -webkit-overflow-scrolling:touch; }

/* Respect du réglage « réduire les animations » du système. */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.01ms!important;animation-iteration-count:1!important;
    transition-duration:.01ms!important;scroll-behavior:auto!important
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   3. TÉLÉPHONE ET TABLETTE
   ══════════════════════════════════════════════════════════════════════════ */

/* Encoche et barre de gestes des iPhone récents. */
body{
  padding-left:env(safe-area-inset-left);
  padding-right:env(safe-area-inset-right);
}
.sb,.sidebar,nav.sb{ padding-bottom:env(safe-area-inset-bottom); }

/* Tablette — jusqu'à 1024 px */
@media (max-width:1024px){
  .doc-grid{ grid-template-columns:repeat(auto-fill,minmax(180px,1fr))!important; }
  .v1130-stages{ gap:12px; }
  .mandat-tabs{ overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
  .mandat-tabs::-webkit-scrollbar{ display:none; }
  .mandat-tab{ flex:0 0 auto; }
}

/* Téléphone — jusqu'à 768 px */
@media (max-width:768px){
  /* Cibles tactiles : 44 px, recommandation Apple. */
  .btn,button:not(.v1127-x),.mandat-tab,select,
  input:not([type=checkbox]):not([type=radio]):not([type=range]){
    min-height:44px!important;
  }
  .v1130-items li .tick{ width:22px!important;height:22px!important;font-size:12px!important; }

  /* Les tableaux défilent horizontalement au lieu d'être écrasés. */
  table{ display:block; overflow-x:auto; white-space:nowrap; -webkit-overflow-scrolling:touch; }
  table th,table td{ white-space:nowrap; }

  /* Modales pleine largeur, ancrées en bas comme une feuille iOS. */
  .mo-box,.modal-box{
    border-radius:var(--v1132-r-lg) var(--v1132-r-lg) 0 0!important;
    max-height:92vh!important;width:100%!important;max-width:100%!important;
    margin:0!important;position:fixed!important;left:0!important;bottom:0!important;top:auto!important;
    padding-bottom:calc(14px + env(safe-area-inset-bottom))!important;
    animation:v1132Sheet .3s var(--v1132-ease) both;
  }
  @keyframes v1132Sheet{ from{transform:translateY(100%)} to{transform:none} }

  /* Les grilles à colonnes fixes repassent en une colonne. */
  .v1130-form,.v1127-grid,.grid-2,.grid-3,.row-2,.row-3{ grid-template-columns:1fr!important; }
  .v1130-stages{ flex-direction:column!important; }

  /* Le planning reste lisible sans écraser les heures. */
  #v-calendar .v9-gcal-scroll{ height:calc(100vh - 300px)!important;min-height:320px!important; }
  #v-calendar .v9-calendar-header h2{ font-size:15px!important; }

  /* Empêche le zoom automatique d'iOS à la mise au point d'un champ :
     Safari zoome dès qu'une police descend sous 16 px. */
  input,select,textarea{ font-size:16px!important; }
}

/* Petit téléphone — jusqu'à 430 px */
@media (max-width:430px){
  .doc-grid{ grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important; }
  .doc-card-preview{ height:130px!important; }
  .v1130-folder-head b{ font-size:12.5px; }
  .badge{ font-size:11px!important;padding:4px 9px!important; }
  h1{ font-size:20px!important; }
  h2{ font-size:17px!important; }
}

/* Mode sombre du système : on neutralise l'inversion automatique de Safari,
   l'application ayant sa propre palette claire. */
@media (prefers-color-scheme:dark){
  :root{ color-scheme:light; }
}
