/**
 * Fichier  : assets/css/orders-mobile.css
 * Auteur   : KREMER Régis
 * Version  : 2.6.80
 * Date     : 2026-07-17
 * Description : Commandes téléphone/tablette — assistant, cartes, brouillons et réception terrain.
 */

.ord-mobile-list,
.ord-flow-page,
.ord-receive-page {
  --ord-gap: clamp(.75rem, 2.2vw, 1.15rem);
  width: 100%;
  min-width: 0;
  color: var(--text);
}

.ord-mobile-hero,
.ord-flow-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 8%, var(--bg-card)), var(--bg-card));
  border-radius: 16px;
}
.ord-mobile-hero h2,
.ord-flow-head h2 {
  margin: .08rem 0 .2rem;
  font-size: clamp(1.18rem, 4.6vw, 1.55rem);
  line-height: 1.12;
}
.ord-mobile-hero p,
.ord-flow-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: .84rem;
  line-height: 1.42;
}
.ord-mobile-eyebrow {
  display: block;
  color: var(--blue);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ord-mobile-new,
.ord-flow-head .btn,
.ord-receive-head .btn {
  min-width: 48px;
  min-height: 48px;
  flex: 0 0 auto;
}

.ord-mobile-kpis,
.ord-receive-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .45rem;
  margin-top: .65rem;
}
.ord-mobile-kpis > div,
.ord-receive-summary > div {
  min-width: 0;
  padding: .62rem .45rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--bg-card);
  text-align: center;
}
.ord-mobile-kpis strong,
.ord-receive-summary strong {
  display: block;
  font-size: 1.12rem;
  line-height: 1;
}
.ord-mobile-kpis span,
.ord-receive-summary span {
  display: block;
  margin-top: .25rem;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 700;
}

.ord-mobile-tools,
.ord-receive-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  margin: .75rem 0;
}
.ord-mobile-search {
  display: block;
  min-width: 0;
}
.ord-mobile-search input,
.ord-mobile-tools .btn,
.ord-receive-tools .form-select {
  min-height: 48px;
}
.ord-filter-count {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  margin-left: .25rem;
  place-items: center;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
}

.ord-mobile-section {
  margin-top: 1rem;
}
.ord-mobile-section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .55rem;
}
.ord-mobile-section__head h3 {
  margin: .08rem 0 0;
  font-size: 1rem;
}
.ord-mobile-count {
  color: var(--text-muted);
  font-size: .76rem;
  font-weight: 700;
}
.ord-mobile-grid,
.ord-line-grid,
.ord-receive-grid {
  display: grid;
  gap: .65rem;
  grid-template-columns: 1fr;
}
.ord-mobile-empty {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  text-align: center;
  font-size: .85rem;
}

.ord-mobile-card,
.ord-line-card,
.ord-receive-card {
  min-width: 0;
  padding: .82rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 15px;
  background: var(--bg-card);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}
