/* ============================================================
   Porco da Integração — sistema visual v2
   Referências: painel estilo fintech (sidebar escura + conteúdo
   claro com cards de número) e hero escuro e direto, com o
   laranja da marca só onde importa: ação e alerta.
   ============================================================ */
:root {
    --base: #0a1120;
    --painel: #121c2e;
    --painel-hover: #1a2740;
    --borda-escura: rgba(255,255,255,0.08);

    --claro: #f3f5f9;
    --cartao: #ffffff;
    --linha: #e3e7ee;

    --laranja: #ff7a2f;
    --laranja-escuro: #e4621c;
    --azul-dado: #2f6fed;

    --texto: #1b2430;
    --texto-suave: #677184;
    --texto-claro: #dbe4ee;
    --texto-claro-suave: #8a97ab;

    --verde: #1fa971;
    --verde-fundo: #e5f7ef;
    --vermelho: #e5484d;
    --vermelho-fundo: #fdecec;
    --mel: #b8860b;
    --mel-fundo: #fbf1dc;

    --fonte-titulo: "Space Grotesk", "Segoe UI", sans-serif;
    --fonte-texto: "Inter", "Segoe UI", Arial, sans-serif;

    --raio: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--fonte-texto);
    color: var(--texto);
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: var(--fonte-titulo);
    font-weight: 700;
    line-height: 1.15;
    margin-top: 0;
    color: var(--texto);
}
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }

a { color: var(--azul-dado); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--laranja); outline-offset: 2px; }

/* ============================================================
   PÁGINAS PÚBLICAS (sem login): topo + hero escuro
   ============================================================ */
body.site { background: var(--claro); }

