/* ================= MOBILE (chargé après styles.css) ================= */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.grid > *, .view > *, .shop-layout > * { min-width: 0; }
.view { grid-template-columns: minmax(0, 1fr); }
.view > .charts { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.view > .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.int-name, .int-meta, .int-key, .code, td { overflow-wrap: anywhere; }
button, a, .op-pick { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.modal { max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; }
.sidebar { height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
.toast { width: max-content; max-width: calc(100vw - 32px); text-align: center; pointer-events: none; }

/* Pas d'effet de survol « collé » au doigt */
@media (hover: none) { .btn:hover, .fcard:hover { transform: none; box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .modal { animation: none !important; } }

@media (max-width: 880px) {
  .sidebar { width: min(280px, 84vw); visibility: hidden; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .admin-body.sb-open .sidebar { visibility: visible; }
  body.sb-open { overflow: hidden; }
  .icon-btn { width: 44px; height: 44px; flex-shrink: 0; }
  .sb-link { min-height: 46px; }
  .view > .charts, .view > .two-col { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  /* Forfaits directement ; le guide reste sous la liste */
  .shop-layout { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding-top: 20px; }
  .shop-aside { display: contents; }
  .shop-aside > :not(.guide), .shop-sub { display: none; }
  .shop-head { margin-bottom: 18px; }
  .shop-main { order: 1; }
  .guide { order: 2; margin-top: 6px; }
}

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

@media (max-width: 640px) {
  .container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .nav-inner { height: 60px; gap: 8px; }
  .nav .brand { font-size: 17px; gap: 8px; white-space: nowrap; }
  .nav-actions { gap: 6px; }
  .nav-actions .btn { padding: 0 10px; font-size: 13px; white-space: nowrap; }
  .btn, .period-btn, .code-box .copy { min-height: 44px; }
  .field input, .field select { font-size: 16px; min-height: 48px; } /* 16px : pas de zoom automatique sur iPhone */
  .footer { padding: 32px 0 calc(24px + env(safe-area-inset-bottom)); }

  .shop-head { flex-wrap: wrap; gap: 8px; }
  .plan-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 10px; }
  .fcard { padding: 14px; }
  .fcard-name { font-size: 15.5px; }
  .fcard-dur { flex-wrap: wrap; }
  .fcard-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .fcard-cta { text-align: center; padding: 10px; }

  /* Fenêtres en bas d'écran */
  .modal-bg { padding: 0; place-items: end stretch; }
  .modal { max-width: none; border-radius: 20px 20px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 92vh; max-height: 92dvh; animation-name: sheet; }
  .op-pick { padding: 14px 8px; }
  .login-card { padding: 24px 18px; }
  .auth-wrap { min-height: 60vh; }
  .toast { bottom: calc(20px + env(safe-area-inset-bottom)); }

  .topbar { padding: 10px 14px; gap: 12px; }
  .page-title { font-size: 19px; }
  .page-sub { font-size: 12px; }
  .admin-content { padding: 16px 14px calc(40px + env(safe-area-inset-bottom)); }
  .panel { padding: 16px; }
  .section-title { margin-top: 16px; }
  .section-sub { margin-bottom: 4px; }
  .view > .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 0; }
  .kpi { padding: 14px; }
  .kpi .label { font-size: 12px; }
  .kpi .ic { width: 28px; height: 28px; font-size: 13px; flex-shrink: 0; }
  .kpi .val { font-size: clamp(16px, 5.2vw, 22px); letter-spacing: -.5px; }
  .period-bar { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 0 14px 4px; scrollbar-width: none; }
  .period-btn { flex-shrink: 0; }
  .int-head { align-items: flex-start; }
  .int-name { display: block; min-width: 0; }
  .int-actions { flex-wrap: wrap; }
  .int-actions .btn { flex: 1 1 130px; justify-content: center; }

  /* Tableaux en fiches : une ligne « libellé — valeur » par cellule */
  .table-wrap:has(table.cards) { background: none; border: 0; border-radius: 0; }
  table.cards, table.cards tbody, table.cards tfoot, table.cards tr { display: block; width: 100%; }
  table.cards thead { display: none; }
  table.cards tr { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 13px; padding: 6px 14px; margin-bottom: 10px; }
  table.cards td { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; text-align: right; border-top: 0; border-bottom: 1px solid rgba(36,48,72,.5); background: none; white-space: normal !important; }
  table.cards td:last-child { border-bottom: 0; }
  table.cards td:empty { display: none; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font: 500 12px 'Inter', system-ui, sans-serif; flex-shrink: 0; text-align: left; }
}

@media (max-width: 380px) {
  .step:not(.active) .lbl { display: none; }
  .nav .brand-logo { width: 26px; height: 26px; }
  .nav .brand { font-size: 15px; gap: 6px; }
  .nav-actions .btn { padding: 0 8px; font-size: 12px; }
}
