/**
 * Fichier  : assets/css/products-mobile.css
 * Auteur   : KREMER Régis
 * Version  : 2.6.123
 * Date     : 2026-07-28
 * Description : Produits mobile/tablette — cartes natives, assistant de création et fiche à sections.
 *
 * Changelog :
 *   v2.6.81 (2026-07-17) — PRODUCTS MOBILE FLOW5.
 *   v2.6.90 (2026-07-20) — SCANNER CONSUMERS MIGRATION3 : accès scanner Produit commun.
 *   v2.6.98 (2026-07-20) — SCANNER TERRAIN CONFIRMATION1 : pictogramme caméra SVG stable.
 *   v2.6.122 (2026-07-28) — PRODUCTS MOBILE DOCUMENT ACTIONS CREATION FLOW FIX1 : FT/FDS et assistant compact compatible clavier.
 *   v2.6.123 (2026-07-28) — PRODUCTS MOBILE DOCUMENT OPENING KEYBOARD FLOW FIX2 : assistant mobile sans empilement et footer clavier sécurisé.
 */

.products-mobile-cards,
.products-mobile-more,
.products-mobile-actions { display: none; }
.products-scanner-search{min-height:44px;gap:7px;white-space:nowrap}
.products-scanner-search svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

@media (max-width: 1199px) {
  body[data-page="products"] .main-content { padding-bottom: calc(var(--ms-bottom-nav-space) + 22px); }

  #pgProducts .prod-filters-bar {
    position: sticky;
    top: 0;
    z-index: 55;
    padding: 10px;
    border-radius: 8px;
  }
  #pgProducts .prod-search-row,
  #pgProducts .prod-filters-bar.is-compact .prod-search-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  #pgProducts .prod-filter-toggle { display: inline-flex !important; min-width: 92px; }
  #pgProducts .view-toggle,
  #pgProducts .prod-dropdowns-row,
  #pgProducts .prod-actions-row,
  #pgProducts .prod-filters-divider,
  #pgProducts #prodBulkBar,
  #pgProducts #prodGrid,
  #pgProducts #prodTableWrap,
  #pgProducts #prodPager,
  #pgProducts .infinite-scroll-loader,
  #pgProducts .infinite-scroll-end { display: none !important; }

  .products-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0 12px;
  }
  .products-mobile-actions .btn { min-height: var(--ms-touch-target); justify-content: center; }
  #prodScannerSearch { display: none !important; }
  .products-mobile-actions [data-product-mobile-action="more"] { min-width: 0; }
  .products-mobile-actions__hint {
    grid-column: 1 / -1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 13px;
  }

  .products-mobile-cards {
    display: grid;
    gap: 10px;
    min-width: 0;
  }
  .products-mobile-card {
    gap: 12px;
    padding: 13px;
    border-radius: 7px;
  }
  .products-mobile-card__head {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: start;
    min-width: 0;
  }
  .products-mobile-card__media {
    display: grid;
    place-items: center;
    width: 74px;
    height: 74px;
    padding: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 28px;
  }
  .products-mobile-card__media img { width: 100%; height: 100%; object-fit: contain; }
  .products-mobile-card__media.is-empty::after { content: "📦"; }
  .products-mobile-card__identity { min-width: 0; }
  .products-mobile-card__identity .ms-entity-card__title { font-size: 16px; }
  .products-mobile-card__variant { margin: 3px 0 0; color: var(--blue); font-size: 12px; font-weight: 800; }
  .products-mobile-card__chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
  .products-mobile-card__chips span {
    max-width: 100%;
    padding: 3px 7px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .products-mobile-card__status {
    align-self: start;
    padding: 5px 7px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
  }
  .products-mobile-card__status--success { border-color: color-mix(in srgb, var(--green) 38%, var(--border)); background: var(--green-pale); color: var(--green-dark, var(--green)); }
  .products-mobile-card__status--warning { border-color: color-mix(in srgb, var(--orange) 42%, var(--border)); background: var(--orange-pale); color: var(--orange-dark, #9a5b00); }
  .products-mobile-card__status--danger { border-color: color-mix(in srgb, var(--red) 38%, var(--border)); background: var(--red-pale); color: var(--red); }
  .products-mobile-card__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .products-mobile-card__field--wide { grid-column: 1 / -1; }
  .products-mobile-card__actions { display: grid; gap: 8px; }
  .products-mobile-card__primary-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .products-mobile-card__primary-actions:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
  .products-mobile-card__resource-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .products-mobile-card__actions .btn { min-height: 46px; justify-content: center; }
  .products-mobile-card__document[disabled] { opacity: .46; cursor: not-allowed; border-style: dashed; }
  .products-mobile-card__resource-actions .btn { min-width: 0; padding-inline: 8px; }
  .products-mobile-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 0 calc(var(--ms-bottom-nav-space) + 10px);
    color: var(--text-muted);
    font-size: 12px;
  }
  .products-mobile-more .btn { min-height: 46px; }
  .products-mobile-empty {
    display: grid;
    gap: 4px;
    padding: 28px 18px;
    border: 1px dashed var(--border);
    background: var(--bg-card);
    text-align: center;
  }
  .products-mobile-empty span { color: var(--text-muted); font-size: 13px; }

  .products-mobile-filter-form { display: grid; gap: 8px; }
  .products-mobile-filter-form label { margin-top: 6px; color: var(--text-primary); font-size: 13px; font-weight: 800; }
  .products-mobile-filter-form select { min-height: var(--ms-touch-target); font-size: 16px; }
  .products-mobile-action-list { display: grid; gap: 8px; }
  .products-mobile-action-row {
    display: grid;
    gap: 3px;
    width: 100%;
    min-height: 62px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-align: left;
  }
  .products-mobile-action-row strong { font-size: 14px; }
  .products-mobile-action-row span { color: var(--text-muted); font-size: 12px; line-height: 1.35; }
  .products-mobile-action-row--danger { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); color: var(--red); }

  #modalBox.products-mobile-modal {
    width: min(100%, 860px) !important;
    max-width: 100% !important;
    height: var(--products-keyboard-height, var(--ms-visual-height, 100dvh)) !important;
    max-height: var(--products-keyboard-height, var(--ms-visual-height, 100dvh)) !important;
    margin: var(--products-keyboard-offset, var(--ms-visual-offset-top, 0)) 0 0 !important;
    border-radius: 0 !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
  }
  #modalBox.products-mobile-modal .modal-hdr {
    min-height: 58px;
    padding: 10px max(12px, var(--ms-safe-right)) 10px max(12px, var(--ms-safe-left));
  }
  #modalBox.products-mobile-modal .modal-hdr-icon { display: none; }
  #modalBox.products-mobile-modal .modal-hdr-text h3 { font-size: 17px; }
  #modalBox.products-mobile-modal .modal-hdr-text p { font-size: 11px; }
  #modalBox.products-mobile-modal .modal-body { min-height: 0; padding: 0 !important; overflow: auto; overscroll-behavior: contain; }
  #modalBox.products-mobile-modal .modal-footer {
    position: relative;
    z-index: 4;
    margin: 0;
    padding: 8px max(10px, var(--ms-safe-right)) calc(8px + var(--ms-safe-bottom)) max(10px, var(--ms-safe-left));
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: 0 -10px 30px rgba(15, 23, 42, .1);
  }

  .products-create-flow { max-width: 780px; margin: 0 auto; }
  .products-create-flow__header { position: sticky; top: 0; z-index: 3; padding: 9px max(12px, var(--ms-safe-right)) 7px max(12px, var(--ms-safe-left)); }
  .products-create-flow__summary { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
  .products-create-flow__product-title { overflow: hidden; font-size: 15px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
  .products-create-flow__current { flex: 0 0 auto; color: var(--text-muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
  .products-create-flow__current b { color: var(--blue); }
  .products-create-flow__header .ms-flow__progress { margin-top: 7px; height: 3px; }
  .products-create-flow__steps-toggle { margin-top: 5px; }
  .products-create-flow__steps-toggle > summary { width: max-content; min-height: 30px; display: flex; align-items: center; color: var(--blue); font-size: 12px; font-weight: 800; cursor: pointer; }
  .products-create-flow__steps-toggle[open] > summary { margin-bottom: 4px; }
  .products-create-flow__steps-toggle .ms-flow__steps { margin-top: 0; overflow-x: auto; scrollbar-width: none; }
  .products-create-flow__steps-toggle .ms-flow__steps::-webkit-scrollbar { display: none; }
  .products-create-flow .ms-flow__indicator { min-width: 78px; }
  .products-create-step { display: grid; gap: 9px; padding: 9px max(10px, var(--ms-safe-left)) 18px max(10px, var(--ms-safe-right)); }
  .products-create-step__intro { display: grid; gap: 2px; padding: 2px 0 5px; }
  .products-create-step__intro > span { color: var(--blue); font-size: 10.5px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
  .products-create-step__intro h3 { margin: 0; font-size: 18px; }
  .products-create-step__intro p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.35; }
  .products-create-step .pm-panel,
  .products-edit-section .pm-panel,
  .products-edit-section .pm-stock-summary { margin: 0; padding: 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); }
  .products-create-step .pm-panel h4,
  .products-edit-section .pm-panel h4 { margin: 0 0 12px; }
  .products-create-optional { border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); overflow: clip; }
  .products-create-optional > summary { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; cursor: pointer; }
  .products-create-optional > summary > span:first-child { display: grid; gap: 2px; }
  .products-create-optional > summary strong { font-size: 14px; }
  .products-create-optional > summary small { color: var(--text-muted); font-size: 11px; line-height: 1.3; }
  .products-create-optional > summary > span:last-child { color: var(--text-muted); transition: transform .15s ease; }
  .products-create-optional[open] > summary > span:last-child { transform: rotate(180deg); }
  .products-create-optional__body { display: grid; gap: 9px; padding: 0 8px 8px; }
  .products-create-optional__body > .pm-panel { border: 0; padding: 9px; background: color-mix(in srgb, var(--bg-card) 88%, var(--bg-page)); }
  .products-create-step .pm-sep,
  .products-edit-section .pm-sep { display: none; }
  .products-create-step input:not([type="checkbox"]):not([type="radio"]),
  .products-create-step select,
  .products-create-step textarea,
  .products-edit-section input:not([type="checkbox"]):not([type="radio"]),
  .products-edit-section select,
  .products-edit-section textarea { min-height: 46px; font-size: 16px; }
  .products-create-step textarea,
  .products-edit-section textarea { min-height: 96px; }
  .products-create-step .pm-img-zone { min-height: 180px; }
  .products-create-step .pm-img-preview { min-height: 132px; }
  .products-create-step .pm-manual-grid,
  .products-edit-section .pm-manual-grid { grid-template-columns: minmax(0, 1fr); }
  .products-create-step .pm-cond-row,
  .products-edit-section .pm-cond-row { grid-template-columns: minmax(0, 1fr) !important; }
  .products-create-step .pm-supplier-link-row > div[style*="grid-template-columns"],
  .products-edit-section .pm-supplier-link-row > div[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .products-create-step .pm-supplier-link-row select[multiple],
  .products-edit-section .pm-supplier-link-row select[multiple] { min-height: 120px; }
  .products-panel-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
  .products-panel-title-row h4 { margin: 0 0 3px !important; }
  .products-panel-title-row p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.4; }
  .products-panel-title-row .btn { flex: 0 0 auto; min-height: 44px; }
  .products-supplier-offers { display: block !important; }
  .products-draft-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid color-mix(in srgb, var(--blue) 34%, var(--border));
    background: var(--blue-pale);
  }
  .products-draft-notice > div { display: grid; gap: 2px; }
  .products-draft-notice span { color: var(--text-muted); font-size: 11.5px; }
  .products-flow-footer { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .products-flow-footer.is-first-step { grid-template-columns: minmax(0, 1fr); }
  .products-flow-footer.is-first-step [data-products-flow-next] { grid-column: 1; }
  .products-flow-footer .btn { min-height: var(--ms-touch-target); justify-content: center; }
  .products-flow-footer [hidden] { display: none !important; }

  .products-review-card { overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); }
  .products-review-card > header { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 11px; align-items: center; padding: 13px; border-bottom: 1px solid var(--border); }
  .products-review-card__image { display: grid; place-items: center; width: 64px; height: 64px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-elevated); font-size: 27px; }
  .products-review-card__image img { width: 100%; height: 100%; object-fit: contain; }
  .products-review-card header span { color: var(--blue); font-size: 10px; font-weight: 900; text-transform: uppercase; }
  .products-review-card h4 { margin: 2px 0; font-size: 17px; }
  .products-review-card header p { margin: 0; color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
  .products-review-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
  .products-review-card dl > div { min-width: 0; padding: 10px 12px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .products-review-card dt { color: var(--text-muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
  .products-review-card dd { margin: 3px 0 0; overflow-wrap: anywhere; color: var(--text-primary); font-size: 13px; font-weight: 750; }
  .products-review-note { margin: 10px 0 0; padding: 10px 12px; border-left: 3px solid var(--blue); background: var(--bg-elevated); color: var(--text-muted); font-size: 12px; line-height: 1.45; }

  .products-edit-page { max-width: 820px; margin: 0 auto; padding-bottom: 18px; }
  .products-edit-page__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px max(13px, var(--ms-safe-left)); border-bottom: 1px solid var(--border); background: var(--bg-card); }
  .products-edit-page__header span:first-child { color: var(--blue); font-size: 10px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
  .products-edit-page__header h2 { margin: 3px 0; font-size: 21px; }
  .products-edit-page__header p { margin: 0; color: var(--text-muted); font-size: 12px; }
  .products-edit-page__badge { flex: 0 0 auto; max-width: 42%; padding: 6px 8px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-elevated); font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
  .products-edit-page__jump { position: sticky; top: 0; z-index: 3; display: flex; gap: 6px; padding: 8px max(10px, var(--ms-safe-left)); overflow-x: auto; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg-card) 94%, transparent); backdrop-filter: blur(10px); scrollbar-width: none; }
  .products-edit-page__jump::-webkit-scrollbar { display: none; }
  .products-edit-page__jump button { flex: 0 0 auto; min-height: 40px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card); color: var(--text-primary); font-size: 12px; font-weight: 800; }
  .products-edit-section { border-bottom: 1px solid var(--border); }
  .products-edit-section__toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 68px; padding: 12px max(13px, var(--ms-safe-left)); border: 0; background: var(--bg-card); color: var(--text-primary); text-align: left; }
  .products-edit-section__toggle > span:first-child { display: grid; gap: 3px; }
  .products-edit-section__toggle strong { font-size: 15px; }
  .products-edit-section__toggle small { color: var(--text-muted); font-size: 11.5px; font-weight: 500; }
  .products-edit-section__toggle > span:last-child { font-size: 20px; transition: transform .16s ease; }
  .products-edit-section__toggle[aria-expanded="true"] > span:last-child { transform: rotate(180deg); }
  .products-edit-section__panel { display: grid; gap: 10px; padding: 0 max(10px, var(--ms-safe-left)) 14px; background: var(--bg-elevated); }
  .products-edit-section__panel[hidden] { display: none !important; }
  .products-edit-footer { display: grid !important; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; }
  .products-edit-footer .btn { min-height: var(--ms-touch-target); justify-content: center; }
}

