/* ============================================================
   RESPONSIVO — camada mobile (carregada por último).
   Vitrine: menu sanduíche. Painel admin/rep: drawer off-canvas.
   Mantém a identidade (clay/sage, serifa + grotesk). Mobile-bold:
   alvos de toque maiores, drawers deslizantes, modais bottom-sheet.
   ============================================================ */

/* elementos só-mobile escondidos no desktop */
.hamburger { display: none; }
.shell-mobilebar { display: none; }
.shell-scrim { display: none; }
.store-nav-sep { display: none; }

/* botão hamburger (vitrine + painel) */
.hamburger {
  background: none; border: 0; cursor: pointer; color: var(--ink, #2b2b2b);
  width: 44px; height: 44px; border-radius: 12px;
  align-items: center; justify-content: center;
  transition: background .16s;
}
.hamburger:hover { background: var(--cream-2, rgba(0,0,0,.05)); }
.hamburger:active { transform: scale(.94); }

/* ============================================================
   PAINEL ADMIN / REP — drawer off-canvas  (≤ 980px)
   Substitui o layout "sidebar em linha" do styles3.css nesse range.
   ============================================================ */
@media (max-width: 980px) {
  .shell { display: block; grid-template-columns: 1fr; min-height: 100vh; }

  /* sidebar vira gaveta deslizante */
  .shell-side {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh;
    width: 272px; max-width: 84vw;
    display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch;
    padding: 20px 14px; z-index: 130;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.16,1,.3,1);
    overflow-y: auto;
  }
  .shell-side::before { display: none; }
  .shell.drawer-open .shell-side { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.4); }

  .shell-nav { flex-direction: column; flex-wrap: nowrap; flex: 1; margin-top: 10px; gap: 4px; }
  .shell-nav-item { width: 100%; padding: 13px 14px; }
  .shell-nav-item > span:not(.shell-nav-badge) { flex: 1; }
  .shell-user { border-top: 1px solid rgba(247,241,231,.12); margin-top: 10px; padding-top: 14px; width: auto; }

  /* scrim */
  .shell-scrim {
    display: block; position: fixed; inset: 0; z-index: 120;
    background: rgba(34,28,24,.5); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .shell.drawer-open .shell-scrim { opacity: 1; pointer-events: auto; }

  /* barra superior mobile com hamburger + marca */
  .shell-mobilebar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; position: sticky; top: 0; z-index: 60;
    background: rgba(247,241,231,.92); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line, rgba(0,0,0,.08));
  }
  .shell-mobilebar .hamburger { display: inline-flex; }
  .shell-mobilebar-brand { font-family: var(--ff-brand, serif); font-weight: 600; font-size: 24px; letter-spacing: -.01em; }
  .shell-mobilebar-tag { font-size: 9px; font-weight: 800; letter-spacing: .22em; color: var(--clay, #a1543a); align-self: center; }
  .shell-sage .shell-mobilebar-tag { color: var(--sage, #717852); }

  .shell-topbar { padding: 12px 16px; flex-wrap: wrap; justify-content: flex-start; }
  .shell-content { padding: 20px 16px 44px; }
}

/* ============================================================
   VITRINE — menu sanduíche  (≤ 860px)
   ============================================================ */
@media (max-width: 860px) {
  .store-head-in { height: 62px; gap: 10px; }

  /* nav vira painel suspenso (drawer) abaixo do header */
  .store-nav {
    position: fixed; top: 62px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px; flex: none;
    background: var(--paper, #fff);
    border-bottom: 1px solid var(--line, rgba(0,0,0,.08));
    box-shadow: 0 24px 40px -24px rgba(0,0,0,.4);
    padding: 12px 18px 18px;
    transform: translateY(-14px); opacity: 0; pointer-events: none;
    transition: transform .24s cubic-bezier(.16,1,.3,1), opacity .2s;
    z-index: 79; max-height: calc(100vh - 62px); overflow-y: auto;
  }
  .store-head.mobile-open .store-nav { transform: none; opacity: 1; pointer-events: auto; }
  .store-nav button { width: 100%; text-align: left; padding: 14px 14px; font-size: 16px; border-radius: 11px; }
  .store-nav-sep {
    display: block; margin-top: 8px; padding-top: 16px;
    border-top: 1px solid var(--line, rgba(0,0,0,.08));
    color: var(--clay, #a1543a); font-weight: 700;
  }

  .hamburger { display: inline-flex; }
  .login-desktop { display: none; }
  .acct-logout { display: none; }
  .acct-name { display: none; }
  .acct-btn { padding: 4px; }
}

/* ============================================================
   FONE — empilhamento fino  (≤ 640px)
   ============================================================ */
@media (max-width: 640px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field:first-child,
  .form-grid .field:nth-last-child(1) { grid-column: auto; }
  .serasa-grid { grid-template-columns: repeat(2, 1fr); }
  .pay-admin-grid, .carteira-grid, .integ-grid { grid-template-columns: 1fr; }

  /* tabelas largas: scroll horizontal só nos cards que contêm tabela */
  .card:has(.tbl) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 560px; }

  /* cabeçalhos de página empilham */
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .sect-head { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* hero / CTAs */
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .hero-trust { flex-wrap: wrap; gap: 10px; }

  /* carrinho reflui */
  .cart-item { grid-template-columns: 56px 1fr; gap: 10px 12px; }
  .cart-item-total { grid-column: 2; text-align: left; min-width: 0; }
  .cart-item .qty { grid-column: 2; justify-self: start; }

  /* modal vira bottom-sheet */
  .modal-scrim { align-items: flex-end; padding: 0; }
  .modal {
    width: 100% !important; max-width: 100% !important; max-height: 92vh;
    border-radius: 20px 20px 0 0;
    animation: rcSheet .28s cubic-bezier(.16,1,.3,1) both;
  }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; justify-content: center; }

  @keyframes rcSheet { from { transform: translateY(100%); } to { transform: none; } }
}

/* ============================================================
   FONE estreito  (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  .prod-grid, .catalog-grid, .bands { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .serasa-grid { grid-template-columns: 1fr; }
  .chips { flex-wrap: wrap; }
}
