/* ═══ 29/10/2026 — MENU SUPERIOR (alternativa ao lateral; ver js/menu-topo.js)
   Tudo preso em body.menu-topo. Só em tela larga: no celular o lateral continua como gaveta (as regras do
   style.css valem) e esta barra some. Usa as cores do MÓDULO (--bg-*), como o menu-janela.css.
   Entra DEPOIS do menu-janela.css e do fiscal.css: precisa vencer o menu lateral e ajustar a topbar flutuante. ═══ */

#menu-topo { display: none; }
body.tv-kiosk #menu-topo, body.ppt-kiosk #menu-topo { display: none !important; }   /* TVs (Painel TV e Painel de Pedidos) */

@media (min-width: 769px) {
  /* some o lateral; a área de trabalho ganha a largura toda */
  body.menu-topo #sidebar,
  body.menu-topo #sidebar-backdrop { display: none !important; }
  body.menu-topo .topbar-toggle { display: none; }

  body.menu-topo #menu-topo {
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
    padding: 5px 10px;
    background: var(--bg-50);
    border-bottom: 1px solid var(--bg-200);
    /* 990: os painéis abrem POR CIMA do cartão de Contas a Pagar (alerta-fis.js, 989, que no modo topo flutua no canto)
       e continuam ABAIXO das janelas do sistema (.modal-overlay = 1000) */
    position: relative; z-index: 990; flex-shrink: 0;
  }
  /* a topbar flutua (menu-janela.css / fiscal.css): a barra do menu gruda nela por baixo e leva a sombra */
  body.menu-topo[data-modulo] .topbar { border-radius: 10px 10px 0 0; box-shadow: none; }
  body.menu-topo[data-modulo] #menu-topo {
    margin: 0 10px; border-radius: 0 0 10px 10px; border-bottom: 0;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .30), 0 0 0 1px rgba(0, 0, 0, .08);
  }
  /* tela Início sem rolagem: desconta também a altura da barra (medida pelo menu-topo.js) */
  body.menu-topo[data-modulo] .inicio-tela { min-height: calc(100vh - 112px - var(--menu-topo-h, 44px)); }
}

/* os grupos ficam num invólucro que some do layout (cada botão continua item da barra); o selo de Contas a Pagar vai à direita */
#menu-topo .mt-menu { display: contents; }
#menu-topo #mt-alerta { margin-left: auto; position: relative; display: flex; align-items: center; }
#menu-topo #mt-alerta:empty { display: none; }

/* ── botão Início = o logo (como no lateral: logo branco na cor do módulo) ── */
#menu-topo .mt-inicio {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-800); border: 0; border-radius: 9px;
  height: 34px; padding: 0 14px; margin-right: 8px; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18); transition: box-shadow .15s, transform .15s, filter .15s;
}
#menu-topo .mt-inicio img { height: 26px; width: auto; display: block; filter: brightness(0) invert(1); }
#menu-topo .mt-inicio:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, .25); transform: translateY(-1px); filter: brightness(1.12); }

/* ── grupos ── */
#menu-topo .mt-item { position: relative; }
#menu-topo .mt-btn {
  background: none; border: 0; font: inherit; font-weight: 700; font-size: 13.5px;
  color: var(--bg-900); padding: 8px 12px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
#menu-topo .mt-btn i { font-style: normal; font-size: 10px; opacity: .6; }
#menu-topo .mt-btn:hover,
#menu-topo .mt-item.aberto > .mt-btn { background: var(--bg-100); }
#menu-topo .mt-item.ativo > .mt-btn,
#menu-topo .mt-solto.ativo { background: var(--bg-800); color: #fff; }
#menu-topo .mt-item.ativo > .mt-btn i { opacity: .9; }

/* ── painéis ── */
#menu-topo .mt-painel {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 250px;
  max-height: calc(100vh - 140px); overflow-y: auto;
  background: #fff; border-radius: 12px; padding: 8px; z-index: 70;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .28), 0 0 0 1px rgba(0, 0, 0, .08);
}
#menu-topo .mt-item.aberto > .mt-painel { display: block; }
#menu-topo .mt-item.mt-direita > .mt-painel { left: auto; right: 0; }

/* Fiscal: Empresas / Escritório — um painel com uma coluna por empresa */
#menu-topo .mt-item.aberto > .mt-painel.mt-colunas { display: flex; gap: 10px; min-width: 0; }
#menu-topo .mt-col { min-width: 180px; }
#menu-topo .mt-col + .mt-col { border-left: 1px solid var(--bg-100); padding-left: 10px; }
#menu-topo .mt-col-titulo {
  display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px; font-weight: 700;
  color: var(--text-muted); padding: 6px 10px 5px; border-radius: 8px;
}
#menu-topo .mt-link-titulo { cursor: pointer; }
#menu-topo .mt-link-titulo:hover { background: var(--bg-100); color: var(--bg-900); }
#menu-topo .mt-link-titulo.ativo { color: var(--bg-900); text-decoration: underline; }

/* ── botão "🎨 Menu" (ao lado do 🔑 Senha) + a janelinha da escolha — no celular o menu é sempre lateral: some ── */
#mt-escolha {
  position: fixed; z-index: 995; background: #fff; color: var(--bg-900); border-radius: 12px; padding: 10px 14px 8px;
  min-width: 210px; font-size: 13.5px; box-shadow: 0 16px 40px rgba(0, 0, 0, .28), 0 0 0 1px rgba(0, 0, 0, .08);
}
#mt-escolha[hidden] { display: none; }
#mt-escolha .mt-escolha-tit { font-weight: 700; margin-bottom: 6px; }
#mt-escolha .mt-escolha-tit small { font-weight: 400; color: var(--text-muted); }
#mt-escolha label { display: flex; align-items: center; gap: 8px; padding: 5px 2px; cursor: pointer; }
#mt-escolha input { width: auto; margin: 0; }   /* o style.css dá width:100% a todo input */
@media (max-width: 768px) { #btn-menu-estilo, #mt-escolha { display: none !important; } }

/* ── telas ── */
#menu-topo .mt-link {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; font: inherit; font-size: 13.5px; color: var(--bg-900);
  padding: 8px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
#menu-topo .mt-link:hover { background: var(--bg-100); }
#menu-topo .mt-link.ativo { background: var(--bg-800); color: #fff; }
#menu-topo .mt-emoji { width: 22px; text-align: center; flex: 0 0 22px; }