@media (min-width: 600px) and (max-width: 1199px) {
  .products-mobile-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .products-mobile-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .products-mobile-card__head { grid-template-columns: 64px minmax(0, 1fr); }
  .products-mobile-card__media { width: 64px; height: 64px; }
  .products-mobile-card__status { grid-column: 1 / -1; justify-self: start; }
  .products-create-step { grid-template-columns: minmax(0, 1fr); padding-inline: 22px; }
  .products-create-step .pm-manual-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .products-edit-section__panel { padding-inline: 22px; }
}

@media (max-width: 430px) {
  .products-mobile-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .products-mobile-card__head { grid-template-columns: 62px minmax(0, 1fr); }
  .products-mobile-card__media { width: 62px; height: 62px; }
  .products-mobile-card__status { grid-column: 1 / -1; justify-self: start; }
  .products-mobile-card__primary-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .products-mobile-card__resource-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .products-review-card dl { grid-template-columns: minmax(0, 1fr); }
  .products-review-card dl > div { border-right: 0; }
  .products-flow-footer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .products-flow-footer.is-first-step { grid-template-columns: minmax(0, 1fr); }
  .products-flow-footer.is-first-step [data-products-flow-next] { grid-column: 1; }
  .products-flow-footer .btn { min-height: 48px; }
  .products-edit-footer { grid-template-columns: auto auto minmax(0, 1fr); }
  .products-panel-title-row { display: grid; }
  .products-panel-title-row .btn { width: 100%; }
}

