/* ==================================================================
   Mise en page du Comptoir Ardent
   ================================================================== */

.app { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100vh; }

.wrap { width: min(1240px, 100% - 32px); margin-inline: auto; }

/* --- En-tête --------------------------------------------------------- */

.site-header {
  background: linear-gradient(180deg, rgba(19, 16, 23, 0.97), rgba(8, 6, 10, 0.93));
  border-bottom: 2px solid var(--border);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 0;
}

.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }

/* L'emblème porte lui-même son cadre : le conteneur ne fait que le dimensionner
   et entretenir la lueur de braise autour. */
.brand__crest {
  width: 54px;
  height: 54px;
  display: block;
  flex: none;
  animation: crest-pulse 3.6s ease-in-out infinite;
}

/* Un logo pas tout à fait carré remplit quand même le cadre, sans être déformé. */
.brand__crest img,
.login-card__crest img { display: block; width: 100%; height: 100%; object-fit: cover; }

@keyframes crest-pulse {
  0%, 100% { box-shadow: 0 0 13px rgba(255, 122, 24, 0.28); }
  50%      { box-shadow: 0 0 26px rgba(255, 122, 24, 0.5); }
}

.brand__name { font-family: var(--font-pixel); font-size: 1.28rem; line-height: 1.15; margin: 0; }
.brand__tag {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin: 2px 0 0;
  max-width: 46ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-header__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.cart-btn { position: relative; }
.cart-btn__count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  background: var(--ember-400);
  color: #1a0d02;
  font-family: var(--font-pixel);
  font-size: 0.68rem;
  border: 2px solid var(--edge-dark);
  border-radius: 11px;
}

/* --- Navigation ------------------------------------------------------ */

.site-nav { background: rgba(8, 6, 10, 0.85); border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 35; }
.site-nav__inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; }

.nav-link {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--text-soft);
  padding: 13px 15px;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.nav-link:hover { color: var(--ember-200); background: rgba(255, 122, 24, 0.08); text-decoration: none; }
.nav-link.is-active { color: var(--ember-200); border-bottom-color: var(--ember-400); background: rgba(255, 122, 24, 0.1); }
.nav-link__pill {
  background: var(--ember-500);
  color: #1a0d02;
  border-radius: 9px;
  padding: 0 6px;
  font-size: 0.66rem;
  min-width: 18px;
  text-align: center;
}

/* --- Contenu --------------------------------------------------------- */

.site-main { flex: 1; padding: 26px 0 56px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1, .page-head h2 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-soft); font-size: 0.9rem; }

.section { margin-bottom: 26px; }

/* --- Bannière d'accueil ---------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 30px;
  margin-bottom: 24px;
  border: 2px solid var(--ember-600);
  background:
    radial-gradient(ellipse 70% 130% at 15% 110%, rgba(239, 90, 9, 0.4), transparent 60%),
    radial-gradient(ellipse 60% 120% at 88% 115%, rgba(160, 35, 5, 0.35), transparent 60%),
    linear-gradient(150deg, var(--ash-800), var(--ash-850));
  box-shadow: inset 2px 2px 0 rgba(255, 160, 40, 0.2), inset -2px -2px 0 var(--edge-dark), var(--shadow-panel);
}

.hero h1 { margin-bottom: 8px; }
.hero__motd { color: var(--text-soft); max-width: 74ch; margin: 0; }

/* --- Filtres --------------------------------------------------------- */

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters .mc-field { min-width: 180px; }
.filters .mc-field--grow { flex: 1 1 260px; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }

.chip {
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  padding: 6px 12px;
  background: var(--ash-750);
  border: 2px solid var(--border);
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip:hover { border-color: var(--ember-500); color: var(--ember-200); }
.chip.is-active { background: linear-gradient(180deg, var(--ember-400), var(--ember-600)); border-color: var(--ember-600); color: #1a0d02; }

/* --- Grille boutique -------------------------------------------------- */

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 15px; }

.card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 15px;
  background: linear-gradient(170deg, var(--ash-750), var(--ash-850));
  border: 2px solid var(--border);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.06), inset -2px -2px 0 var(--edge-dark);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  position: relative;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--ember-500);
  box-shadow: inset 2px 2px 0 rgba(255, 160, 40, 0.18), inset -2px -2px 0 var(--edge-dark), 0 8px 26px rgba(255, 122, 24, 0.2);
}

