/* ===========================================
   Fazenda 360 — menu de baixo (cara de iPhone)
   Barra fixa · folha "+ Lançar" · tela "Mais" · "‹ Voltar"
   Só entra em cena com body.com-nav-inferior (js/ui/nav-inferior.js).
   =========================================== */

:root { --nav-altura: 64px; }

/* ====== A. barra ====== */
#nav-inferior {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 150;                      /* acima do conteúdo e dos FABs (90); abaixo do drawer (200) e das folhas (2000+) */
    display: flex;
    align-items: stretch;
    height: calc(var(--nav-altura) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--branco, #fff);
    border-top: 1px solid var(--linha-fina, rgba(62, 86, 56, 0.12));
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}
#nav-inferior.nav-fora,
body.teclado-aberto #nav-inferior { display: none; }

#nav-inferior button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--texto-claro, #8B847E);
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    min-width: 0;
}
#nav-inferior button.ativo { color: var(--verde-escuro, #3E5638); }
#nav-inferior button svg {
    width: 25px; height: 25px;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
#nav-inferior .nav-rotulo { white-space: nowrap; }

/* Bola do + Lançar (sobe pra fora da barra) */
#nav-inferior .nav-bola {
    width: 54px; height: 54px;
    margin-top: -24px;
    border-radius: 50%;
    background: var(--verde-medio, #5C7F47);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(62, 86, 56, 0.45);
    border: 4px solid var(--branco, #fff);
    box-sizing: border-box;
}
#nav-inferior .nav-bola svg { stroke: #fff; width: 28px; height: 28px; stroke-width: 2.6; }
#nav-inferior button.aberto .nav-bola { background: var(--verde-escuro, #3E5638); }

/* ☰ do cabeçalho some: o "Mais" é o menu agora */
body.com-nav-inferior #btn-menu { display: none !important; }

/* ====== conteúdo e coisas fixas sobem pra barra não cobrir ====== */
body.com-nav-inferior .app-content {
    padding-bottom: calc(var(--nav-altura) + env(safe-area-inset-bottom, 0px) + 16px);
}
body.com-nav-inferior .fab {
    bottom: calc(var(--gap-lg, 16px) + var(--nav-altura) + env(safe-area-inset-bottom, 0px));
}
body.com-nav-inferior .fab-ia {
    bottom: calc(var(--gap-lg, 16px) + 60px + var(--gap-md, 12px) + var(--nav-altura) + env(safe-area-inset-bottom, 0px));
}
body.com-nav-inferior .fab-diag {
    bottom: calc(var(--gap-lg, 16px) + 60px + 52px + var(--gap-md, 12px) * 2 + var(--nav-altura) + env(safe-area-inset-bottom, 0px));
}
body.com-nav-inferior .cafezinho-fab   { bottom: calc(150px + var(--nav-altura) + env(safe-area-inset-bottom, 0px)); }
body.com-nav-inferior .cafezinho-balao { bottom: calc(84px + var(--nav-altura) + env(safe-area-inset-bottom, 0px)); }
body.com-nav-inferior .cafezinho-drop  { bottom: calc(36px + var(--nav-altura) + env(safe-area-inset-bottom, 0px)); }

/* Faixa do tour (modo demonstração) fica ACIMA da barra */
body.com-nav-inferior .tour-bar {
    bottom: calc(var(--nav-altura) + env(safe-area-inset-bottom, 0px));
    padding-bottom: 18px;
    z-index: 149;
}
body.com-nav-inferior.tem-tour-bar {
    padding-bottom: calc(188px + var(--nav-altura) + env(safe-area-inset-bottom, 0px));
}

/* ====== B. folha "+ Lançar" ====== */
#nav-escuro {
    position: fixed; inset: 0;
    background: rgba(42, 37, 32, 0.45);
    z-index: 140;
}
#nav-folha {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(var(--nav-altura) + env(safe-area-inset-bottom, 0px));
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--branco, #fff);
    color: var(--texto, #2A2520);
    border-radius: 22px 22px 0 0;
    padding: 10px 14px 18px;
    z-index: 145;
    box-sizing: border-box;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.12);
    animation: nav-subir 0.22s ease-out;
}
@keyframes nav-subir { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
#nav-folha .nav-puxa { width: 40px; height: 5px; border-radius: 9px; background: var(--linha-fina, #d1d5db); margin: 0 auto 10px; }
#nav-folha h3 { margin: 0 0 10px; font-size: 17px; font-weight: 700; }
#nav-folha .nav-grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#nav-folha .nav-grade button {
    background: var(--bege-suave, #F4EFDF);
    border: 0;
    border-radius: 14px;
    padding: 12px 4px;
    text-align: center;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--texto, #2A2520);
    min-height: 82px;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    -webkit-tap-highlight-color: transparent;
}
#nav-folha .nav-grade button:active { transform: scale(0.97); }
#nav-folha .nav-grade-ico {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    line-height: 1;
}
#nav-folha .nav-grade-rotulo { line-height: 1.2; }

