/* Habillage « Apple » des pages historiques dans le cadre /v2 (chargé en dernier, actif avec body.embed).
   Mêmes jetons que v2/apple.css. */
body.embed{
  --bg:#F4F3EC; --card:#FCFBF7; --border:#E2E1D4; --text:#23281F; --sub:#6B7263; --chip:#EDECE2;
  --accent:#5A7F3F; --accent-text:#FFFFFF; --primary:#5A7F3F; --primary-hover:#4A6B32; --danger:#C4382A;
  --radius:16px; --radius-sm:10px; --line-strong:#CDCBBA; --accent-soft:#E4EDD8;
  --ok:#3E7D3A; --ok-soft:#E5F0DA; --warn:#A8650E; --warn-soft:#FBF0DA; --danger-soft:#FAE7E2;
  --shadow:0 1px 2px rgba(0,0,0,.04),0 4px 16px rgba(0,0,0,.06); --sel:rgba(0,0,0,.05);
  font:400 15px/1.5 -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter","Segoe UI",Roboto,"Helvetica Neue",sans-serif;
  letter-spacing:-.003em;
}
@media (prefers-color-scheme: dark){
  body.embed{
    --bg:#10140E; --card:#181D15; --border:#272E22; --text:#EEF0E6; --sub:#9AA392; --chip:#232A1E;
    --accent:#A4C97F; --accent-text:#10140E; --primary:#A4C97F; --primary-hover:#B9DB97; --danger:#FF6B5E;
    --line-strong:#353F2E; --accent-soft:#243320; --ok:#7FD27A; --ok-soft:#1B2D17; --warn:#F0B050; --warn-soft:#2E2410; --danger-soft:#3A1A16;
    --shadow:0 1px 2px rgba(0,0,0,.5),0 4px 16px rgba(0,0,0,.4); --sel:rgba(255,255,255,.07);
  }
}
body.embed h1,body.embed h2,body.embed h3,body.embed h4{letter-spacing:-.018em}
body.embed .pg-title{font-weight:700;letter-spacing:-.022em}

/* cartes : blanches, sans contour */
body.embed .card{border:0;box-shadow:var(--shadow)}
body.embed .table-card{border:0;box-shadow:var(--shadow)}

/* boutons : pilules */
body.embed .btn{border:0;border-radius:980px;background:var(--chip);padding:0 18px}
body.embed .btn:hover{background:var(--border)}
body.embed .btn.primary{background:var(--accent);color:var(--accent-text)}
body.embed .btn.primary:hover{background:var(--primary-hover)}
body.embed .btn.ghost{background:transparent;border:0;color:var(--accent)}
body.embed .btn.ghost:hover{background:var(--accent-soft)}
body.embed .btn.danger{background:var(--danger-soft);border:0;color:var(--danger)}
body.embed .icon-btn{border:0;border-radius:8px;background:transparent;color:var(--sub);filter:grayscale(1);transition:background .15s}
body.embed .icon-btn:hover{background:var(--sel);color:var(--text);border:0}
body.embed #prix-table .icon-btn:hover{border:0}

/* champs */
body.embed .input,body.embed select,body.embed .textarea,body.embed input[type=text],body.embed input[type=number],body.embed input[type=search],body.embed input[type=file]{
  border:1px solid var(--line-strong);border-radius:10px;background:var(--card)}
body.embed .input:focus,body.embed select:focus,body.embed .textarea:focus,body.embed input:focus{border-color:var(--accent);box-shadow:0 0 0 4px rgba(90,127,63,.22);outline:none}

/* tableaux : en-têtes sobres, séparateurs fins */
body.embed .table th{background:var(--card);color:var(--sub);font-size:12px;font-weight:600;letter-spacing:0;text-transform:none;border-bottom:1px solid var(--border)}
body.embed .table td{border-bottom:1px solid var(--border)}
body.embed .table tr:hover td{background:var(--sel)}
body.embed .pv2-base-row td{background:var(--chip)}

/* pastilles, puces */
body.embed .badge,body.embed .racine-chip{border-radius:980px}
body.embed .cart-item{border-radius:10px}

/* grille produits */
body.embed .product-card{border:0;box-shadow:var(--shadow);border-radius:16px}
body.embed .product-card:hover{border:0;box-shadow:0 2px 4px rgba(0,0,0,.05),0 10px 28px rgba(0,0,0,.09)}
body.embed .raccourci-card{border:0;box-shadow:var(--shadow)}
body.embed .raccourci-card:hover{border:0;box-shadow:0 2px 4px rgba(0,0,0,.05),0 10px 28px rgba(0,0,0,.09)}

