/* Menu hambúrguer no celular. Carregado por último para vencer as regras antigas da faixa rolável. */
.menu-toggle { display: none; }

@media (max-width: 680px) {
  .sidebar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; min-height: 64px; padding: 10px 16px; background: #fff; }
  .sidebar { flex-direction: row; justify-content: flex-start; text-align: left; }
  .sidebar > .brand, .sidebar > .brand-wordmark { margin: 0; max-height: 34px; width: auto; max-width: calc(100vw - 170px); object-fit: contain; object-position: left center; }
  .sidebar-bottom { top: 50%; right: 68px; transform: translateY(-50%); }

  .menu-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    position: absolute; top: 50%; right: 12px; transform: translateY(-50%);
    width: 44px; height: 44px; padding: 0; border: 1px solid var(--line, #e3e6df); border-radius: 12px; background: #fff; cursor: pointer;
    -webkit-tap-highlight-color: transparent; z-index: 42;
  }
  .menu-toggle span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--ink, #1d2318); transition: transform .22s ease, opacity .18s ease; }
  .menu-toggle:active { transform: translateY(-50%) scale(.94); }
  body.menu-aberto .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.menu-aberto .menu-toggle span:nth-child(2) { opacity: 0; }
  body.menu-aberto .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* A faixa de botões vira gaveta lateral */
  .sidebar .nav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 41;
    width: min(84vw, 320px); display: flex; flex-direction: column; gap: 4px;
    padding: calc(76px + env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
    background: #fff; box-shadow: 0 0 40px rgba(0, 0, 0, .18);
    overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
    transform: translateX(-105%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); visibility: hidden;
  }
  body.menu-aberto .sidebar { z-index: 50; }
  body.menu-aberto .sidebar .nav { transform: none; visibility: visible; }
  .sidebar .nav button { width: 100%; min-width: 0; max-width: none; flex: none; justify-content: flex-start; gap: 12px; padding: 13px 14px; font-size: 15px; border-radius: 10px; }
  .sidebar .nav button svg { width: 20px; flex: none; }
  .sidebar .nav .nav-count { display: inline-block; margin-left: auto; background: #f1f3ee; }
  .sidebar .nav button.active .nav-count { background: #fff; }

  .menu-veu { position: fixed; inset: 0; z-index: 35; background: rgba(15, 20, 12, .38); animation: menu-veu .2s ease; }
  body.menu-aberto { overflow: hidden; }
}
@keyframes menu-veu { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sidebar .nav, .menu-toggle span { transition: none; }
  .menu-veu { animation: none; }
}
@media (max-width: 680px) {
  .sidebar .nav::before { content: "Menu"; position: absolute; top: calc(28px + env(safe-area-inset-top)); left: 28px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted, #788078); }
}