.card.is-out { opacity: 0.62; }
.card.is-out::after {
  content: 'RUPTURE';
  position: absolute;
  top: 12px;
  right: -30px;
  transform: rotate(38deg);
  background: var(--danger-600);
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  padding: 3px 34px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.card__top { display: flex; gap: 12px; align-items: flex-start; }
.card__name { font-family: var(--font-pixel); font-size: 0.94rem; margin: 0 0 4px; line-height: 1.35; }
.card__cat { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.card__desc { font-size: 0.83rem; color: var(--text-soft); margin: 0; flex: 1; }

.card__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-family: var(--font-pixel); font-size: 1.14rem; color: var(--ember-200); text-shadow: 0 0 12px rgba(255, 160, 40, 0.35); white-space: nowrap; }
.price small { font-size: 0.62rem; color: var(--text-dim); display: block; text-shadow: none; }

.stock-line { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; color: var(--text-soft); }
.card__buy { display: flex; gap: 8px; align-items: center; }
.card__buy .mc-input { width: 74px; text-align: center; }

/* --- Panier (tiroir latéral) ------------------------------------------ */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(3px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 100%);
  background: var(--ash-850);
  border-left: 2px solid var(--ember-600);
  box-shadow: -14px 0 40px rgba(0, 0, 0, 0.65);
  z-index: 61;
  transform: translateX(102%);
  transition: transform 0.24s ease;
  display: flex;
  flex-direction: column;
}

.drawer.is-open { transform: translateX(0); }
.drawer__head { padding: 16px; border-bottom: 2px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--ash-700); }
.drawer__head h2 { margin: 0; font-size: 1.05rem; }
.drawer__body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 11px; }
.drawer__foot { padding: 16px; border-top: 2px solid var(--border); background: var(--ash-800); display: flex; flex-direction: column; gap: 11px; }

.cart-line { display: flex; align-items: center; gap: 11px; padding: 9px; background: var(--ash-800); border: 1px solid var(--border); }
.cart-line__body { flex: 1; min-width: 0; }
.cart-line__name { font-size: 0.86rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-line__sub { font-size: 0.74rem; color: var(--text-dim); }
.cart-line__qty { display: flex; align-items: center; gap: 5px; }
.cart-line__qty .mc-input { width: 58px; text-align: center; padding: 5px; }

.total-row { display: flex; align-items: baseline; justify-content: space-between; font-family: var(--font-pixel); }
.total-row--big { font-size: 1.28rem; color: var(--ember-200); }

/* --- Modale ----------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(4px);
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
}

.modal {
  width: min(660px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--ash-800);
  border: 2px solid var(--ember-600);
  box-shadow: inset 2px 2px 0 rgba(255, 160, 40, 0.22), inset -2px -2px 0 var(--edge-dark), 0 22px 60px rgba(0, 0, 0, 0.7);
  animation: modal-in 0.16s ease-out;
}

.modal--wide { width: min(880px, 100%); }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.modal__head { padding: 14px 18px; background: linear-gradient(180deg, var(--ash-700), var(--ash-750)); border-bottom: 2px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 2; }
.modal__head h2 { margin: 0; font-size: 1.02rem; }
.modal__body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal__foot { padding: 14px 18px; border-top: 2px solid var(--border); background: var(--ash-850); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: 0; }

.icon-close { background: none; border: none; color: var(--text-soft); font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 4px 8px; }
.icon-close:hover { color: var(--ember-300); }

/* --- Grilles de formulaire -------------------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.form-grid--2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.span-all { grid-column: 1 / -1; }

/* --- Sélecteur d'icône ------------------------------------------------- */

.icon-picker { display: flex; gap: 12px; align-items: flex-start; }
.icon-picker__preview { flex: none; }
.icon-picker__grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 5px;
  max-height: 172px;
  overflow-y: auto;
  padding: 7px;
  background: var(--ash-900);
  border: 2px solid var(--border);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.55);
}

.icon-opt { background: var(--ash-750); border: 2px solid transparent; padding: 5px; cursor: pointer; display: grid; place-items: center; }
.icon-opt:hover { border-color: var(--ember-500); }
.icon-opt.is-active { border-color: var(--ember-300); background: rgba(255, 122, 24, 0.2); }