/* ====== cores dos ícones (quadrado arredondado) ====== */
.cor-azu  { background: #e3f2fd; color: #1565c0; }
.cor-lar  { background: #fff3e0; color: #ef6c00; }
.cor-ver  { background: #e8f5e9; color: #2e7d32; }
.cor-ver2 { background: #e0f2f1; color: #00796b; }
.cor-mar  { background: #efebe9; color: #5d4037; }
.cor-cin  { background: #eceff1; color: #455a64; }
.cor-roxo { background: #ede7f6; color: #5e35b1; }
.cor-amar { background: #fff8e1; color: #f9a825; }
.cor-verm { background: #ffebee; color: #c62828; }

/* ====== C. tela "Mais" ====== */
.pagina-mais { padding: 0 var(--gap-lg, 16px) var(--gap-xl, 24px); }
.mais-topo {
    margin: 0 calc(-1 * var(--gap-lg, 16px)) var(--gap-lg, 16px);
    padding: calc(env(safe-area-inset-top, 0px) + 18px) var(--gap-lg, 16px) 16px;
    border-radius: 0 0 20px 20px;
    background: linear-gradient(160deg, #2f4229, var(--verde-escuro, #3E5638) 60%, var(--verde-medio, #5C7F47));
    color: #fff;
}
.mais-titulo { font-size: 30px; font-weight: 800; margin: 0 0 12px; letter-spacing: -0.3px; }
.mais-fazenda, .mais-conta {
    width: 100%;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font: inherit;
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px;
    text-align: left;
    cursor: pointer;
    margin-bottom: 8px;
    -webkit-tap-highlight-color: transparent;
}
.mais-fazenda-ico, .mais-conta-ico { font-size: 22px; line-height: 1; flex: none; }
.mais-fazenda-nome { flex: 1; font-weight: 700; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mais-fazenda-seta { font-size: 12px; opacity: 0.85; white-space: nowrap; }
.mais-conta-texto { display: flex; flex-direction: column; min-width: 0; }
.mais-conta-nome { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mais-conta-email { font-size: 12.5px; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mais-conta-visitante { background: rgba(255, 215, 0, 0.22); border: 1px solid rgba(255, 215, 0, 0.5); }
.mais-plano {
    margin-top: 4px;
    font-size: 13.5px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #A5D6A7;
}
.mais-plano:empty { display: none; }
.mais-plano-premium  { color: #FFD54F; }
.mais-plano-expirado { color: #EF9A9A; }

.mais-premium {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    border: 0;
    background: linear-gradient(90deg, #ffd54f, #ffa000);
    color: #3e2723;
    border-radius: 16px;
    padding: 12px 14px;
    font-weight: 800;
    margin-bottom: 14px;
    font-size: 15px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}
.mais-premium-ico { font-size: 22px; line-height: 1; }
.mais-premium-texto { flex: 1; display: flex; flex-direction: column; }
.mais-premium-texto small { font-weight: 600; font-size: 12.5px; opacity: 0.85; }
.mais-premium .mais-seta { color: #3e2723; }

/* Atalho "❓ Ajuda" no TOPO do Mais (primeira dobra, logo abaixo da conta).
   O item "Ajuda (manual com fotos)" do grupo App continua lá embaixo. */
.mais-ajuda-topo {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    border: 1px solid var(--linha-fina, rgba(62, 86, 56, 0.12));
    background: var(--branco, #fff);
    color: var(--texto, #2A2520);
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 12px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}
.mais-ajuda-topo-ico { font-size: 22px; line-height: 1; }
.mais-ajuda-topo-texto { flex: 1; display: flex; flex-direction: column; }
.mais-ajuda-topo-texto small { font-weight: 500; font-size: 12.5px; color: var(--texto-claro, #8B847E); }

.mais-grupo-titulo {
    font-size: 12px;
    font-weight: 800;
    color: var(--texto-claro, #8B847E);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 14px 4px 6px;
}
.mais-grupo {
    background: var(--branco, #fff);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--sombra-media, 0 4px 12px rgba(62, 86, 56, 0.10));
}
.mais-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-bottom: 1px solid var(--linha-fina, rgba(62, 86, 56, 0.08));
    background: var(--branco, #fff);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: var(--texto, #2A2520);
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.mais-item:last-child { border-bottom: 0; }
.mais-item:active { background: var(--bege-suave, #F4EFDF); }
.mais-item-texto { flex: 1; min-width: 0; }
.mais-seta { color: var(--texto-claro, #9ca3af); font-size: 22px; line-height: 1; }
.mais-item-sair { color: var(--alerta, #c62828); }
.mais-ico {
    width: 36px; height: 36px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    flex: none;
    font-size: 20px;
    line-height: 1;
}
.mais-selo {
    display: inline-block;
    background: #fff3e0;
    color: #e65100;
    font-size: 11px;
    font-weight: 800;
    border-radius: 99px;
    padding: 2px 8px;
    margin-left: 4px;
    vertical-align: middle;
    white-space: nowrap;
}
body.usuario-pro .mais-selo { display: none; }
.mais-versao { text-align: center; color: var(--texto-claro, #8B847E); font-size: 12px; margin-top: 18px; }

/* ====== D. "‹ Voltar" escrito ====== */
body.com-nav-inferior .btn-voltar.nav-voltar {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--bege-suave, #eef2ea);
    color: var(--verde-escuro, #1b5e20);
    border: 0;
    border-radius: 99px;
    padding: 7px 14px 7px 8px;
    font-weight: 800;
    font-size: 16px;
    line-height: 1;
    text-decoration: none;
    box-shadow: none;
}
body.com-nav-inferior .btn-voltar.nav-voltar svg {
    width: 22px; height: 22px;
    stroke: currentColor; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
    flex: none;
}

/* ====== tema escuro ====== */
body.tema-escuro .cor-azu  { background: rgba(21, 101, 192, 0.25); color: #90caf9; }
body.tema-escuro .cor-lar  { background: rgba(239, 108, 0, 0.25);  color: #ffcc80; }
body.tema-escuro .cor-ver  { background: rgba(46, 125, 50, 0.25);  color: #a5d6a7; }
body.tema-escuro .cor-ver2 { background: rgba(0, 121, 107, 0.25);  color: #80cbc4; }
body.tema-escuro .cor-mar  { background: rgba(93, 64, 55, 0.35);   color: #d7ccc8; }
body.tema-escuro .cor-cin  { background: rgba(69, 90, 100, 0.35);  color: #cfd8dc; }
body.tema-escuro .cor-roxo { background: rgba(94, 53, 177, 0.3);   color: #d1c4e9; }
body.tema-escuro .cor-amar { background: rgba(249, 168, 37, 0.25); color: #ffe082; }
body.tema-escuro .cor-verm { background: rgba(198, 40, 40, 0.3);   color: #ef9a9a; }
body.tema-escuro .mais-selo { background: rgba(230, 81, 0, 0.25); color: #ffb74d; }

/* ====== impressão: nada disso vai pro PDF ====== */
@media print {
    #nav-inferior, #nav-folha, #nav-escuro { display: none !important; }
    body.com-nav-inferior .app-content { padding-bottom: 0; }
}