.ord-mobile-card[data-state="success"],
.ord-receive-card.is-complete { border-left-color: var(--green); }
.ord-mobile-card[data-state="warning"] { border-left-color: var(--orange); }
.ord-mobile-card[data-state="danger"] { border-left-color: var(--red); }
.ord-mobile-card[data-state="info"],
.ord-receive-card.is-prepared { border-left-color: var(--blue); }
.ord-mobile-card__head,
.ord-receive-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem;
}
.ord-mobile-card__head h4,
.ord-receive-card h3 {
  margin: .08rem 0 .18rem;
  font-size: .98rem;
  line-height: 1.2;
}
.ord-mobile-card__head p,
.ord-receive-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: .76rem;
  line-height: 1.35;
}
.ord-mobile-card__number {
  display: block;
  color: var(--blue);
  font-family: var(--font-mono, monospace);
  font-size: .69rem;
  font-weight: 800;
}
.ord-mobile-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 800;
  white-space: nowrap;
}
.ord-mobile-badge[data-state="success"], [data-state="success"] > .ord-mobile-badge { background: var(--green-pale); color: var(--green); }
.ord-mobile-badge[data-state="warning"] { background: var(--orange-pale); color: var(--orange); }
.ord-mobile-badge[data-state="danger"] { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.ord-mobile-badge[data-state="info"] { background: var(--blue-pale); color: var(--blue); }

.ord-mobile-progress {
  height: 7px;
  margin: .65rem 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
}
.ord-mobile-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}
.ord-mobile-draft-state {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin: .65rem 0;
}
.ord-mobile-draft-state span {
  padding: .24rem .45rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 700;
}
.ord-mobile-card__facts,
.ord-line-card dl,
.ord-receive-card dl,
.ord-review-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
  margin: .65rem 0 0;
}
.ord-mobile-card__facts > div,
.ord-line-card dl > div,
.ord-receive-card dl > div,
.ord-review-summary > div {
  min-width: 0;
  padding: .48rem;
  border-radius: 10px;
  background: var(--bg-elevated);
}
.ord-mobile-card__facts dt,
.ord-line-card dt,
.ord-receive-card dt,
.ord-review-summary dt {
  color: var(--text-muted);
  font-size: .64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ord-mobile-card__facts dd,
.ord-line-card dd,
.ord-receive-card dd,
.ord-review-summary dd {
  min-width: 0;
  margin: .18rem 0 0;
  overflow-wrap: anywhere;
  font-size: .8rem;
  font-weight: 800;
}
.ord-mobile-card__facts dd[data-state="success"] { color: var(--green); }
.ord-mobile-card__facts dd[data-state="danger"] { color: var(--red); }
.ord-mobile-card__actions,
.ord-line-card footer {
  display: flex;
  gap: .42rem;
  margin-top: .7rem;
}
.ord-mobile-card__actions .btn,
.ord-line-card footer .btn,
.ord-receive-card > .btn {
  min-height: 44px;
  flex: 1 1 auto;
}
.ord-mobile-card__actions .ord-mobile-menu {
  flex: 0 0 46px;
  font-size: 1.25rem;
}

/* Filters and sheets */
.ord-filter-drawer,
.ord-sheet-form {
  display: grid;
  gap: .75rem;
}
.ord-mobile-field {
  display: grid;
  gap: .35rem;
  min-width: 0;
}
.ord-mobile-field label {
  color: var(--text-muted);
  font-size: .76rem;
  font-weight: 800;
}
.ord-mobile-field input,
.ord-mobile-field select,
.ord-mobile-field textarea {
  min-height: 48px;
  font-size: 16px;
}
.ord-action-sheet-note {
  margin: 0;
  color: var(--text-muted);
  font-size: .84rem;
  line-height: 1.5;
}
.ord-sheet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .65rem;
}
.ord-sheet-product {
  display: grid;
  gap: .18rem;
  padding: .7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.ord-sheet-product span {
  color: var(--text-muted);
  font-size: .78rem;
}

/* Four-step wizard */
.ord-flow-page,
.ord-receive-page {
  padding-bottom: calc(var(--ms-sticky-actions-height, 74px) + var(--safe-bottom, 0px) + 1rem);
}
.ord-flow-head {
  position: sticky;
  top: 0;
  z-index: 20;
  border-radius: 0 0 16px 16px;
  margin: -1rem -1rem 0;
  padding-top: calc(.75rem + var(--safe-top, 0px));
}
.ord-flow-head > div {
  min-width: 0;
  flex: 1 1 auto;
}
.ord-flow-progress {
  height: 5px;
  margin: .65rem 0 .45rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-elevated);
}
.ord-flow-progress span {
  display: block;
  width: var(--ms-flow-progress, 25%);
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width .2s ease;
}
.ord-flow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .32rem;
  margin-bottom: .7rem;
}
.ord-flow-steps button {
  min-width: 0;
  min-height: 48px;
  padding: .35rem .2rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .62rem;
  font-weight: 800;
}
.ord-flow-steps button span {
  display: grid;
  width: 23px;
  height: 23px;
  margin: 0 auto .16rem;
  place-items: center;
  border-radius: 999px;
  background: var(--bg-elevated);
}
.ord-flow-steps button.is-current {
  border-color: var(--blue);
  color: var(--blue);
}
.ord-flow-steps button.is-current span { background: var(--blue); color: #fff; }
.ord-flow-steps button.is-complete { color: var(--green); }
.ord-flow-steps button.is-complete span { background: var(--green); color: #fff; }
.ord-flow-panel {
  min-height: min(55vh, 520px);
  padding: .9rem;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--bg-card);
}
.ord-flow-panel h3 {
  margin: .12rem 0 .35rem;
  font-size: 1.1rem;
}
.ord-flow-panel > p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: .84rem;
  line-height: 1.48;
}
.ord-inline-action {
  min-height: 46px;
  margin-top: .65rem;
}
.ord-products-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: .7rem;
}
.ord-products-actions .btn { min-height: 48px; }
.ord-flow-actions,
.ord-receive-actions {
  display: grid;
  grid-template-columns: minmax(88px, auto) 1fr minmax(120px, auto);
  align-items: center;
  gap: .5rem;
  padding: .65rem max(.75rem, env(safe-area-inset-right)) calc(.65rem + var(--safe-bottom, 0px)) max(.75rem, env(safe-area-inset-left));
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  backdrop-filter: blur(16px);
}
.ord-flow-actions .btn,
.ord-receive-actions .btn { min-height: 48px; }
.ord-flow-step-label {
  color: var(--text-muted);
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
}