.topo {
    background: var(--base);
    color: #fff;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.2rem;
    gap: 0.6rem;
    border-bottom: 3px solid var(--laranja);
}
.topo .marca { display: flex; align-items: center; gap: 0.55rem; color: #fff; font-family: var(--fonte-titulo); font-weight: 700; font-size: 1.08rem; }
.topo .marca:hover { text-decoration: none; opacity: 0.92; }
.marca-icone { width: 34px; height: 34px; border-radius: 50%; display: block; }
.topo nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.topo nav a { color: var(--texto-claro); font-weight: 500; }
.topo nav a:hover { color: #fff; }
.botao-topo { background: var(--laranja); padding: 0.45rem 1rem; border-radius: 7px; color: #fff !important; font-weight: 600; }
.botao-topo:hover { background: var(--laranja-escuro); text-decoration: none; }

.conteudo { max-width: 1020px; margin: 0 auto; padding: 1.4rem 1.1rem 3rem; width: 100%; }

.hero {
    background:
        radial-gradient(900px 400px at 85% -10%, rgba(255,122,47,0.18), transparent 60%),
        linear-gradient(165deg, var(--base) 0%, #0d1830 100%);
    color: #fff;
    border-radius: 16px;
    padding: 2.6rem 1.8rem;
    margin-bottom: 1.4rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    border: 1px solid var(--borda-escura);
}
.hero-texto { flex: 1 1 320px; }
.hero h1 { color: #fff; font-size: 2.3rem; margin-bottom: 0.7rem; letter-spacing: -0.01em; }
.hero p { color: var(--texto-claro); font-size: 1.08rem; max-width: 42ch; }
.hero-selo { flex: 0 0 auto; width: 170px; height: 170px; border-radius: 50%; box-shadow: 0 16px 40px rgba(0,0,0,0.45); transform: rotate(-4deg); }
@media (max-width: 560px) { .hero-selo { width: 110px; height: 110px; } .hero h1 { font-size: 1.8rem; } }

/* ============================================================
   ÁREA LOGADA: sidebar escura + conteúdo claro
   ============================================================ */
body.app { background: var(--claro); }


.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 230px;
    flex: 0 0 230px;
    background: var(--base);
    color: var(--texto-claro);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 30;
    transition: transform 0.2s ease;
}
.sidebar-marca {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 1.1rem 1rem;
    border-bottom: 1px solid var(--borda-escura);
    color: #fff; font-family: var(--fonte-titulo); font-weight: 700;
}
.sidebar-marca img { width: 32px; height: 32px; border-radius: 50%; }
.sidebar nav { flex: 1; padding: 0.8rem 0.6rem; display: flex; flex-direction: column; gap: 0.15rem; }
.sidebar nav a {
    color: var(--texto-claro-suave);
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
}
.sidebar nav a:hover { background: var(--painel-hover); color: #fff; text-decoration: none; }
.sidebar nav a.ativo { background: var(--laranja); color: #fff; }
.sidebar-rodape { padding: 0.9rem 1rem; border-top: 1px solid var(--borda-escura); font-size: 0.85rem; }
.sidebar-rodape .usuario-nome { display: block; color: #fff; font-weight: 600; margin-bottom: 0.3rem; }
.sidebar-rodape a { color: var(--texto-claro-suave); }
.sidebar-versao { opacity: 0.5; font-size: 0.75rem; margin-top: 0.4rem; }

.sidebar-overlay { display: none; }

.app-content { flex: 1; margin-left: 230px; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    display: none;
    align-items: center;
    gap: 0.8rem;
    background: var(--base);
    color: #fff;
    padding: 0.8rem 1rem;
    border-bottom: 3px solid var(--laranja);
    position: sticky; top: 0; z-index: 20;
}
.hamburger { font-size: 1.3rem; cursor: pointer; line-height: 1; padding: 0.4rem 0.7rem; background: transparent; color: #fff; border: 0; margin: 0; width: auto; -webkit-appearance: none; appearance: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.hamburger:hover { background: transparent; }
.app-topbar-titulo { font-family: var(--fonte-titulo); font-weight: 600; }

@media (max-width: 880px) {
    .sidebar { transform: translateX(-100%); }
    .app-content { margin-left: 0; }
    .app-topbar { display: flex; }
    .sidebar-overlay {
        display: none;
        position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.45); z-index: 25;
    }
    .menu-aberto .sidebar { transform: translateX(0); }
    .menu-aberto .sidebar-overlay { display: block; cursor: pointer; }
}

/* ============================================================
   Cartões, KPIs, formulários, tabelas (compartilhado)
   ============================================================ */
.cartao { background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio); padding: 1.3rem; margin-bottom: 1.2rem; }

.kpis { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 1.2rem; }
.kpi {
    background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio);
    padding: 1rem 1.1rem;
    flex: 1 1 150px;
}
.kpi .kpi-rotulo { font-size: 0.8rem; color: var(--texto-suave); font-weight: 600; }
.kpi .kpi-valor { font-family: var(--fonte-titulo); font-size: 1.55rem; font-weight: 700; margin-top: 0.15rem; }
.kpi .kpi-valor.positivo { color: var(--verde); }
.kpi .kpi-valor.negativo { color: var(--vermelho); }
.kpi .kpi-valor.laranja { color: var(--laranja-escuro); }

.grafico-cartao { background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio); padding: 1.2rem; margin-bottom: 1.2rem; }
.grafico-cartao canvas { max-width: 100%; }

.marca-formulario { display: block; width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 0.8rem; }
.form-largura { max-width: 420px; margin: 1.6rem auto; }
.form-largura h1 { text-align: center; }

label { display: block; font-weight: 600; margin: 0.8rem 0 0.3rem; font-size: 0.9rem; color: var(--texto); }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="date"], input[type="number"], select, textarea {
    width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--linha); border-radius: 8px;
    font-size: 1rem; font-family: var(--fonte-texto); background: #fff; color: var(--texto);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--azul-dado); outline: none; box-shadow: 0 0 0 3px rgba(47,111,237,0.18);
}

button, .botao {
    display: inline-block; background: var(--base); color: #fff; border: none;
    padding: 0.65rem 1.25rem; border-radius: 8px; font-size: 0.97rem; font-weight: 600;
    font-family: var(--fonte-texto); cursor: pointer; margin-top: 1rem;
}
button:hover, .botao:hover { background: #0d1830; text-decoration: none; }
.botao-laranja { background: var(--laranja); }
.botao-laranja:hover { background: var(--laranja-escuro); }
.botao-perigo { background: var(--vermelho); }
.botao-perigo:hover { background: #c33237; }

.alerta { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.95rem; border: 1px solid transparent; }
.alerta-erro { background: var(--vermelho-fundo); color: var(--vermelho); border-color: #f5c6c6; }
.alerta-sucesso { background: var(--verde-fundo); color: var(--verde); border-color: #bfe8d4; }
.alerta-aviso { background: var(--mel-fundo); color: var(--mel); border-color: #edd9a3; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--linha); font-size: 0.9rem; }
th { color: var(--texto-suave); font-weight: 600; font-family: var(--fonte-titulo); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.02em; }

.selo { display: inline-block; padding: 0.18rem 0.6rem; border-radius: 999px; font-size: 0.76rem; font-weight: 600; }
.selo-pendente { background: var(--mel-fundo); color: var(--mel); }
.selo-ativo { background: var(--verde-fundo); color: var(--verde); }
.selo-suspenso { background: var(--vermelho-fundo); color: var(--vermelho); }
.selo-fechado { background: #eceff3; color: var(--texto-suave); }

.rodape { text-align: center; padding: 1.3rem; color: var(--texto-suave); font-size: 0.85rem; }
.acoes-linha { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.secao-titulo { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.9rem; }

/* ---------- Abas (lançamentos do lote) — CSS puro, sem JS ---------- */
.abas-radio { display: none; }
.abas-botoes {
    display: flex; flex-wrap: wrap; gap: 0.4rem;
    border-bottom: 1px solid var(--linha);
    margin-bottom: 1.1rem;
    padding-bottom: 0;
}
.abas-botoes label {
    padding: 0.55rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--texto-suave);
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    border: 1px solid transparent;
    margin-bottom: -1px;
}
.abas-botoes label:hover { color: var(--texto); }
.aba-painel { display: none; }

#aba-entradas:checked ~ .abas-botoes label[for="aba-entradas"],
#aba-mortes:checked ~ .abas-botoes label[for="aba-mortes"],
#aba-retiradas:checked ~ .abas-botoes label[for="aba-retiradas"],
#aba-racao:checked ~ .abas-botoes label[for="aba-racao"],
#aba-estoque:checked ~ .abas-botoes label[for="aba-estoque"],
#aba-hospital:checked ~ .abas-botoes label[for="aba-hospital"] {
    color: #fff;
    background: var(--base);
    border-color: var(--base);
}

#aba-entradas:checked ~ .aba-painel-entradas,
#aba-mortes:checked ~ .aba-painel-mortes,
#aba-retiradas:checked ~ .aba-painel-retiradas,
#aba-racao:checked ~ .aba-painel-racao,
#aba-estoque:checked ~ .aba-painel-estoque,
#aba-hospital:checked ~ .aba-painel-hospital {
    display: block;
}

/* Gráficos com altura fixa (evita canvas colapsado no celular) */
.grafico-caixa { position: relative; height: 280px; width: 100%; }
