:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17231f;
  background: #f4f1ea;
  --ink: #17231f;
  --muted: #6d756e;
  --line: #dedbd2;
  --panel: #fffdf8;
  --accent: #c8794f;
  --accent-dark: #9d5634;
  --success: #2e7656;
  --danger: #a1483d;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at top right, #fffdf8 0, #f4f1ea 42rem); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.auth-shell { width: min(100% - 36px, 430px); min-height: 100vh; margin: 0 auto; padding: 15vh 0 38px; }
.auth-mark { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 25px; border-radius: 18px; color: #fff; background: var(--ink); font-size: 1.8rem; }
.auth-shell h1 { margin-bottom: 10px; }
.auth-copy { margin-bottom: 28px; color: var(--muted); line-height: 1.5; }
.login-form { display: grid; gap: 8px; }
.login-form label { margin-top: 9px; font-size: .84rem; font-weight: 800; }
.login-form input { width: 100%; padding: 14px; border: 1px solid #c9c8c0; border-radius: 13px; outline: none; background: #fff; }
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(200, 121, 79, .13); }
.login-button { min-height: 50px; margin-top: 15px; border: 0; border-radius: 13px; color: #fff; background: var(--ink); font-weight: 900; }
.login-button:disabled, .passkey-button:disabled { cursor: wait; opacity: .6; }
.passkey-button { min-height: 44px; padding: 10px 15px; border: 1px solid var(--accent-dark); border-radius: 12px; color: var(--accent-dark); background: transparent; font-weight: 900; }
.auth-shell > .passkey-button { width: 100%; margin-top: 12px; }
.auth-feedback { min-height: 24px; margin-top: 16px; color: var(--muted); font-size: .86rem; }
.auth-feedback.error { color: var(--danger); }
.header-actions { display: flex; align-items: center; gap: 7px; }
.header-button { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; font-size: .74rem; font-weight: 800; }
.current-user { margin: 8px 0 0; color: var(--muted); font-size: .78rem; }
.passkey-card { display: grid; gap: 7px; margin-bottom: 18px; padding: 16px; border: 1px solid #d7e6db; border-radius: 16px; color: var(--ink); background: #edf6ef; }
.passkey-card span { color: var(--muted); font-size: .78rem; }
.passkey-card .passkey-button { justify-self: start; margin-top: 4px; }
.success-card { padding: 14px 16px; border-radius: 14px; color: var(--success); background: #e7f3e9; }
.app-shell { width: min(100%, 760px); margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 18px 38px; }
.app-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 2px 30px; }
.eyebrow, .section-kicker { margin: 0 0 7px; color: var(--accent-dark); font-size: .73rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Georgia, serif; font-size: clamp(2rem, 9vw, 3.2rem); font-weight: 500; letter-spacing: -.045em; }
h2 { margin-bottom: 18px; font-size: clamp(1.35rem, 6vw, 1.85rem); letter-spacing: -.025em; }
.status-dot { width: 12px; height: 12px; margin-top: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 6px #dbece1; }
.search-panel { padding: 22px 18px 18px; border: 1px solid rgba(222, 219, 210, .9); border-radius: 24px; background: rgba(255, 253, 248, .88); box-shadow: 0 18px 45px rgba(46, 54, 44, .08); }
.search-form { display: flex; gap: 9px; }
.search-form input { min-width: 0; flex: 1; padding: 15px 16px; border: 1px solid #c9c8c0; border-radius: 14px; outline: none; color: var(--ink); background: #fff; }
.search-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(200, 121, 79, .16); }
.search-form button, .select-button, .retry-button { border: 0; border-radius: 13px; color: #fff; background: var(--ink); font-weight: 800; }
.search-form button { padding: 0 17px; white-space: nowrap; }
.search-form button:disabled { cursor: wait; opacity: .62; }
.search-hint { margin: 12px 2px 0; color: var(--muted); font-size: .84rem; }
.feedback { min-height: 56px; padding: 22px 2px 0; }
.feedback:empty { min-height: 18px; padding-top: 0; }
.feedback-card { padding: 16px; border-radius: 15px; color: var(--danger); background: #fbecea; }
.feedback-card strong { display: block; margin-bottom: 4px; }
.retry-button { margin-top: 11px; padding: 10px 14px; background: var(--danger); }
.loading { display: flex; align-items: center; gap: 11px; color: var(--muted); font-weight: 700; }
.spinner { width: 19px; height: 19px; border: 3px solid #dbd9d0; border-top-color: var(--accent); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.results { display: grid; gap: 14px; }
.results-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 2px 2px; }
.results-heading h2 { margin: 0; font-size: 1.18rem; }
.results-count { color: var(--muted); font-size: .86rem; }
.product-card { display: grid; grid-template-columns: 104px 1fr; gap: 15px; padding: 12px; border: 1px solid var(--line); border-radius: 19px; background: var(--panel); box-shadow: 0 9px 24px rgba(46, 54, 44, .06); }
.product-image { width: 104px; height: 126px; border-radius: 13px; object-fit: cover; background: #e9e6dd; }
.product-image.is-empty { display: grid; place-items: center; padding: 12px; color: var(--muted); font-size: .75rem; text-align: center; }
.product-name { margin: 2px 0 7px; font-size: 1rem; line-height: 1.28; }
.product-sku { margin: 0 0 8px; color: var(--accent-dark); font-size: .82rem; font-weight: 900; letter-spacing: .07em; }
.product-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; margin-bottom: 12px; }
.meta-item { display: grid; gap: 2px; }
.meta-label { color: var(--muted); font-size: .7rem; }
.meta-value { font-size: .9rem; font-weight: 800; }
.available { color: var(--success); }
.unavailable { color: var(--danger); }
.select-button { width: 100%; padding: 11px 10px; background: var(--accent-dark); }
.select-button.selected { background: var(--success); }
.empty-state { padding: 28px 12px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 1.1rem; }
.sale-panel, .confirmation-panel { padding: 21px 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: 0 12px 30px rgba(46, 54, 44, .07); }
.back-button { margin-bottom: 22px; padding: 0; border: 0; color: var(--accent-dark); background: transparent; font-weight: 800; }
.sale-product-summary { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; padding: 12px; margin-bottom: 22px; border-radius: 16px; background: #f1eee5; }
.sale-product-image { width: 92px; height: 108px; border-radius: 12px; object-fit: cover; background: #e3e0d7; }
.sale-product-image.is-empty { display: grid; place-items: center; padding: 10px; color: var(--muted); font-size: .72rem; text-align: center; }
.sale-product-summary h3 { margin: 0 0 7px; font-size: 1rem; line-height: 1.3; }
.sale-product-summary .product-sku { margin-bottom: 7px; }
.sale-stock, .sale-catalog-price { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
.sale-form { display: grid; gap: 15px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-group { display: grid; gap: 7px; }
.field-group label { font-size: .84rem; font-weight: 800; }
.field-group label span:not(.optional-label) { color: var(--accent-dark); }
.optional-label { color: var(--muted); font-size: .74rem; font-weight: 500; }
.field-group input, .field-group select, .field-group textarea { width: 100%; padding: 13px 14px; border: 1px solid #c9c8c0; border-radius: 12px; outline: none; color: var(--ink); background: #fff; }
.field-group textarea { resize: vertical; }
.field-group input:focus, .field-group select:focus, .field-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(200, 121, 79, .13); }
.money-input { display: flex; align-items: center; border: 1px solid #c9c8c0; border-radius: 12px; background: #fff; }
.money-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(200, 121, 79, .13); }
.money-input input { border: 0; box-shadow: none; }
.money-input input:focus { box-shadow: none; }
.money-input span { padding-right: 14px; color: var(--muted); font-weight: 800; }
.file-hint { color: var(--muted); font-size: .75rem; }
.confirm-sale-button, .new-search-button { width: 100%; padding: 14px; border: 0; border-radius: 13px; color: #fff; background: var(--accent-dark); font-weight: 900; }
.demo-note { margin: 2px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.45; text-align: center; }
.confirmation-panel { text-align: center; }
.confirmation-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 2px auto 16px; border-radius: 50%; color: #fff; background: var(--success); font-size: 1.5rem; font-weight: 900; }
.confirmation-copy { color: var(--muted); }
.confirmation-summary { display: grid; gap: 8px; margin: 20px 0; padding: 16px; border-radius: 15px; color: var(--ink); background: #f1eee5; text-align: left; }
.confirmation-summary span { font-size: .86rem; }
.new-search-button { margin-top: 18px; background: var(--ink); }
.admin-panel { padding: 21px 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); }
.admin-form { display: grid; gap: 10px; padding: 16px; margin-bottom: 20px; border-radius: 15px; background: #f1eee5; }
.admin-form h3, .admin-panel h3 { margin: 2px 0 5px; font-size: 1rem; }
.admin-form input, .admin-form select { width: 100%; padding: 12px; border: 1px solid #c9c8c0; border-radius: 11px; background: #fff; }
.admin-list { display: grid; gap: 8px; margin: 8px 0 22px; }
.admin-row { display: grid; gap: 3px; padding: 11px 12px; border-radius: 11px; background: #f6f3ec; }
.admin-row span { color: var(--muted); font-size: .76rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.main-nav { position: sticky; top: max(8px, env(safe-area-inset-top)); z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 20px; padding: 5px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,253,248,.94); backdrop-filter: blur(12px); }
.nav-button { min-height: 42px; padding: 7px 4px; border: 0; border-radius: 11px; color: var(--muted); background: transparent; font-size: .72rem; font-weight: 800; }
.nav-button.active { color: #fff; background: var(--ink); }
.hero-card, .detail-card { padding: 22px 18px; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: 0 18px 45px rgba(46,54,44,.08); }
.action-grid { display: grid; gap: 12px; }
.action-card { display: grid; grid-template-columns: 48px 1fr; gap: 2px 13px; min-height: 82px; padding: 14px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: #fff; text-align: left; }
.action-card > span { grid-row: span 2; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #fff; background: var(--ink); font-size: 1.3rem; }
.action-card strong { align-self: end; font-size: 1rem; }.action-card small { color: var(--muted); }.action-card.accent > span { background: var(--accent-dark); }
.primary-button, .secondary-button, .photo-button { display: inline-grid; place-items: center; min-height: 48px; width: 100%; margin-top: 10px; padding: 12px 15px; border: 0; border-radius: 13px; color: #fff; background: var(--accent-dark); font-weight: 900; text-decoration: none; }
.secondary-button, .photo-button.secondary { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.detail-image { width: 100%; max-height: 440px; margin-bottom: 18px; border-radius: 18px; object-fit: contain; background: #eeeae1; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }.detail-grid span { display: grid; gap: 4px; padding: 12px; border-radius: 12px; color: var(--muted); background: #f2efe7; font-size: .76rem; }.detail-grid strong { color: var(--ink); font-size: .95rem; }
.warning-card { margin-bottom: 18px; padding: 14px; border-radius: 13px; color: #7a4c25; background: #fff1d9; font-size: .85rem; line-height: 1.45; }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }.photo-button { margin: 0; cursor: pointer; font-size: .8rem; text-align: center; }
.photo-preview { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }.photo-preview figure { position: relative; margin: 0; }.photo-preview img { width: 100%; aspect-ratio: 1; border-radius: 11px; object-fit: cover; }.photo-preview button { position: absolute; right: 4px; bottom: 4px; padding: 5px; border: 0; border-radius: 7px; color: #fff; background: rgba(23,35,31,.82); font-size: .62rem; }
.sales-list { display: grid; gap: 10px; margin-top: 16px; }.sale-card { display: grid; grid-template-columns: 72px 1fr; gap: 12px; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: var(--panel); text-align: left; }.sale-card img,.sale-thumb { width: 72px; height: 82px; border-radius: 11px; object-fit: cover; background: #ece8df; }.sale-thumb { display:grid;place-items:center; }.sale-card > span { display:grid;gap:4px;align-content:center; }.sale-card small { color:var(--muted); }.sale-card b { font-size:.82rem; }
.admin-row button { justify-self:start; padding:7px 9px; border:1px solid var(--line); border-radius:8px; background:#fff; }
@media (max-width: 460px) {
  .search-form { display: grid; }
  .search-form button { min-height: 49px; }
  .product-card { grid-template-columns: 92px 1fr; gap: 12px; }
  .product-image { width: 92px; height: 116px; }
  .form-grid { grid-template-columns: 1fr; }
  .app-header h1 { font-size: 1.8rem; }.header-actions { flex-direction: column; }.photo-actions { grid-template-columns: 1fr; }
}


/* ==========================================================
   AFFICHAGE COMPACT MOBILE - VENTES
   ========================================================== */

.sales-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.sale-card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--panel);
  text-align: left;
}

.sale-card img,
.sale-thumb {
  width: 62px;
  height: 68px;
  border-radius: 9px;
  object-fit: cover;
  background: #ece8df;
}

.sale-thumb {
  display: grid;
  place-items: center;
}

.sale-card > span {
  display: grid;
  min-width: 0;
  gap: 2px;
  align-content: center;
}

.sale-card strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: .88rem;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sale-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-card b {
  overflow: hidden;
  font-size: .76rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Recherche dans l'historique plus compacte */

.sales-list + * {
  margin-top: 8px;
}


/* ==========================================================
   TÉLÉPHONE
   ========================================================== */

@media (max-width: 460px) {

  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .app-header {
    padding-bottom: 16px;
  }

  .main-nav {
    margin-bottom: 12px;
  }

  .feedback {
    min-height: 12px;
  }

  .results-heading {
    margin-top: 2px;
  }

  .results-heading h2 {
    font-size: 1.05rem;
  }

  .sales-list {
    gap: 6px;
    margin-top: 10px;
  }

  .sale-card {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 8px;
    min-height: 66px;
    padding: 6px;
    border-radius: 11px;
  }

  .sale-card img,
  .sale-thumb {
    width: 58px;
    height: 62px;
    border-radius: 8px;
  }

  .sale-card strong {
    font-size: .82rem;
    line-height: 1.15;
  }

  .sale-card small {
    font-size: .64rem;
  }

  .sale-card b {
    font-size: .72rem;
  }
}


/* ==========================================================
   TRÈS PETITS ÉCRANS
   ========================================================== */

@media (max-width: 360px) {

  .app-shell {
    padding-left: 7px;
    padding-right: 7px;
  }

  .sale-card {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 7px;
  }

  .sale-card img,
  .sale-thumb {
    width: 52px;
    height: 58px;
  }

  .sale-card strong {
    font-size: .78rem;
  }

  .sale-card small {
    font-size: .61rem;
  }

  .sale-card b {
    font-size: .69rem;
  }
}


/* ==========================================================
   HISTORIQUE VENTES - MODE VRAIMENT COMPACT
   ========================================================== */

.sales-list {
  gap: 3px !important;
  margin-top: 8px !important;
}

.sale-card {
  grid-template-columns: 46px minmax(0, 1fr) !important;
  gap: 7px !important;

  min-height: 52px !important;
  padding: 4px !important;

  border-radius: 8px !important;
  box-shadow: none !important;
}

.sale-card img,
.sale-thumb {
  width: 46px !important;
  height: 46px !important;
  border-radius: 6px !important;
  object-fit: cover !important;
}

.sale-card > span {
  min-width: 0 !important;
  gap: 1px !important;
}

.sale-card strong {
  display: block !important;

  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;

  font-size: .78rem !important;
  line-height: 1.1 !important;
}

.sale-card small {
  display: block !important;

  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;

  font-size: .60rem !important;
  line-height: 1.1 !important;
}

.sale-card b {
  display: block !important;

  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;

  font-size: .68rem !important;
  line-height: 1.1 !important;
}


/* Réduction de l'espace autour de l'historique */

@media (max-width: 600px) {

  .app-shell {
    padding-left: 7px !important;
    padding-right: 7px !important;
    padding-top: max(10px, env(safe-area-inset-top)) !important;
  }

  .app-header {
    padding: 4px 0 10px !important;
  }

  .app-header h1 {
    font-size: 1.55rem !important;
  }

  .current-user {
    margin-top: 3px !important;
    font-size: .68rem !important;
  }

  .eyebrow {
    margin-bottom: 3px !important;
    font-size: .62rem !important;
  }

  .main-nav {
    gap: 3px !important;
    margin-bottom: 8px !important;
    padding: 3px !important;
  }

  .nav-button {
    min-height: 36px !important;
    padding: 4px 2px !important;
    font-size: .67rem !important;
  }

  .feedback {
    min-height: 5px !important;
    padding-top: 3px !important;
  }

  .feedback:empty {
    min-height: 3px !important;
  }

  .results-heading {
    margin: 2px 1px !important;
  }

  .results-heading h2 {
    font-size: .95rem !important;
  }

  .search-form {
    display: flex !important;
    gap: 5px !important;
  }

  .search-form input {
    padding: 9px 10px !important;
    border-radius: 9px !important;
    font-size: .78rem !important;
  }

  .search-form button {
    min-height: 38px !important;
    padding: 0 10px !important;
    border-radius: 9px !important;
    font-size: .72rem !important;
  }
}


/* Très petits téléphones */

@media (max-width: 360px) {

  .sale-card {
    grid-template-columns: 42px minmax(0, 1fr) !important;
  }

  .sale-card img,
  .sale-thumb {
    width: 42px !important;
    height: 42px !important;
  }
}


/* ==========================================================
   FILTRE ÉVÉNEMENT - HISTORIQUE DES VENTES
   ========================================================== */

#sales-search {
  display: grid;
  grid-template-columns: minmax(150px, .9fr) minmax(160px, 1.4fr) auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

#sales-search select,
#sales-search input {
  width: 100%;
  min-width: 0;
}

#sales-event {
  min-height: 40px;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: .78rem;
}

@media (max-width: 600px) {
  #sales-search {
    grid-template-columns: 1fr auto;
  }

  #sales-event {
    grid-column: 1 / -1;
    min-height: 38px;
    font-size: .75rem;
  }

  #sales-search input {
    min-height: 38px !important;
  }

  #sales-search button {
    min-height: 38px !important;
  }
}


/* ==========================================================
   CONTRÔLE DE TAILLE D'AFFICHAGE
   ========================================================== */

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.zoom-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.zoom-button:active {
  background: rgba(0, 0, 0, .08);
}

.zoom-button:disabled {
  opacity: .3;
}

.zoom-value {
  min-width: 38px;
  text-align: center;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
}

@media (max-width: 460px) {
  .header-actions {
    gap: 5px;
  }

  .zoom-controls {
    gap: 1px;
    padding: 2px;
  }

  .zoom-button {
    width: 28px;
    height: 28px;
    min-height: 28px;
  }

  .zoom-value {
    min-width: 34px;
    font-size: .62rem;
  }
}


/* ==========================================================
   MASQUAGE DES ÉLÉMENTS DÉSACTIVÉS
   Important notamment pour le panneau Face ID / empreinte
   ========================================================== */

[hidden] {
  display: none !important;
}

#passkey-activation[hidden] {
  display: none !important;
}

/* Masquer l'identité de l'utilisateur dans l'interface */
#current-user[hidden] {
  display: none !important;
}


/* ==========================================================
   RECHERCHE MAGENTO AVANCÉE
   ========================================================== */

.advanced-search-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.advanced-search-form .field-group {
  margin: 0;
  min-width: 0;
}

.advanced-search-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.advanced-search-form input,
.advanced-search-form select {
  width: 100%;
  box-sizing: border-box;
}

.search-price-row,
.search-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.advanced-search-form .money-input {
  width: 100%;
}

.advanced-search-form .primary-button,
.advanced-search-form .secondary-button {
  width: 100%;
}

@media (max-width: 390px) {
  .search-filter-row {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================
   RECHERCHE MAGENTO AVANCÉE
   ========================================================== */

.advanced-search-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.advanced-search-form .field-group {
  margin: 0;
  min-width: 0;
}

.advanced-search-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.advanced-search-form input,
.advanced-search-form select {
  width: 100%;
  box-sizing: border-box;
}

.search-price-row,
.search-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.advanced-search-form .money-input {
  width: 100%;
}

.advanced-search-form .primary-button,
.advanced-search-form .secondary-button {
  width: 100%;
}

@media (max-width: 390px) {
  .search-filter-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   ADMINISTRATION DES UTILISATEURS
   ========================================================== */

.admin-user-card {
  padding: 14px 0;
  border-bottom: 1px solid rgba(127, 127, 127, 0.22);
}

.admin-user-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-user-summary > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-user-summary strong,
.admin-user-summary span,
.admin-user-summary small {
  overflow-wrap: anywhere;
}

.admin-user-summary .admin-edit-user {
  width: auto;
  flex: 0 0 auto;
}

.admin-user-edit {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(127, 127, 127, 0.18);
}

.admin-user-edit[hidden] {
  display: none !important;
}

.admin-user-edit label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.admin-user-edit input,
.admin-user-edit select {
  width: 100%;
  box-sizing: border-box;
}

.admin-password-help {
  opacity: 0.7;
}

.admin-user-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-user-actions button {
  width: 100%;
}

@media (max-width: 390px) {
  .admin-user-summary {
    align-items: flex-start;
  }

  .admin-user-actions {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   RÉSUMÉ CHIFFRE D'AFFAIRES
   ========================================================== */

.sales-summary {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 10px;
  margin: 12px 0 16px;
}

.sales-summary > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(127, 127, 127, 0.08);
}

.sales-summary small {
  opacity: 0.7;
}

.sales-summary strong {
  font-size: 1.25em;
  line-height: 1.15;
}

@media (max-width: 390px) {
  .sales-summary {
    grid-template-columns: 1fr 1.4fr;
  }

  .sales-summary > div {
    padding: 11px;
  }

  .sales-summary strong {
    font-size: 1.1em;
  }
}


/* ==========================================================
   THÈME ORANGE / TERRACOTTA
   ========================================================== */

:root {
  --orange-main: #e87532;
  --orange-dark: #bf5522;
  --orange-deep: #8f3e1d;
  --orange-soft: #fff1e7;
  --orange-pale: #fff8f3;

  --text-main: #302a27;
  --text-soft: #756861;

  --ui-shadow:
    0 10px 28px rgba(116, 60, 29, 0.12),
    0 3px 8px rgba(0, 0, 0, 0.05);

  --ui-shadow-hover:
    0 16px 36px rgba(116, 60, 29, 0.17),
    0 5px 12px rgba(0, 0, 0, 0.06);
}


/* ----- FOND GÉNÉRAL ----- */

body {
  color: var(--text-main);
  background:
    linear-gradient(
      180deg,
      var(--orange-pale) 0,
      #ffffff 260px
    );
}


/* ----- TITRES ----- */

h1,
h2,
h3 {
  color: var(--text-main);
}

.section-kicker,
.product-sku {
  color: var(--orange-dark);
}


/* ----- BOUTON PRINCIPAL ----- */

.primary-button,
.select-button {
  background: linear-gradient(
    135deg,
    var(--orange-main),
    var(--orange-dark)
  ) !important;

  color: white !important;
  border-color: transparent !important;

  box-shadow:
    0 7px 18px rgba(210, 95, 40, 0.25) !important;
}


/* ----- BOUTONS SECONDAIRES ----- */

.secondary-button,
.back-button {
  color: var(--orange-dark);
  border-color: rgba(210, 95, 40, 0.25);
}


/* ----- FOCUS DES CHAMPS ----- */

input:focus,
select:focus,
textarea:focus {
  border-color: var(--orange-main) !important;

  box-shadow:
    0 0 0 3px rgba(232, 117, 50, 0.14),
    0 5px 15px rgba(116, 60, 29, 0.08) !important;
}


/* ----- CARTES ----- */

.product-card,
.sale-card,
.detail-card,
.confirmation-panel,
.admin-form,
.admin-user-card {
  border-color: rgba(232, 117, 50, 0.10);
}


/* ----- CARTES AU SURVOL ----- */

@media (hover: hover) {
  .product-card:hover,
  .sale-card:hover {
    border-color: rgba(232, 117, 50, 0.28);
  }
}


/* ----- CHIFFRE D'AFFAIRES ----- */

.sales-summary > div {
  background:
    linear-gradient(
      145deg,
      #ffffff,
      var(--orange-soft)
    ) !important;

  border: 1px solid rgba(232, 117, 50, 0.12);
}

.sales-summary > div:last-child strong {
  color: var(--orange-dark);
}


/* ----- FILTRE ÉVÉNEMENT ----- */

.sales-event-filter select {
  background-color: #fff;
  border-color: rgba(232, 117, 50, 0.22);
}


/* ----- DISPONIBILITÉ ----- */

.available {
  color: #398052;
}

.unavailable {
  color: var(--orange-dark);
}


/* ----- CONFIRMATION VENTE ----- */

.confirmation-icon {
  background: var(--orange-soft);
  color: var(--orange-dark);
  box-shadow:
    0 8px 20px rgba(210, 95, 40, 0.16);
}


/* ----- NAVIGATION / ACTIONS ----- */

nav button,
.app-nav button {
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 140ms ease;
}

nav button:hover,
.app-nav button:hover {
  background: var(--orange-soft);
}


/* ----- SÉLECTION ----- */

::selection {
  background: var(--orange-main);
  color: white;
}


/* ==========================================================
   LOGO MARSEILLE ANTIQUITÉS EN HAUT DE L'APPLICATION
   ========================================================== */

.app-brand-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px auto 14px;
  padding: 4px 12px;
}

.app-brand-logo img {
  display: block;
  width: min(210px, 62vw);
  height: auto;
  max-height: 90px;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(74, 39, 15, 0.16));
  animation: appBrandAppear 0.45s ease-out;
}

@keyframes appBrandAppear {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================================
   LOGO MARSEILLE ANTIQUITÉS EN FILIGRANE
   ========================================================== */

/* L'ancien bloc logo n'occupe plus aucune place */
.app-brand-logo {
  display: none !important;
}

/* L'en-tête devient le support du filigrane */
.app-header {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Logo en arrière-plan */
.app-header::before {
  content: "";
  position: absolute;

  width: 150px;
  height: 150px;

  right: 10px;
  top: 50%;
  transform: translateY(-50%);

  background-image: url("/icons/logo-source.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;

  opacity: 0.10;

  pointer-events: none;
  z-index: -1;
}

/* Le contenu reste parfaitement lisible */
.app-header > * {
  position: relative;
  z-index: 1;
}

@media (max-width: 600px) {
  .app-header::before {
    width: 125px;
    height: 125px;
    right: 5px;
    opacity: 0.09;
  }
}

/* ==========================================================
   LOGO CENTRAL EN FILIGRANE
   ========================================================== */

.app-header::before {
  width: 145px !important;
  height: 145px !important;

  left: 50% !important;
  right: auto !important;
  top: 50% !important;

  transform: translate(-50%, -50%) !important;

  background-image: url("/icons/logo-source.png") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;

  opacity: 0.24 !important;

  pointer-events: none !important;
}

@media (max-width: 600px) {
  .app-header::before {
    width: 125px !important;
    height: 125px !important;
    left: 50% !important;
    right: auto !important;
    opacity: 0.24 !important;
  }
}

/* ==========================================================
   MODE APPLICATION PLEIN ÉCRAN
   ========================================================== */

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;

  /* zones protégées iPhone */
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  box-sizing: border-box;
}

/* En mode PWA installée */
@media (display-mode: standalone),
       (display-mode: fullscreen) {

  html,
  body {
    width: 100%;
    min-height: 100dvh;
  }
}


/* ==========================================================
   ADMIN DELETE USER BUTTON
   ========================================================== */

.danger-button {
  appearance: none;
  border: 1px solid rgba(170, 55, 30, 0.22);
  border-radius: 16px;

  padding: 10px 14px;

  font: inherit;
  font-weight: 700;

  color: #a43c25;

  background:
    linear-gradient(
      145deg,
      rgba(255, 245, 238, 0.96),
      rgba(255, 225, 210, 0.92)
    );

  box-shadow:
    0 6px 16px rgba(100, 45, 25, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.8);

  cursor: pointer;

  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease;
}

.danger-button:active {
  transform: scale(0.96);

  box-shadow:
    0 3px 8px rgba(100, 45, 25, 0.12);
}

.danger-button:disabled {
  opacity: 0.45;
  cursor: wait;
}



/* ==========================================================
   ADMINISTRATION MOBILE - VERSION PROPRE
   ========================================================== */

.admin-clean {
  display: grid;
  gap: 18px;
  padding: 14px;
  overflow: hidden;
}

.admin-heading {
  padding: 4px 2px 8px;
}

.admin-heading h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.admin-heading p {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
}

.admin-section {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8f5ee;
}

.admin-section > h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.admin-clean .admin-form {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  background: transparent;
}

.admin-clean input,
.admin-clean select {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #cbc7bc;
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 16px;
}

.admin-primary-button {
  min-height: 46px;
  padding: 10px 14px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--ink);
  font: inherit;
  font-weight: 800;
}

.admin-items {
  display: grid;
  gap: 9px;
}

.admin-item,
.admin-user-card {
  box-sizing: border-box;
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.admin-item-info,
.admin-user-main {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.admin-item strong,
.admin-user-main strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: .92rem;
}

.admin-item small,
.admin-user-main small {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: .75rem;
}

.admin-user-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
}

.admin-role,
.admin-status,
.admin-me {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: .67rem;
  font-weight: 800;
}

.admin-role {
  color: var(--ink);
  background: #eeeae1;
}

.admin-status.is-active {
  color: #27633d;
  background: #e5f3e9;
}

.admin-status.is-inactive {
  color: #87532d;
  background: #f8e9dc;
}

.admin-me {
  margin-left: 5px;
  color: #fff;
  background: var(--ink);
  vertical-align: middle;
}

.admin-user-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.admin-small-button,
.admin-clean .danger-button {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
}

.admin-small-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.admin-clean .danger-button {
  border: 1px solid #e1b4aa;
  color: #9b3425;
  background: #fff3ef;
  box-shadow: none;
}

.admin-small-button:disabled,
.admin-clean .danger-button:disabled {
  opacity: .45;
}

.admin-self-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.35;
}

.admin-empty {
  padding: 15px;
  border-radius: 11px;
  color: var(--muted);
  background: #fff;
  font-size: .8rem;
  text-align: center;
}

@media (max-width: 460px) {
  .admin-panel.admin-clean {
    padding: 10px;
    border-radius: 16px;
  }

  .admin-section {
    padding: 11px;
  }

  .admin-user-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 350px) {
  .admin-user-actions {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================
   PASSWORD GENERATOR USER
   ========================================================== */

.generated-password-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.generated-password-field > label {
  color: var(--ink);
  font-size: .76rem;
  font-weight: 800;
}

.password-generator-row {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    auto
    auto;
  gap: 7px;
  align-items: stretch;
}

.password-generator-row input {
  min-width: 0;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;
  font-size: 15px;
  letter-spacing: .02em;
}

.password-action-button {
  width: auto !important;
  min-width: 82px;
  white-space: nowrap;
}

.password-help {
  display: block;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.4;
}


/*
 * Sur téléphone, le mot de passe occupe toute la largeur
 * et les deux actions restent côte à côte.
 */
@media (max-width: 520px) {

  .password-generator-row {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr);
  }

  .password-generator-row input {
    grid-column: 1 / -1;
    width: 100%;
  }

  .password-action-button {
    width: 100% !important;
    min-width: 0;
  }
}


/* ==========================================================
   CREATION UTILISATEUR - MOT DE PASSE
   ========================================================== */

.password-generator-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.password-input-wrapper {
  position: relative;
  min-width: 0;
  width: 100%;
}

.password-input-wrapper input {
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  padding-right: 50px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1rem;
}

.password-visibility-button {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.password-visibility-button:active {
  background: rgba(0, 0, 0, .08);
}

.password-action-button {
  min-height: 46px;
  white-space: nowrap;
}

.generated-password-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

@media (max-width: 600px) {
  .password-generator-row {
    grid-template-columns: minmax(0, 1fr) 1fr 1fr;
  }

  .password-input-wrapper {
    grid-column: 1 / -1;
  }

  .password-action-button {
    width: 100%;
  }
}
