/* Start Grana | menu único (site, guias, artigos, mercado e calculadoras).
   Classes com prefixo sgm- para não conflitar com o CSS próprio de cada página. */

header.sgm {
  --sgm-ink: #141414;
  --sgm-muted: #5f5f5a;
  --sgm-soft: #f1f1ee;
  --sgm-brand: #ffc400;
  --sgm-shadow: 0 1px 2px rgba(20, 20, 20, .05), 0 10px 28px -14px rgba(20, 20, 20, .22);
  position: sticky; top: 12px; z-index: 1000;
  padding: 12px 20px 0; margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
.sgm *, .sgm *::before, .sgm *::after { box-sizing: border-box; }
.sgm-bar {
  max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  height: 64px; padding: 0 10px 0 22px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px);
  border-radius: 999px; box-shadow: var(--sgm-shadow);
}
.sgm-logo { flex: none; display: block; margin-right: 4px; }
.sgm-logo img { height: 20px; width: auto; display: block; }

/* Busca de ativo */
.sgm-busca { position: relative; flex: 1 1 220px; max-width: 300px; }
.sgm-busca svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--sgm-muted); pointer-events: none; }
.sgm-busca input {
  width: 100%; height: 42px; padding: 0 16px 0 38px; border: 0; outline: none;
  background: var(--sgm-soft); color: var(--sgm-ink); border-radius: 999px;
  font: inherit; font-size: 14px;
}
.sgm-busca input:focus { background: #fff; box-shadow: 0 0 0 2px var(--sgm-brand); }
.sgm-res {
  display: none; position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  background: #fff; border-radius: 18px; box-shadow: var(--sgm-shadow); padding: 6px; min-width: 280px;
}
.sgm-res.on { display: block; }
.sgm-res a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  color: var(--sgm-ink); text-decoration: none; font-size: 14px;
}
.sgm-res a:hover, .sgm-res a.ativo { background: var(--sgm-soft); }
.sgm-res strong { font-weight: 700; min-width: 64px; }
.sgm-res span { color: var(--sgm-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sgm-res em { font-style: normal; font-size: 11px; font-weight: 700; background: var(--sgm-soft); color: var(--sgm-muted); padding: 2px 8px; border-radius: 999px; }
.sgm-res p { margin: 0; padding: 12px; color: var(--sgm-muted); font-size: 14px; }

/* Itens e menus suspensos */
.sgm-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.sgm-item {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px;
  border: 0; background: transparent; border-radius: 999px; cursor: pointer;
  color: var(--sgm-muted); font: inherit; font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.sgm-item:hover, .sgm-dd.aberto > .sgm-item, .sgm-item.atual { background: var(--sgm-soft); color: var(--sgm-ink); }
.sgm-seta { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
.sgm-dd { position: relative; }
.sgm-dd.aberto .sgm-seta { transform: rotate(-135deg) translateY(-1px); }
.sgm-painel {
  display: none; position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  width: 300px; background: #fff; border-radius: 20px; box-shadow: var(--sgm-shadow); padding: 8px;
}
.sgm-dd.aberto .sgm-painel { display: block; }
.sgm-painel a { display: block; padding: 10px 14px; border-radius: 14px; text-decoration: none; color: var(--sgm-ink); }
.sgm-painel a:hover { background: var(--sgm-soft); }
.sgm-painel b { display: block; font-size: 14px; font-weight: 700; }
.sgm-painel small { display: block; font-size: 12.5px; color: var(--sgm-muted); margin-top: 1px; }
.sgm-painel hr { border: 0; height: 1px; background: #e4e4e0; margin: 6px 10px; }

.sgm-entrar {
  flex: none; display: inline-flex; align-items: center; height: 42px; padding: 0 20px; margin-left: 4px;
  background: var(--sgm-brand); color: var(--sgm-ink); border-radius: 999px;
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.sgm-entrar:hover { background: #ffd43b; }
.sgm-burger { display: none; flex: none; width: 42px; height: 42px; margin-left: auto; border: 0; border-radius: 50%; background: var(--sgm-soft); color: var(--sgm-ink); font-size: 18px; cursor: pointer; }

/* Celular e tablet: menu abre num painel abaixo da barra */
@media (max-width: 1020px) {
  header.sgm { padding: 8px 12px 0; top: 8px; }
  .sgm-bar { flex-wrap: wrap; height: auto; min-height: 60px; padding: 9px 9px 9px 20px; border-radius: 28px; }
  .sgm-burger { display: block; }
  .sgm-busca, .sgm-nav, .sgm-entrar { display: none; }
  header.sgm.aberto .sgm-bar { border-radius: 24px; padding-bottom: 14px; }
  header.sgm.aberto .sgm-busca { display: block; order: 3; flex: 1 1 100%; max-width: none; margin: 10px 4px 0 -8px; }
  header.sgm.aberto .sgm-nav { display: flex; order: 4; flex: 1 1 100%; flex-direction: column; align-items: stretch; margin: 8px 0 0 -8px; }
  header.sgm.aberto .sgm-entrar { display: flex; order: 5; flex: 1 1 100%; justify-content: center; margin: 8px 4px 0 -8px; }
  .sgm-item { width: 100%; justify-content: space-between; height: 46px; }
  .sgm-painel { position: static; transform: none; width: auto; box-shadow: none; padding: 0 0 6px 8px; background: transparent; }
  .sgm-res { position: static; margin-top: 8px; box-shadow: none; border: 1px solid #e4e4e0; }
}