@media (max-height: 560px) and (orientation: landscape) and (max-width: 1199px) {
  #modalBox.products-mobile-modal .modal-hdr { min-height: 48px; padding-block: 6px; }
  .products-create-flow__header { position: relative; }
  .products-create-flow__header .ms-flow__description { display: none; }
  .products-create-flow__header .ms-flow__steps { display: none; }
  .products-create-step { padding-block: 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .products-edit-section__toggle > span:last-child { transition: none; }
}

@media (max-width: 599px) {
  #modalBox.products-mobile-modal--create .modal-hdr {
    position: absolute;
    top: max(4px, var(--ms-safe-top));
    right: max(4px, var(--ms-safe-right));
    z-index: 12;
    width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    pointer-events: none;
  }
  #modalBox.products-mobile-modal--create .modal-hdr-text,
  #modalBox.products-mobile-modal--create .modal-hdr-icon { display: none; }
  #modalBox.products-mobile-modal--create .modal-close { width: 44px; height: 44px; pointer-events: auto; background: var(--bg-card); border: 1px solid var(--border); }
  #modalBox.products-mobile-modal--create .products-create-flow__header { padding-right: max(58px, calc(var(--ms-safe-right) + 50px)); }
  #modalBox.products-mobile-modal.is-keyboard-visible .products-create-flow__header { padding-block: 5px 4px; }
  #modalBox.products-mobile-modal.is-keyboard-visible .products-create-flow__product-title,
  #modalBox.products-mobile-modal.is-keyboard-visible .products-create-flow__steps-toggle,
  #modalBox.products-mobile-modal.is-keyboard-visible .products-draft-notice,
  #modalBox.products-mobile-modal.is-keyboard-visible .products-create-step__intro { display: none; }
  #modalBox.products-mobile-modal.is-keyboard-visible .products-create-flow__summary { justify-content: flex-start; }
  #modalBox.products-mobile-modal.is-keyboard-visible .products-create-flow__current { font-size: 11px; }
  #modalBox.products-mobile-modal.is-keyboard-visible .products-create-step { padding-top: 6px; padding-bottom: 10px; }
  #modalBox.products-mobile-modal.is-keyboard-visible .products-create-step .pm-panel,
  #modalBox.products-mobile-modal.is-keyboard-visible .products-create-optional > summary { padding-block: 7px; }
  #modalBox.products-mobile-modal.is-keyboard-visible .modal-footer { padding-block: 5px; }
  #modalBox.products-mobile-modal.is-keyboard-visible .products-flow-footer .btn { min-height: 44px; }
}
