/* Responsive : page import (fenêtre étroite -> large). Tout est scopé body.embed. */
body.embed #page-import-v2{--iv2-gap:clamp(10px,1.6vw,18px);min-width:0}
body.embed #page-import-v2 .card{min-width:0;padding:clamp(12px,2vw,20px)}
body.embed #page-import-v2 .pg-head h1{font-size:clamp(20px,2.4vw,26px);overflow-wrap:anywhere}

/* Zone de dépôt */
body.embed #page-import-v2 .iv2-drop{gap:var(--iv2-gap)}
body.embed #page-import-v2 .iv2-steps{gap:8px clamp(10px,2vw,22px)}
body.embed #page-import-v2 .iv2-file-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:stretch}
body.embed #page-import-v2 #iv2-file{min-width:0;width:100%;min-height:44px;flex:none}
body.embed #page-import-v2 #btn-iv2-scan{min-height:44px;white-space:nowrap}
body.embed #page-import-v2 #iv2-progress{overflow-wrap:anywhere}
@media (max-width:760px){
  body.embed #page-import-v2 .iv2-file-row{grid-template-columns:minmax(0,1fr)}
  body.embed #page-import-v2 #btn-iv2-scan{width:100%}
  body.embed #page-import-v2 .iv2-steps{flex-direction:column}
}

/* Cartes de résultats : conteneurs pour les container queries */
body.embed #page-import-v2 #iv2-results{display:flex;flex-direction:column;gap:0;min-width:0}
body.embed #page-import-v2 #iv2-results > .card{container-type:inline-size;container-name:iv2card;overflow-wrap:anywhere;margin-bottom:clamp(8px,1.2vw,12px)}
body.embed #page-import-v2 #iv2-results > .card > label.filters-row{min-height:36px;align-items:flex-start;flex-wrap:nowrap;flex-direction:row}
body.embed #page-import-v2 #iv2-results > .card > label.filters-row > span{min-width:0;flex:1}
body.embed #page-import-v2 #iv2-results label.filters-row{flex-direction:row !important;flex-wrap:nowrap;align-items:flex-start;gap:10px !important}
body.embed #page-import-v2 #iv2-results label.filters-row > span{min-width:0}
body.embed #page-import-v2 #iv2-results .badge{white-space:normal;text-align:left}
/* zones cliquables >= 36px pour les cases */
body.embed #page-import-v2 #iv2-results input[type=checkbox]{width:20px;height:20px;margin:0;flex:none}
body.embed #page-import-v2 #iv2-results label.filters-row:has(> input[type=checkbox]){padding:6px 0;min-height:36px;align-items:center}
body.embed #page-import-v2 #iv2-results > .card > label.filters-row:has(> .iv2-new-check){align-items:flex-start}

/* Photos */
body.embed #page-import-v2 .iv2-photos{flex-wrap:wrap;gap:clamp(8px,1.4vw,12px)}
body.embed #page-import-v2 .iv2-photo-box{flex:0 1 clamp(110px,22cqw,180px);min-width:96px;max-width:100%}
body.embed #page-import-v2 .iv2-photo-box img{max-width:100%;height:auto;max-height:clamp(70px,12vw,110px);object-fit:contain}

/* Tableau de comparaison : 4 colonnes en large */
body.embed #page-import-v2 table.iv2-cmp{width:100%;table-layout:fixed}
body.embed #page-import-v2 table.iv2-cmp th,
body.embed #page-import-v2 table.iv2-cmp td{overflow-wrap:anywhere;word-break:break-word;vertical-align:top;white-space:normal}
body.embed #page-import-v2 table.iv2-cmp th:first-child,
body.embed #page-import-v2 table.iv2-cmp td:first-child{width:clamp(96px,16%,170px)}
body.embed #page-import-v2 table.iv2-cmp td .filters-row{align-items:flex-start;min-height:0}

/* Sous ~640px de carte : lignes empilées, une "carte" par champ */
@container iv2card (max-width:680px){
  table.iv2-cmp,table.iv2-cmp tbody{display:block;width:100%;border:0}
  table.iv2-cmp thead{display:none}
  table.iv2-cmp tr{display:grid;grid-template-columns:minmax(0,1fr);gap:0;padding:6px 10px;margin-bottom:6px;border:1px solid var(--border);border-radius:var(--radius-sm)}
  table.iv2-cmp td{display:grid;grid-template-columns:minmax(84px,32%) minmax(0,1fr);gap:8px;align-items:start;width:auto !important;padding:2px 0 !important;border:0 !important;background:none}
  table.iv2-cmp td[data-label]::before{content:attr(data-label);color:var(--sub);font-size:11.5px;font-weight:600;line-height:1.4;padding-top:1px}
  table.iv2-cmp td.iv2-c-field{display:block;font-weight:700;font-size:13px;padding-bottom:6px;margin-bottom:2px;border-bottom:1px solid var(--border)}
  table.iv2-cmp td.iv2-final-cell{background:var(--ok-soft) !important;border-radius:6px;padding:4px 8px !important;margin-top:4px}
  table.iv2-cmp td.iv2-final-cell::before{color:var(--ok)}
  table.iv2-cmp td .filters-row{min-height:36px}
  table.iv2-cmp tr:not(:has(.iv2-final-cell)) td[data-label="BDD actuelle"],
  table.iv2-cmp tr:not(:has(.iv2-final-cell)) td[data-label="Rendu final"]{display:none}
  table.iv2-cmp tr:not(:has(.iv2-final-cell)) td[data-label="Importé"]::before{content:"Identique"}
  table.iv2-cmp td.iv2-c-field{padding-bottom:4px !important;margin-bottom:2px}
}
@container iv2card (max-width:380px){
  table.iv2-cmp td{grid-template-columns:minmax(0,1fr);gap:2px}
}

/* Barre d'action collante */
body.embed #page-import-v2 #iv2-apply-card:not([hidden]){bottom:max(8px,env(safe-area-inset-bottom));gap:10px clamp(10px,2vw,16px);padding:clamp(10px,1.6vw,14px) clamp(12px,2vw,18px);margin-top:clamp(8px,1.4vw,14px)}
body.embed #page-import-v2 #iv2-apply-card #iv2-summary{flex:1 1 220px;min-width:0;overflow-wrap:anywhere}
body.embed #page-import-v2 #iv2-apply-card .btn.full{flex:0 1 auto;min-height:44px}
@media (max-width:700px){
  body.embed #page-import-v2 #iv2-apply-card:not([hidden]){flex-direction:column;align-items:stretch}
  body.embed #page-import-v2 #iv2-apply-card #iv2-summary{flex:0 0 auto}
  body.embed #page-import-v2 #iv2-apply-card .btn.full{width:100%;min-width:0}
}
@media (max-height:640px){
  body.embed #page-import-v2 #iv2-apply-card:not([hidden]){flex-direction:row;align-items:center;padding:8px 12px;bottom:4px}
  body.embed #page-import-v2 #iv2-apply-card #iv2-summary{flex:1 1 200px}
  body.embed #page-import-v2 #iv2-apply-card .btn.full{width:auto;min-width:160px;min-height:38px}
}
/* espace de respiration sous la dernière carte pour que la barre ne masque rien */
body.embed #page-import-v2 #iv2-results:not(:empty){padding-bottom:4px}