/* --- Tableau de bord ---------------------------------------------------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 13px; margin-bottom: 22px; }

.stat {
  padding: 14px;
  background: linear-gradient(165deg, var(--ash-750), var(--ash-850));
  border: 2px solid var(--border);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.05), inset -2px -2px 0 var(--edge-dark);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat--hot { border-color: var(--ember-600); box-shadow: inset 2px 2px 0 rgba(255, 160, 40, 0.2), inset -2px -2px 0 var(--edge-dark), 0 0 18px rgba(255, 122, 24, 0.18); }
.stat__label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-dim); }
.stat__value { font-family: var(--font-pixel); font-size: 1.5rem; color: var(--ember-200); line-height: 1.2; }
.stat__value--sm { font-size: 1.1rem; }
.stat__sub { font-size: 0.74rem; color: var(--text-soft); }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

/* --- Mini graphique en barres -------------------------------------------- */

.spark { display: flex; align-items: flex-end; gap: 4px; height: 128px; padding-top: 8px; }
.spark__bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; min-width: 0; }
.spark__fill {
  width: 100%;
  min-height: 3px;
  background: linear-gradient(180deg, var(--ember-200), var(--lava-700));
  border: 1px solid var(--edge-dark);
  transition: height 0.3s ease;
}
.spark__bar:hover .spark__fill { filter: brightness(1.3); }
.spark__label { font-size: 0.6rem; color: var(--text-dim); white-space: nowrap; }

/* --- Listes compactes ----------------------------------------------------- */

.list { display: flex; flex-direction: column; gap: 8px; }
.list__row { display: flex; align-items: center; gap: 11px; padding: 9px; background: var(--ash-850); border: 1px solid var(--border); }
.list__body { flex: 1; min-width: 0; }
.list__title { font-size: 0.87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__sub { font-size: 0.73rem; color: var(--text-dim); }
.list__right { text-align: right; white-space: nowrap; font-family: var(--font-pixel); font-size: 0.8rem; }

/* --- États vides ---------------------------------------------------------- */

.empty { text-align: center; padding: 46px 18px; color: var(--text-dim); }
.empty__icon { font-size: 2.6rem; margin-bottom: 10px; opacity: 0.55; }
.empty h3 { color: var(--text-soft); }

/* --- Notifications --------------------------------------------------------- */

.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 90; display: flex; flex-direction: column; gap: 9px; max-width: min(400px, calc(100vw - 36px)); }

.toast {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--ash-750);
  border: 2px solid var(--border);
  border-left-width: 5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  animation: toast-in 0.2s ease-out;
  font-size: 0.87rem;
}

.toast--success { border-left-color: var(--ok-400); }
.toast--error   { border-left-color: var(--danger-400); }
.toast--info    { border-left-color: var(--ember-400); }
.toast--warn    { border-left-color: var(--warn-400); }
.toast.is-leaving { animation: toast-out 0.2s ease-in forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }

/* --- Connexion ------------------------------------------------------------- */

.login-shell { display: grid; place-items: center; min-height: 62vh; padding: 18px; }
.login-card { width: min(430px, 100%); text-align: center; }
.login-card .mc-field { text-align: left; }
.login-card__crest {
  width: 78px;
  height: 78px;
  margin: 0 auto 14px;
  display: block;
  box-shadow: 0 0 26px rgba(255, 122, 24, 0.35);
}

/* --- Facture --------------------------------------------------------------- */

.invoice-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.invoice-meta { font-size: 0.86rem; color: var(--text-soft); }
.invoice-meta strong { color: var(--text); }
.invoice-total { margin-top: 14px; margin-left: auto; width: min(320px, 100%); display: flex; flex-direction: column; gap: 6px; }
.invoice-total .total-row { font-size: 0.9rem; }

.stamp {
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  padding: 7px 16px;
  border: 3px solid currentColor;
  transform: rotate(-7deg);
  display: inline-block;
}

.stamp--paid { color: var(--ok-400); }
.stamp--due { color: var(--warn-400); }
.stamp--void { color: var(--danger-400); }

/* --- Pied de page ----------------------------------------------------------- */

.site-footer {
  border-top: 2px solid var(--border);
  background: rgba(8, 6, 10, 0.9);
  padding: 22px 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.site-footer__inner { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: center; }

/* --- Utilitaires -------------------------------------------------------------- */

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--text-dim); }
.soft { color: var(--text-soft); }
.tiny { font-size: 0.76rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.hidden { display: none !important; }
.pos { color: var(--ok-400); }
.neg { color: var(--danger-400); }
.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--ember-300);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================================================================
   Finitions visuelles
   ================================================================== */

/* La grille de fond était trop serrée : elle vibrait derrière le texte. */
body::before { background-size: 46px 46px, 46px 46px, 100% 100%, 100% 100%; }