/* fenêtres, toast */
body.embed .modal-backdrop{background:rgba(0,0,0,.32);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
body.embed .modal{border-radius:18px;box-shadow:0 24px 60px rgba(0,0,0,.25)}
body.embed .toast{border-radius:12px;background:rgba(29,29,31,.92);color:#fff;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}

/* numéros d'étape */
body.embed h3 .n{font-family:inherit}

/* Prix : lignes complémentaires */
body.embed #prix-table tr.prix-comp-row td{background:var(--chip)}

/* Travail à plusieurs : bandeau « un collègue a cette fiche ouverte » */
.cm-coedit[hidden]{display:none!important}
.cm-coedit{display:flex;align-items:center;gap:8px;margin:0 0 12px;padding:9px 12px;border-radius:12px;background:var(--warn-soft,#FFF3E3);color:var(--warn,#B25000);font-size:13px;line-height:1.4}
.cm-coedit .cm-av{margin-right:-4px;box-shadow:0 0 0 2px var(--warn-soft,#FFF3E3)}
.cm-coedit span:last-child{margin-left:6px}
.cm-box{border-top:1px solid var(--border);margin-top:16px}

/* Petites fenêtres : le choix du devis Excel prend la largeur au lieu de déborder à gauche */
@media (max-width:700px){
  body.embed .topbar{padding:8px 12px 4px;flex-wrap:wrap}
  body.embed .target-picker{flex:1;min-width:0}
  body.embed .target-picker select{min-width:0;flex:1;width:auto}
}

/* Fiche produit : boutons IA ; petit signe quand on clique à côté (la fiche ne se ferme plus) */
.pv2-photo-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:6px 0 0}
.pv2-ia{display:flex;flex-wrap:wrap;gap:6px;margin:-4px 0 10px}
.modal.nudge{animation:pv2nudge .32s ease}
@keyframes pv2nudge{20%{transform:translateX(-6px)}40%{transform:translateX(6px)}60%{transform:translateX(-4px)}80%{transform:translateX(3px)}}
@media (prefers-reduced-motion:reduce){.modal.nudge{animation:none}}

/* Fiche produit : quantité automatique */
.regle-list{display:flex;flex-direction:column;gap:6px}
.regle-row{display:grid;grid-template-columns:minmax(0,1fr) auto 72px 32px;gap:8px;align-items:center}
.regle-opts{display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center;margin-top:8px}
body.embed #produit-v2-form .regle-opts label,#produit-v2-modal .regle-opts label{display:flex;flex-direction:row;align-items:center;gap:6px;margin:0;font-size:13px}
body.embed #produit-v2-form .regle-opts select,#produit-v2-modal .regle-opts select{width:auto;min-width:0}
#produit-v2-modal .regle-chk input{width:auto;margin:0}
.regle-ok{color:var(--ok);margin:8px 0 0}.regle-warn{color:var(--warn);margin:8px 0 0}
@media (max-width:560px){.regle-row{grid-template-columns:minmax(0,1fr) 56px 32px}.regle-row>.muted{display:none}}

/* Prix d'achat en formule (=2*15) mal tapée */
.input.input-error,input.input-error{border-color:var(--danger)!important;box-shadow:0 0 0 3px var(--danger-soft,#FFEBED)!important}

/* Mode démo : plus de bouton pour l'activer (le bandeau « Quitter la démo » reste) */
#btn-demo,#btn-demo-account{display:none!important}

/* ===== Popups plus larges : tout l'écran utile, 3 paliers (les petites confirmations restent compactes) ===== */
.modal{width:min(900px,calc(100vw - 32px))!important;max-width:none!important;max-height:calc(100vh - 32px)!important;max-height:calc(100dvh - 32px)!important}
.modal.modal-lg,.modal.wide,.modal:has(.newslist),body.embed #produit-v2-modal .modal,body.embed #pack-modal .modal,body.embed #prestation-v2-modal .modal,body.embed #pcm-edit-modal .modal,body.embed #prix-evolution-modal .modal,body.embed #marques-evolution-modal .modal,body.embed #prix-sites-modal .modal,body.embed #users-modal .modal,body.embed #sg-links-modal .modal{width:min(1240px,calc(100vw - 32px))!important}
body.embed #notice-modal .modal,body.embed #raccourci-modal .modal,body.embed #bulk-edit-modal .modal,body.embed #prest-assign-modal .modal,body.embed #account-modal .modal,body.embed #cart-item-modal .modal{width:min(760px,calc(100vw - 32px))!important}
.modal.wait{width:min(420px,100%)!important}
