/* ============================================================================
   HI-VIDY — FORMULAIRE « NOUVELLE RÉFÉRENCE FOURNISSEUR » (SendWhich)
   Page pleine largeur hébergée dans la coquille de l'application, à la place du
   Catalogue. Aucune donnée n'est inventée : chaque valeur affichée provient soit
   des données réelles, soit d'une saisie de l'utilisateur.
   ============================================================================ */

.sw-page{
  --sw-line:#e2e7e0; --sw-ink:#132a22; --sw-muted:#61736b;
  --sw-source:#e2483c; --sw-source-soft:#fdf0ec; --sw-source-line:#f7dbd2;
  display:flex;flex-direction:column;min-height:0;height:100%;
  background:#f4f5f0;font-size:.86rem;color:var(--sw-ink);
}
/* ---------- En-tête ---------- */
.sw-head{
  flex:none;display:flex;align-items:center;justify-content:space-between;gap:16px;
  flex-wrap:wrap;padding:14px clamp(14px,1.5vw,24px);
  background:#fff;border-bottom:1px solid var(--sw-line);
}
.sw-head__id{display:flex;align-items:center;gap:12px;min-width:0}
.sw-head__ico{
  flex:none;width:42px;height:42px;border-radius:12px;display:grid;place-items:center;
  background:var(--sw-source-soft);color:var(--sw-source);
}
.sw-head__ico svg{width:22px;height:22px}
.sw-head h1{margin:0;font-size:clamp(1.02rem,1.35vw,1.3rem);font-weight:800;letter-spacing:-.025em}
.sw-head p{margin:2px 0 0;font-size:.78rem;color:var(--sw-muted)}
.sw-breadcrumb{display:flex;align-items:center;gap:7px;font-size:.75rem;color:var(--sw-muted);margin-bottom:2px}
.sw-breadcrumb strong{color:var(--sw-ink);font-weight:700}