/* Un peu plus de contraste sur les textes secondaires, qui viraient au gris. */
.soft, .invoice-meta { color: #d2c3b4; }
.muted { color: #a3907f; }
.mc-hint, .list__sub, .card__cat { color: #a3907f; }

/* Barres de défilement assorties, plutôt que les grises du navigateur. */
.mc-table-wrap, .icon-picker__grid, .drawer__body, .modal, .site-nav__inner, .mc-textarea {
  scrollbar-width: thin;
  scrollbar-color: var(--ash-500) transparent;
}
.mc-table-wrap::-webkit-scrollbar,
.icon-picker__grid::-webkit-scrollbar,
.drawer__body::-webkit-scrollbar,
.modal::-webkit-scrollbar { width: 10px; height: 10px; }
.mc-table-wrap::-webkit-scrollbar-track,
.icon-picker__grid::-webkit-scrollbar-track,
.drawer__body::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.35); }
.mc-table-wrap::-webkit-scrollbar-thumb,
.icon-picker__grid::-webkit-scrollbar-thumb,
.drawer__body::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb { background: var(--ash-500); border-radius: 2px; }

/* Repère clair au clavier, sur tout ce qui est actionnable. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ember-200);
  outline-offset: 2px;
}

/* Les en-têtes de panneau gagnent un filet de braise. */
.mc-panel__head { box-shadow: inset 0 -3px 0 -1px rgba(255, 122, 24, 0.28); }

/* Cartes de la boutique : survol plus franc, prix mieux posé. */
.card:hover { transform: translateY(-4px); }
.card__name { letter-spacing: 0.02em; }
.price { line-height: 1.25; }

/* Un mot trop long — « CONSTRUCTION », un pseudo à rallonge — ne doit jamais
   pousser la mise en page au-delà de l'écran : on le coupe. */
.card__name, .card__cat, .card__desc,
.list__title, .list__sub,
.mc-table td, .mc-table th { overflow-wrap: anywhere; }

/* Tableaux : une ligne sur deux légèrement teintée, plus facile à suivre. */
.mc-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.022); }
.mc-table tbody tr:hover { background: rgba(255, 122, 24, 0.09); }

/* Pastilles un peu plus lisibles. */
.badge { padding: 4px 9px; border-radius: 2px; }

/* États vides moins tristes. */
.empty { padding: 40px 18px; }
.empty__icon { opacity: 0.7; }

/* ==================================================================
   Écrans étroits
   ================================================================== */

/* --- Tablettes et petites fenêtres ------------------------------------------- */

@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
  .modal--wide { width: min(680px, 100%); }
}

/* --- Téléphones --------------------------------------------------------------- */

