
/* COBAT V2.3.28 — Registre personnel mobile
   Couche téléphone uniquement. Aucun impact PC/tablette. */
@media (max-width:767px){
  html[data-cobat-module="registre"],
  html[data-cobat-module="registre"] body{
    background:#f5f8fb!important;
    color:#17324d!important;
  }

  html[data-cobat-module="registre"] body.cobat-v230-phone{
    padding-bottom:calc(74px + env(safe-area-inset-bottom))!important;
  }

  /* La version PC reste dans le DOM et garde tout le moteur métier,
     mais elle est masquée uniquement lorsque l'accueil/liste mobile est affiché. */
  html[data-cobat-module="registre"] body.cobat-registre-mobile-dashboard > #app{
    display:none!important;
  }

  #cobatRegistreMobileV2327{
    display:block;
    min-height:100dvh;
    background:#f5f8fb;
    padding-bottom:20px;
    font-family:Arial,Helvetica,sans-serif;
  }

  .crm25-topbar{
    position:sticky;
    top:0;
    z-index:160;
    height:68px;
    padding:8px 12px;
    display:grid;
    grid-template-columns:minmax(98px,125px) minmax(0,1fr) auto;
    align-items:center;
    gap:8px;
    background:rgba(255,255,255,.97);
    border-bottom:1px solid #dce5ee;
    backdrop-filter:blur(12px);
  }
  .crm25-logo{
    display:flex;
    align-items:center;
    min-width:0;
  }
  .crm25-logo img{
    display:block;
    width:100%;
    max-width:120px;
    max-height:44px;
    object-fit:contain;
    object-position:left center;
  }
  .crm25-project{
    min-width:0;
    height:44px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    padding:0 10px;
    border:1px solid #cbd9e7;
    border-radius:12px;
    background:#fff;
    color:#173a5b;
    font:900 12px Arial;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .crm25-project svg{width:18px;height:18px;color:#0d4ca3;flex:0 0 auto}
  .crm25-head-actions{display:flex;gap:3px}
  .crm25-icon-btn{
    width:42px;height:42px;min-width:42px!important;min-height:42px!important;
    display:grid;place-items:center;border:0;border-radius:11px;background:transparent;color:#0d4ca3;
    position:relative;padding:0!important;
  }
  .crm25-icon-btn svg{width:23px;height:23px}
  .crm25-notif-badge{
    position:absolute;right:2px;top:2px;min-width:16px;height:16px;padding:0 4px;border-radius:10px;
    display:none;align-items:center;justify-content:center;background:#a71930;color:#fff;font:900 9px Arial;
    border:2px solid #fff;
  }
  .crm25-notif-badge.has{display:flex}

  .crm25-main{padding:14px 12px 8px}
  .crm25-title-row{display:flex;align-items:center;gap:10px;margin:2px 2px 12px}
  .crm25-title-icon{
    width:44px;height:44px;border-radius:14px;display:grid;place-items:center;
    background:#edf4fb;color:#0d4ca3;border:1px solid #dce8f4;
  }
  .crm25-title-icon svg{width:25px;height:25px}
  .crm25-title{margin:0;color:#12365a;font:950 23px/1.05 Arial}
  .crm25-sub{margin:4px 0 0;color:#6d8194;font:750 10px/1.25 Arial}

  .crm25-arrival{
    width:100%;
    min-height:58px!important;
    display:flex;align-items:center;justify-content:center;gap:10px;
    border:1px solid #8c1326;border-radius:14px;background:#fff;color:#8c1326;
    font:900 14px Arial;
    box-shadow:0 3px 12px rgba(23,54,83,.05);
    margin:0 0 12px;
  }
  .crm25-arrival svg{width:24px;height:24px}
  .crm25-arrival:active{background:#fff6f7}

  .crm25-kpis{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:12px;
  }
  .crm25-kpi{
    min-height:89px;border:1px solid #dce5ee;border-radius:14px;background:#fff;
    padding:11px;display:grid;grid-template-columns:40px 1fr;gap:8px;align-items:center;
    box-shadow:0 2px 8px rgba(27,57,84,.035);
  }
  .crm25-kpi-icon{
    width:40px;height:40px;border-radius:12px;display:grid;place-items:center;
    color:#0d4ca3;background:#eef5fc;
  }
  .crm25-kpi-icon svg{width:22px;height:22px}
  .crm25-kpi.alert .crm25-kpi-icon{color:#a71930;background:#fff1f3}
  .crm25-kpi strong{display:block;color:#12365a;font:950 24px/1 Arial}
  .crm25-kpi.alert strong{color:#a71930}
  .crm25-kpi span{display:block;margin-top:5px;color:#62798e;font:800 9px/1.25 Arial}

  .crm25-toolbar{display:grid;grid-template-columns:minmax(0,1fr) 46px;gap:8px;margin:4px 0 10px}
  .crm25-search{
    height:46px;display:flex;align-items:center;gap:8px;padding:0 12px;
    border:1px solid #d8e3ed;border-radius:13px;background:#fff;
  }
  .crm25-search svg{width:19px;height:19px;color:#698097;flex:0 0 auto}
  .crm25-search input{
    width:100%;border:0!important;outline:0!important;background:transparent!important;padding:0!important;
    font:750 11px Arial;color:#173a5b;
  }
  .crm25-filter{
    height:46px;min-height:46px!important;border:1px solid #d8e3ed;border-radius:13px;background:#fff;color:#0d4ca3;
    display:grid;place-items:center;padding:0!important;
  }
  .crm25-filter svg{width:20px;height:20px}

  .crm25-tabs{
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
    border:1px solid #d8e3ed;border-radius:13px;overflow:hidden;background:#fff;margin-bottom:10px;
  }
  .crm25-tab{
    min-width:0;min-height:43px!important;border:0;border-right:1px solid #e2e9ef;background:#fff;
    padding:4px 3px!important;color:#34516b;font:850 9px Arial;white-space:nowrap;
  }
  .crm25-tab:last-child{border-right:0}
  .crm25-tab.active{background:#0d4ca3;color:#fff}
  .crm25-tab em{
    display:inline-flex;min-width:17px;height:17px;align-items:center;justify-content:center;
    padding:0 4px;border-radius:9px;background:#eef3f8;color:#5c7083;font-style:normal;font-size:8px;margin-left:2px;
  }
  .crm25-tab.active em{background:rgba(255,255,255,.2);color:#fff}
  .crm25-tab.alert em{background:#fff0f2;color:#a71930}

  .crm25-section-head{
    display:flex;align-items:center;justify-content:space-between;gap:8px;margin:10px 2px 7px;
    color:#6b7e91;font:800 9px Arial;
  }
  .crm25-section-head strong{font:900 12px Arial;color:#173a5b}
  .crm25-sort{border:0;background:transparent;color:#60778d;font:800 9px Arial;padding:4px}

  .crm25-list{display:grid;gap:8px}
  .crm25-person{
    width:100%;min-height:92px;border:1px solid #dce5ee;border-radius:14px;background:#fff;
    display:grid;grid-template-columns:48px minmax(0,1fr) 18px;gap:9px;align-items:center;
    padding:10px!important;text-align:left;box-shadow:0 2px 8px rgba(24,57,86,.03);
  }
  .crm25-avatar{
    width:48px;height:48px;border-radius:50%;display:grid;place-items:center;
    background:#edf4fc;color:#0d4ca3;font:950 18px Arial;
  }
  .crm25-person-name{color:#12365a;font:950 13px/1.15 Arial}
  .crm25-person-company{margin-top:4px;color:#0d4ca3;font:850 9px Arial;text-transform:uppercase}
  .crm25-person-role{margin-top:3px;color:#6e8295;font:750 9px Arial}
  .crm25-badges{display:flex;flex-wrap:wrap;gap:5px;margin-top:7px}
  .crm25-badge{
    display:inline-flex;align-items:center;gap:4px;min-height:23px;padding:0 7px;border-radius:8px;
    border:1px solid #d9e6f2;background:#f4f8fc;color:#0d4ca3;font:850 8px Arial;
  }
  .crm25-badge svg{width:13px;height:13px}
  .crm25-badge.good{color:#27825e;background:#eff8f4;border-color:#cfe9dd}
  .crm25-badge.warn{color:#a71930;background:#fff3f4;border-color:#efc8ce}
  .crm25-arrow{color:#0d4ca3}.crm25-arrow svg{width:18px;height:18px}

  .crm25-empty{
    padding:26px 14px;border:1px dashed #cdd9e4;border-radius:14px;background:#fff;
    color:#73879a;text-align:center;font:800 10px/1.4 Arial;
  }

  .crm25-sync-line{
    display:flex;align-items:center;justify-content:center;gap:6px;margin:14px 0 4px;
    color:#8191a0;font:750 8px Arial;
  }
  .crm25-sync-line svg{width:14px;height:14px}

  .crm25-filter-sheet{
    position:fixed;left:0;right:0;bottom:-100%;z-index:510;background:#fff;border-radius:20px 20px 0 0;
    padding:10px 14px calc(18px + env(safe-area-inset-bottom));box-shadow:0 -16px 45px rgba(18,46,70,.18);
    transition:bottom .2s ease;
  }
  .crm25-filter-sheet.open{bottom:0}
  .crm25-filter-backdrop{
    position:fixed;inset:0;z-index:500;background:rgba(14,34,52,.32);opacity:0;pointer-events:none;transition:opacity .2s;
  }
  .crm25-filter-backdrop.open{opacity:1;pointer-events:auto}
  .crm25-handle{width:48px;height:5px;border-radius:4px;background:#c9d2da;margin:2px auto 13px}
  .crm25-filter-sheet h3{margin:0 0 12px;color:#173a5b;font:950 17px Arial}
  .crm25-filter-field{margin:10px 0}
  .crm25-filter-field label{display:block;margin-bottom:5px;color:#60778d;font:850 9px Arial}
  .crm25-filter-field select{
    width:100%;height:46px;border:1px solid #d8e3ed;border-radius:12px;background:#fff;color:#173a5b;padding:0 10px;font:800 11px Arial;
  }
  .crm25-filter-actions{display:grid;grid-template-columns:1fr 1.3fr;gap:8px;margin-top:14px}
  .crm25-filter-actions button{height:46px!important;border-radius:12px;font:900 10px Arial}
  .crm25-reset{border:1px solid #d8e3ed;background:#fff;color:#5d7387}
  .crm25-apply{border:0;background:#0d4ca3;color:#fff}

  /* Bottom nav Registre : même logique que Gestion de plans, avec Registre visible. */
  html[data-cobat-module="registre"] #cobatMobileBottomNav{
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
  }

  /* Fiche / nouvel arrivant : quand la couche dashboard se retire,
     on remet le moteur PC existant avec une présentation téléphone lisible. */
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view #app{
    display:block!important;
  }
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view .sidebar{display:none!important}
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view .shell{display:block!important}
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view .workspace{
    padding:10px!important;
    width:100%!important;
    margin:0!important;
    overflow:visible!important;
  }
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view .topbar{
    margin:0 0 8px!important;padding:8px!important;border-radius:12px!important;background:#fff!important;
  }
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view .topbar h1{font-size:17px!important}
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view .topActions{display:none!important}
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view :is(.formGrid,.identityGrid,.docGrid,.accueilGrid,.quizGrid){
    grid-template-columns:1fr!important;
  }
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view :is(.panel,.card,.formCard,.formSection,.stepCard){
    border-radius:14px!important;
  }
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view input,
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view select,
  html[data-cobat-module="registre"] body.cobat-registre-mobile-pc-view textarea{
    font-size:16px!important;
  }

  @media (max-width:390px){
    .crm25-topbar{grid-template-columns:100px minmax(0,1fr) auto;padding-left:8px;padding-right:8px}
    .crm25-logo img{max-width:98px}
    .crm25-title{font-size:21px}
    .crm25-kpi{padding:9px}
    .crm25-kpi strong{font-size:22px}
  }
}


/* COBAT V2.3.26 — isolation stricte du DOM PC sur l'accueil/liste mobile */
@media (max-width:767px){
  html[data-cobat-module="registre"] body.cobat-registre-mobile-dashboard #app{
    display:none!important;
    visibility:hidden!important;
    height:0!important;
    min-height:0!important;
    max-height:0!important;
    overflow:hidden!important;
    margin:0!important;
    padding:0!important;
    pointer-events:none!important;
  }

  html[data-cobat-module="registre"] body.cobat-registre-mobile-dashboard #cobatRegistreMobileV2327{
    display:block!important;
    visibility:visible!important;
    position:relative!important;
    z-index:2;
    min-height:calc(100dvh - 74px);
  }
}


/* ============================================================
   COBAT V2.3.27 — ISOLATION DÉFINITIVE PC / MOBILE DU REGISTRE
   Sur téléphone, #app (moteur PC) est caché par défaut.
   Il ne peut redevenir visible que dans une vue explicitement
   déclarée .cobat-registre-mobile-pc-view (fiche / formulaire).
   ============================================================ */
@media (max-width:767px){
  body.module-registre > #app{
    display:none!important;
    visibility:hidden!important;
    position:absolute!important;
    left:-200vw!important;
    top:0!important;
    width:1px!important;
    height:1px!important;
    min-width:0!important;
    min-height:0!important;
    max-width:1px!important;
    max-height:1px!important;
    overflow:hidden!important;
    margin:0!important;
    padding:0!important;
    opacity:0!important;
    pointer-events:none!important;
  }

  body.module-registre.cobat-registre-mobile-pc-view > #app{
    display:block!important;
    visibility:visible!important;
    position:relative!important;
    left:auto!important;
    top:auto!important;
    width:auto!important;
    height:auto!important;
    min-width:0!important;
    min-height:0!important;
    max-width:none!important;
    max-height:none!important;
    overflow:visible!important;
    margin:0!important;
    padding:0!important;
    opacity:1!important;
    pointer-events:auto!important;
  }

  body.module-registre.cobat-registre-mobile-dashboard > #cobatRegistreMobileV2327{
    display:block!important;
    visibility:visible!important;
    position:relative!important;
    z-index:2!important;
  }
}


/* COBAT V2.3.28 — cohérence visuelle onglet Alertes sélectionné */
@media (max-width:767px){
  .crm25-tab.alert.active{
    background:#0d4ca3!important;
    color:#fff!important;
  }
  .crm25-tab.alert.active em{
    background:rgba(255,255,255,.20)!important;
    color:#fff!important;
  }
}