/* Product lines */
.ord-line-card__identity {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.ord-line-card__identity img,
.ord-line-card__placeholder {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  object-fit: cover;
}
.ord-line-card__placeholder {
  display: grid;
  place-items: center;
  font-size: 1.3rem;
}
.ord-line-card__identity > div { min-width: 0; }
.ord-line-card__identity h4 {
  margin: 0 0 .15rem;
  overflow: hidden;
  font-size: .92rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ord-line-card__identity p,
.ord-line-card__supplier {
  margin: 0;
  color: var(--text-muted);
  font-size: .72rem;
  line-height: 1.35;
}
.ord-line-card__supplier { margin-top: .55rem; }
.ord-product-picker {
  display: grid;
  gap: .65rem;
}
.ord-product-picker__grid,
.ord-code-matches {
  display: grid;
  gap: .5rem;
  max-height: min(58vh, 620px);
  overflow: auto;
  overscroll-behavior: contain;
}
.ord-product-choice {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: .65rem;
  align-items: center;
  min-height: 64px;
  padding: .55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  text-align: left;
}
.ord-product-choice img,
.ord-product-choice > span {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--bg-elevated);
  object-fit: cover;
}
.ord-product-choice > span {
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}
.ord-product-choice div { min-width: 0; }
.ord-product-choice strong,
.ord-product-choice small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-product-choice small { margin-top: .2rem; color: var(--text-muted); font-size: .72rem; }

/* Review */
.ord-flow-review,
.ord-receive-review {
  display: grid;
  gap: .75rem;
}
.ord-review-note,
.ord-review-warning,
.ord-review-ok,
.ord-review-status {
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  font-size: .8rem;
  line-height: 1.45;
}
.ord-review-note p { margin: .25rem 0 0; }
.ord-review-warning {
  border-color: color-mix(in srgb, var(--orange) 45%, var(--border));
  background: color-mix(in srgb, var(--orange) 10%, var(--bg-card));
  color: var(--orange);
}
.ord-review-warning ul { margin: .35rem 0 0 1rem; padding: 0; }
.ord-review-ok,
.ord-review-status[data-state="success"] {
  border-color: color-mix(in srgb, var(--green) 40%, var(--border));
  background: var(--green-pale);
  color: var(--green);
}
.ord-review-status[data-state="warning"] {
  border-color: color-mix(in srgb, var(--orange) 40%, var(--border));
  background: var(--orange-pale);
  color: var(--orange);
}
.ord-review-status { display: grid; gap: .2rem; }
.ord-review-lines,
.ord-review-receive-lines {
  display: grid;
  gap: .45rem;
}
.ord-review-lines > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: .6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  font-size: .78rem;
}
.ord-review-lines span { min-width: 0; }
.ord-review-lines strong { flex: 0 0 auto; text-align: right; }
.ord-review-receive-lines article {
  padding: .7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.ord-review-receive-lines article > div:first-child {
  display: grid;
  gap: .12rem;
}
.ord-review-receive-lines article span,
.ord-review-receive-lines article p { color: var(--text-muted); font-size: .72rem; }
.ord-review-receive-lines article p { margin: .5rem 0 0; }

/* Receiving */
.ord-receive-head { margin-bottom: .65rem; }
.ord-receive-tools { grid-template-columns: minmax(0, 1fr) minmax(120px, auto); }
.ord-receive-card > header { margin-bottom: .55rem; }
.ord-receive-card.is-complete { opacity: .7; }
.ord-receive-card > .btn { width: 100%; margin-top: .65rem; }
.ord-receive-actions { grid-template-columns: minmax(110px, auto) 1fr; }
.ord-scanner-panel {
  display: grid;
  gap: .75rem;
}
.ord-scanner-reader {
  min-height: 280px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #000;
}
.ord-scanner-panel p {
  margin: 0;
  color: var(--text-muted);
  font-size: .82rem;
  text-align: center;
}

@media (min-width: 600px) {
  .ord-mobile-grid,
  .ord-line-grid,
  .ord-receive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ord-mobile-card__facts,
  .ord-line-card dl,
  .ord-receive-card dl,
  .ord-review-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ord-sheet-grid { grid-template-columns: 1fr 1fr; }
  .ord-flow-panel { padding: 1.15rem; }
  .ord-flow-steps button { font-size: .72rem; }
  .ord-product-picker__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) and (max-width: 1199px) {
  .ord-mobile-list,
  .ord-flow-page,
  .ord-receive-page { max-width: 1080px; margin-inline: auto; }
  .ord-mobile-grid,
  .ord-line-grid,
  .ord-receive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ord-flow-panel { min-height: 450px; }
  .ord-flow-page { padding-inline: clamp(1rem, 3vw, 2rem); }
  .ord-flow-head { margin-inline: 0; border-radius: 16px; }
  .ord-flow-steps { max-width: 820px; margin-inline: auto; margin-bottom: .8rem; }
}

@media (max-width: 480px) {
  .ord-mobile-hero { align-items: stretch; flex-direction: column; }
  .ord-mobile-new { width: 100%; }
  .ord-mobile-kpis,
  .ord-receive-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ord-mobile-tools,
  .ord-receive-tools { grid-template-columns: 1fr; }
  .ord-mobile-card__actions { flex-wrap: wrap; }
  .ord-mobile-card__actions .btn { flex: 1 1 calc(50% - .25rem); }
  .ord-flow-head { align-items: center; }
  .ord-flow-head .btn { min-width: 44px; padding-inline: .55rem; }
  .ord-flow-steps button { font-size: 0; }
  .ord-flow-steps button span { margin-bottom: 0; font-size: .7rem; }
  .ord-products-actions { grid-template-columns: 1fr; }
  .ord-flow-actions { grid-template-columns: minmax(88px, auto) 1fr; }
  .ord-flow-step-label { display: none; }
  .ord-receive-actions { grid-template-columns: 1fr; }
}

@media (orientation: landscape) and (max-height: 620px) and (max-width: 1199px) {
  .ord-flow-head { position: relative; margin-top: 0; border-radius: 14px; padding-top: .6rem; }
  .ord-flow-steps { margin-bottom: .4rem; }
  .ord-flow-panel { min-height: 260px; }
  .ord-scanner-reader { min-height: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  .ord-flow-progress span { transition: none; }
}