@media (max-width: 760px) {
  /* Aucune grille ne doit imposer une largeur minimale supérieure à l'écran :
     c'est ce qui provoquait un débordement horizontal de la page. */
  .form-grid,
  .form-grid--2,
  .two-col { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filters { gap: 10px; }
  .filters .mc-field,
  .filters .mc-field--grow { min-width: 0; flex: 1 1 100%; }
  .mc-panel, .card, .stat, .list__row, .modal, .row > * { min-width: 0; }

  .wrap { width: calc(100% - 20px); }

  /* --- En-tête et navigation --- */
  .site-header__inner { padding: 10px 0; gap: 10px; }
  .brand__tag { display: none; }
  .brand__crest { width: 42px; height: 42px; }
  .brand__name { font-size: 1rem; }
  .site-header__actions { gap: 8px; }

  .site-nav__inner {
    gap: 2px;
    padding-inline: 2px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .site-nav__inner::-webkit-scrollbar { height: 3px; }
  .site-nav__inner::-webkit-scrollbar-thumb { background: var(--ember-600); }
  .nav-link { padding: 14px 14px; font-size: 0.82rem; scroll-snap-align: center; }

  /* --- Cibles tactiles : 44px est le minimum confortable au doigt --- */
  .mc-btn { min-height: 44px; padding: 12px 16px; font-size: 0.84rem; }
  .mc-btn--sm { min-height: 40px; padding: 9px 12px; font-size: 0.78rem; }
  .chip { min-height: 40px; padding: 9px 14px; font-size: 0.76rem; }
  .icon-close { min-width: 44px; min-height: 44px; font-size: 1.6rem; }
  .mc-check { padding: 4px 0; }
  .mc-check input { width: 22px; height: 22px; flex: none; }

  /* 16px sur les champs : en dessous, iOS zoome tout seul à la saisie. */
  .mc-input, .mc-select, .mc-textarea {
    font-size: 16px;
    min-height: 46px;
    padding: 11px 12px;
  }
  .mc-select { background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%; }
  .mc-textarea { min-height: 96px; }

  /* --- Lisibilité : plus rien en dessous de 12px --- */
  .tiny, .mc-hint, .card__cat, .list__sub, .stat__sub, .spark__label { font-size: 0.8rem; }
  .mc-label { font-size: 0.78rem; }
  .badge, .cart-btn__count { font-size: 0.78rem; }
  .stat__label { font-size: 0.76rem; }
  .mc-table thead th { font-size: 0.76rem; }
  .cart-btn__count { min-width: 23px; height: 23px; border-radius: 12px; }
  .site-footer { font-size: 0.85rem; text-align: center; }
  .site-footer__inner { justify-content: center; }

  /* --- Bannière et titres --- */
  .hero { padding: 18px; }
  .hero__motd { font-size: 0.95rem; }
  .page-head { gap: 12px; }
  .page-head .row { width: 100%; }
  .page-head .row .mc-btn { flex: 1 1 auto; justify-content: center; }

  /* --- Panneaux --- */
  .mc-panel { padding: 14px; }
  .mc-panel__head { margin: -14px -14px 13px; padding: 12px 14px; }

  /* --- Boutique --- */
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card { padding: 11px; gap: 9px; }
  .card__desc { display: none; }
  .card__buy .mc-input { width: 62px; padding: 8px 4px; }
  .card.is-out::after { font-size: 0.58rem; padding: 3px 30px; }

  /* --- Tableaux de la forge : la première colonne reste visible pendant
         qu'on fait défiler le reste horizontalement. --- */
  .mc-table { min-width: 560px; font-size: 0.88rem; }
  .mc-table thead th { padding: 10px 10px; font-size: 0.72rem; }
  .mc-table tbody td { padding: 12px 10px; }
  .mc-table thead th:first-child,
  .mc-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--ash-850);
    box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.7);
  }
  .mc-table thead th:first-child { background: var(--ash-700); z-index: 3; }
  .mc-table tbody tr:nth-child(even) td:first-child { background: #17131c; }
  .mc-table .actions .row { flex-wrap: nowrap; gap: 6px; }

  /* --- Tuiles de statistiques --- */
  .stat { padding: 12px; }
  .stat__value { font-size: 1.2rem; }
  .spark { height: 108px; }

  /* --- Panier : pleine largeur --- */
  .drawer { width: 100%; border-left: none; }
  .drawer__head, .drawer__body, .drawer__foot { padding: 14px; }
  .cart-line__qty .mc-input { width: 58px; }

  /* --- Modales : en feuille remontant du bas, comme sur mobile en général --- */
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal, .modal--wide {
    width: 100%;
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    border-width: 2px 0 0;
    animation: modal-sheet 0.22s ease-out;
  }
  .modal__head { padding: 14px; }
  .modal__body { padding: 14px; gap: 13px; }
  .modal__foot { padding: 12px 14px; flex-direction: column-reverse; gap: 8px; }
  .modal__foot .mc-btn { width: 100%; }
  .modal__foot .mc-input { width: 100%; }

  /* --- Sélecteur d'icône : l'aperçu passe au-dessus de la grille --- */
  .icon-picker { flex-direction: column; }
  .icon-picker__preview { flex-direction: row !important; width: 100% !important; align-items: center; }
  .icon-picker__grid { max-height: 190px; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }

  /* --- Facture --- */
  .invoice-head { gap: 12px; }
  .invoice-head > div:last-child { text-align: left !important; }
  .invoice-total { width: 100%; margin-left: 0; }

  /* --- Connexion --- */
  .login-shell { min-height: 0; padding: 24px 0; }
  .login-card__crest { width: 66px; height: 66px; }

  /* --- Notifications : sur toute la largeur, au-dessus du pouce --- */
  .toasts { left: 10px; right: 10px; bottom: 10px; max-width: none; }
}

@keyframes modal-sheet {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}

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

@media (max-width: 400px) {
  .wrap { width: calc(100% - 16px); }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .card { padding: 9px; }
  .card__top { gap: 9px; }
  .card__name { font-size: 0.84rem; }
  .card__cat { letter-spacing: 0.02em; }
  .price { font-size: 1rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat__value { font-size: 1.08rem; }
  .brand__name { font-size: 0.92rem; }
  .site-header__actions .mc-btn { padding: 10px 11px; }
  .hero { padding: 15px; }
  .mc-panel { padding: 12px; }
  .mc-panel__head { margin: -12px -12px 11px; padding: 11px 12px; }
}