/* ---------- Corps : formulaire + colonne latérale ---------- */
.sw-body{
  flex:1;min-height:0;overflow-y:auto;
  display:grid;grid-template-columns:minmax(0,1fr) clamp(280px,26vw,380px);
  gap:clamp(12px,1.2vw,20px);
  padding:clamp(12px,1.3vw,20px) clamp(14px,1.5vw,24px);
  align-content:start;
}
.sw-col{display:flex;flex-direction:column;gap:clamp(12px,1.2vw,16px);min-width:0}
.sw-card{
  background:#fff;border:1px solid var(--sw-line);border-radius:12px;
  padding:clamp(12px,1.2vh,18px) clamp(13px,1.2vw,20px);
}
.sw-card__head{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.sw-step{
  flex:none;width:24px;height:24px;border-radius:50%;display:grid;place-items:center;
  background:var(--sw-source);color:#fff;font-size:.74rem;font-weight:800;
}
.sw-card__head h2{margin:0;font-size:.95rem;font-weight:750;letter-spacing:-.015em}
.sw-card__head small{margin-left:auto;font-size:.73rem;color:var(--sw-muted);font-weight:600}

/* ---------- Champs ---------- */
.sw-grid{display:grid;gap:10px}
.sw-grid--2{grid-template-columns:repeat(auto-fit,minmax(210px,1fr))}
.sw-grid--3{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}
.sw-grid--4{grid-template-columns:repeat(auto-fit,minmax(130px,1fr))}
.sw-field{display:flex;flex-direction:column;gap:4px;min-width:0}
.sw-field label{font-size:.74rem;font-weight:700;color:#3f564c}
.sw-field label .sw-req{color:var(--sw-source)}
.sw-field input,.sw-field select,.sw-field textarea{
  width:100%;box-sizing:border-box;padding:8px 10px;
  border:1px solid #dde5df;border-radius:9px;background:#fff;
  font-family:inherit;font-size:.84rem;color:var(--sw-ink);
}
.sw-field textarea{resize:vertical;line-height:1.45}
.sw-field input:focus,.sw-field select:focus,.sw-field textarea:focus{
  outline:none;border-color:#7fb9a0;box-shadow:0 0 0 3px rgba(28,139,90,.13);
}
.sw-field input:disabled,.sw-field select:disabled{background:#f5f7f5;color:#7c8d85}
.sw-field small{font-size:.7rem;color:var(--sw-muted);line-height:1.4}
.sw-hint{margin:0;font-size:.74rem;color:var(--sw-muted);line-height:1.5}

/* ---------- Import fournisseur ---------- */
/* Ligne d'import : le bloc de saisie ne doit PAS s'etirer sur la hauteur de la ligne,
   sinon le champ et le bouton prennent la hauteur du plus grand element de la ligne.
   On fixe donc la ligne et l'alignement, et on empeche tout etirement. */
.sw-import{display:flex;gap:9px;align-items:flex-end;flex-wrap:wrap}
.sw-import .sw-field{flex:1 1 260px;min-width:0;align-self:flex-end;height:auto}
.sw-import .sw-field label{height:auto}
.sw-import input{flex:0 0 auto;width:100%;min-width:0;height:38px;box-sizing:border-box}
.sw-import button{flex:none;align-self:flex-end;height:38px;justify-content:center}
.sw-btn{
  display:inline-flex;align-items:center;gap:7px;
  padding:8px 14px;border:1px solid #d5e3da;border-radius:9px;background:#fff;
  color:#1c6b54;font-family:inherit;font-size:.83rem;font-weight:700;cursor:pointer;
}
.sw-btn:hover{background:#f2f7f4}
.sw-btn:disabled{opacity:.6;cursor:progress}
.sw-btn--primary{background:#1c6b54;border-color:#1c6b54;color:#fff}
.sw-btn--primary:hover{background:#17573f}
.sw-btn--source{background:var(--sw-source);border-color:var(--sw-source);color:#fff}
.sw-btn--source:hover{background:#c93f34}
.sw-btn svg{width:16px;height:16px}
.sw-status{
  margin-top:10px;padding:9px 12px;border-radius:9px;font-size:.78rem;line-height:1.5;
  display:flex;align-items:flex-start;gap:8px;
}
.sw-status svg{width:16px;height:16px;flex:none;margin-top:1px}
.sw-status--ok{background:#eef7f2;border:1px solid #d5ebe0;color:#1c6b54}
.sw-status--warn{background:#fdf6ee;border:1px solid #f2e2cc;color:#7a5a30}
.sw-status--error{background:#fdeae7;border:1px solid #f6d3c6;color:#b23c2f}
.sw-status--idle{background:#f4f7f5;border:1px solid #e3eae4;color:var(--sw-muted)}
.sw-warnings{margin:8px 0 0;padding-left:18px;font-size:.74rem;color:#7a5a30;line-height:1.55}
.sw-source-tag{
  display:inline-flex;align-items:center;gap:6px;margin-left:auto;
  padding:3px 9px;border-radius:999px;background:var(--sw-source-soft);
  border:1px solid var(--sw-source-line);color:#b23c2f;
  font-size:.7rem;font-weight:700;
}

/* ---------- Images ---------- */
.sw-gallery{display:flex;flex-direction:column;gap:10px}
.sw-gallery__main{
  position:relative;aspect-ratio:1/1;border-radius:11px;background:#f2f5f2;
  border:1px solid var(--sw-line);display:grid;place-items:center;overflow:hidden;
}
.sw-gallery__main img{width:100%;height:100%;object-fit:cover;display:block}
.sw-gallery__vide{display:grid;gap:6px;place-items:center;color:#a8b8ae;text-align:center;padding:16px}
.sw-gallery__vide svg{width:30px;height:30px}
.sw-gallery__vide small{font-size:.72rem;line-height:1.45}
.sw-gallery__main strong{
  position:absolute;bottom:8px;left:8px;padding:2px 9px;border-radius:999px;
  background:rgba(19,42,34,.76);color:#fff;font-size:.68rem;font-weight:700;
}
.sw-gallery__thumbs{display:grid;grid-template-columns:repeat(auto-fill,minmax(56px,1fr));gap:6px}
/* Etat reel du pont avec l'extension du projet. */
.sw-pont{
  margin:10px 0 0;padding:7px 11px;border-radius:9px;
  font-size:.75rem;font-weight:650;line-height:1.45;
}
.sw-pont--ok{background:#eef7f2;border:1px solid #d5ebe0;color:#1c6b54}
.sw-pont--absent{background:#f5f7f5;border:1px solid #e3eae4;color:#61736b}
.sw-thumb{
  position:relative;aspect-ratio:1/1;border-radius:8px;overflow:hidden;
  border:2px solid transparent;background:#f2f5f2;cursor:pointer;padding:0;
}
.sw-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.sw-thumb.is-active{border-color:var(--sw-source)}
/* Image declaree par l'annonce mais non affichable : signalee, jamais comptee comme
   correctement importee. */
.sw-thumb__absente{
  display:grid;place-items:center;width:100%;height:100%;
  background:#fdeae7;color:#b23c2f;font-weight:800;font-size:.9rem;
}
.sw-thumb__retirer{
  position:absolute;top:2px;right:2px;width:18px;height:18px;padding:0;
  border:0;border-radius:50%;background:rgba(19,42,34,.8);color:#fff;
  font-size:.72rem;line-height:1;cursor:pointer;font-family:inherit;
}
.sw-gallery__actions{display:flex;gap:8px;flex-wrap:wrap}
.sw-gallery__actions .sw-btn{flex:1 1 auto;justify-content:center}
.sw-legal{margin:0;font-size:.68rem;color:#8a9a91;line-height:1.45}

/* ---------- Tableau des variantes ---------- */
.sw-table-wrap{overflow-x:auto;border:1px solid var(--sw-line);border-radius:10px}
.sw-table{width:100%;border-collapse:collapse;font-size:.79rem}
.sw-table th{
  text-align:left;padding:9px 10px;background:#f7faf8;color:#4b6b5e;
  font-size:.71rem;font-weight:750;text-transform:uppercase;letter-spacing:.03em;
  white-space:nowrap;border-bottom:1px solid var(--sw-line);
}
.sw-table td{padding:6px 8px;border-bottom:1px solid #f1f4f1;vertical-align:middle}
.sw-table tr:last-child td{border-bottom:0}
.sw-table input,.sw-table select{
  width:100%;box-sizing:border-box;padding:6px 8px;border:1px solid #e4eae5;
  border-radius:7px;font-family:inherit;font-size:.79rem;color:var(--sw-ink);background:#fff;
}
.sw-table input:focus{outline:none;border-color:#7fb9a0}
.sw-table input[data-champ="nom"]{min-width:120px}
.sw-table input[data-champ="sku"]{min-width:90px}
.sw-table .sw-num{text-align:right}
.sw-table__img{
  width:34px;height:34px;border-radius:7px;object-fit:cover;display:block;
  border:1px solid var(--sw-line);
}
.sw-table__sans-img{
  width:34px;height:34px;border-radius:7px;display:grid;place-items:center;
  background:#f2f5f2;color:#a8b8ae;font-size:.6rem;
}
.sw-table__sup{
  width:28px;height:28px;display:grid;place-items:center;padding:0;
  border:1px solid #e4eae5;border-radius:7px;background:#fff;color:#b23c2f;
  cursor:pointer;font-family:inherit;font-size:.86rem;line-height:1;
}
.sw-table__sup:hover{background:#fdeae7}
.sw-table-faux{
  display:grid;gap:6px;
  grid-template-columns:1fr 1fr 1fr;
}
.sw-table-faux input{
  padding:6px 8px;border:1px solid #e4eae5;border-radius:7px;
  font-family:inherit;font-size:.79rem;background:#fff;
}
.sw-table-faux input:focus{outline:none;border-color:#7fb9a0}

/* ---------- Tarifs SendWhich ---------- */
.sw-tarifs{display:flex;flex-direction:column;gap:9px}
.sw-tarif{display:flex;align-items:center;justify-content:space-between;gap:10px}
.sw-tarif label{font-size:.76rem;color:#3f564c;font-weight:650}
.sw-tarif__saisie{display:flex;align-items:center;gap:6px;flex:none}
.sw-tarif__saisie input{
  width:104px;text-align:right;padding:6px 9px;
  border:1px solid #dde5df;border-radius:8px;font-family:inherit;font-size:.8rem;
}
.sw-tarif__saisie select{padding:6px 8px;border:1px solid #dde5df;border-radius:8px;font-family:inherit;font-size:.78rem}
.sw-tarif__saisie span{font-size:.72rem;color:var(--sw-muted);font-weight:650;min-width:26px}
.sw-tarif__resultat{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:9px 11px;border-radius:9px;background:#f5f7f5;margin-top:2px;
}
.sw-tarif__resultat span{font-size:.78rem;font-weight:650;color:#3f564c}
.sw-tarif__resultat strong{font-size:.95rem;font-weight:800;color:var(--sw-ink)}
.sw-tarif__total{
  background:var(--sw-source-soft);border:1px solid var(--sw-source-line);
}
.sw-tarif__total span{color:#b23c2f}
.sw-tarif__total strong{color:#b23c2f;font-size:1.05rem}
.sw-manquant{
  margin:0;padding:9px 11px;border-radius:9px;font-size:.75rem;line-height:1.5;
  background:#fdf6ee;border:1px solid #f2e2cc;color:#7a5a30;
}

/* ---------- Fourniture du contenu de la page ---------- */
.sw-source{
  margin-top:11px;padding:10px 12px;border-radius:10px;
  background:#f7faf8;border:1px solid #e4eae5;
}
.sw-source summary{
  font-size:.79rem;font-weight:700;color:#3f564c;cursor:pointer;
  list-style:none;display:flex;align-items:center;gap:7px;
}
.sw-source summary::-webkit-details-marker{display:none}
.sw-source summary::before{content:"▸";color:#7f9189;font-size:.8rem}
.sw-source[open] summary::before{content:"▾"}
.sw-source textarea{font-family:ui-monospace,Consolas,monospace;font-size:.74rem}

/* ---------- Preuves ---------- */
.sw-preuves{display:flex;flex-direction:column;gap:7px}
.sw-preuve{display:flex;gap:8px;align-items:center}
.sw-preuve select{flex:0 0 150px}
.sw-preuve input{flex:1;min-width:0}
.sw-preuves__ajout{align-self:flex-start}

/* ---------- Pied d'actions ---------- */
.sw-foot{
  flex:none;display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  padding:12px clamp(14px,1.5vw,24px);background:#fff;border-top:1px solid var(--sw-line);
}
.sw-foot__erreur{flex:1 1 220px;font-size:.78rem;color:#b23c2f;line-height:1.45;min-width:0}
.sw-foot__espace{margin-left:auto}
.sw-foot .sw-btn{padding:10px 18px}

/* ---------- Adaptation ---------- */
@media(max-width:1180px){
  .sw-body{grid-template-columns:minmax(0,1fr)}
}
@media(max-width:760px){
  .sw-grid--3,.sw-grid--4{grid-template-columns:1fr 1fr}
  .sw-import button{width:100%;justify-content:center}
}
@media(prefers-reduced-motion:reduce){
  .sw-page *{transition:none}
}
