/* ═══════════════════════════════════════════════════════════════════
   Gestão da Fazenda — Tema "Campo" (Daylight Industrial em verde agro)
   Legível ao sol (curral, manga, balança) e ótimo em mobile portrait.
   Estrutura inspirada no padrão validado no erpbv.
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --fz-bg-app:        #F4F6F1;   /* Fundo geral (verde-acinzentado claro) */
    --fz-bg-card:       #FFFFFF;
    --fz-text:          #1A2A1B;   /* Quase preto esverdeado — alta legibilidade */
    --fz-text-muted:    #5E6B5E;
    --fz-border:        #DCE4D8;
    --fz-navbar-bg:     #234D29;   /* Verde floresta escuro */
    --fz-navbar-text:   #F4FBF4;
    --fz-navbar-active: #FFFFFF;
    --fz-brand:         #2E7D32;   /* Verde CTA */
    --fz-brand-hover:   #246428;
    --fz-accent:        #B98A2E;   /* Âmbar/terra para detalhes */
    --fz-shadow-sm:     0 1px 2px rgba(26, 42, 27, 0.06);
    --fz-shadow-md:     0 4px 12px rgba(26, 42, 27, 0.10);
}

/* ── Base ─────────────────────────────────────────────────────────── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    line-height: 1.55;
    color: var(--fz-text);
    background-color: var(--fz-bg-app);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--fz-text);
    font-weight: 600;
    letter-spacing: -0.01em;
}
label, .form-label { color: var(--fz-text); font-weight: 500; }
.text-muted { color: var(--fz-text-muted) !important; }
a { color: var(--fz-brand); }
a:hover { color: var(--fz-brand-hover); }

/* ── Navbar (desktop/tablet) ──────────────────────────────────────── */
.navbar.fz-navbar {
    background-color: var(--fz-navbar-bg) !important;
    border-bottom: 3px solid var(--fz-brand);
    box-shadow: var(--fz-shadow-sm);
}
.fz-navbar .navbar-brand,
.fz-navbar .nav-link { color: var(--fz-navbar-text); font-weight: 500; }
.fz-navbar .nav-link.active,
.fz-navbar .nav-link:hover {
    color: var(--fz-navbar-active);
    background-color: rgba(255, 255, 255, 0.10);
    border-radius: 6px;
}
.navbar-brand { font-size: 1.2rem; font-weight: 700; }
.navbar .dropdown-menu {
    border: 1px solid var(--fz-border);
    box-shadow: var(--fz-shadow-md);
    border-radius: 8px;
    margin-top: 4px;
}
.navbar .dropdown-item { padding: 0.5rem 1rem; font-size: 0.95rem; color: var(--fz-text); }
.navbar .dropdown-item:hover { background-color: var(--fz-bg-app); }

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
    background-color: var(--fz-bg-card);
    border: 1px solid var(--fz-border);
    border-radius: 10px;
    box-shadow: var(--fz-shadow-sm);
}
.card-header {
    background-color: var(--fz-bg-card);
    border-bottom: 1px solid var(--fz-border);
    font-weight: 600;
}

/* KPI cards (painéis/relatórios) */
.kpi-card { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--fz-shadow-md); }
.kpi-icon { font-size: 2rem; opacity: 0.9; }

/* ── Tabelas ──────────────────────────────────────────────────────── */
.table { color: var(--fz-text); margin-bottom: 0; }
.table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fz-text-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--fz-border);
    padding: 0.85rem 0.75rem;
}
.table td { padding: 0.8rem 0.75rem; vertical-align: middle; border-bottom: 1px solid var(--fz-border); }
.table-hover tbody tr:hover { background-color: rgba(46, 125, 50, 0.05); }
.table-light, .table-light > th, .table-light > td { background-color: #EDF2EA; }

/* ── Botões ───────────────────────────────────────────────────────── */
.btn { font-weight: 500; border-radius: 8px; padding: 0.55rem 1rem; transition: all 0.15s ease; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.875rem; }
.btn-primary, .btn-success {
    background-color: var(--fz-brand);
    border-color: var(--fz-brand);
}
.btn-primary:hover, .btn-primary:focus,
.btn-success:hover, .btn-success:focus {
    background-color: var(--fz-brand-hover);
    border-color: var(--fz-brand-hover);
}
.btn-outline-primary, .btn-outline-success {
    color: var(--fz-brand);
    border-color: var(--fz-brand);
}
.btn-outline-primary:hover, .btn-outline-success:hover {
    background-color: var(--fz-brand);
    border-color: var(--fz-brand);
    color: #fff;
}

/* ── Badges / Forms / Alertas ─────────────────────────────────────── */
.badge { font-size: 0.78rem; font-weight: 600; padding: 0.42em 0.7em; border-radius: 6px; }

.form-control, .form-select {
    border: 1px solid var(--fz-border);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
    color: var(--fz-text);
    background-color: var(--fz-bg-card);
}
.form-control:focus, .form-select:focus {
    border-color: var(--fz-brand);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}
.alert { border-radius: 10px; padding: 0.85rem 1rem; }

.pagination .page-link { color: var(--fz-brand); border-color: var(--fz-border); }
.pagination .page-item.active .page-link { background-color: var(--fz-brand); border-color: var(--fz-brand); }

/* ═══════════════════════════════════════════════════════════════════
   Mobile portrait — fonte/alvos maiores, tabelas com scroll horizontal
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
    html { font-size: 17px; }
    h3 { font-size: 1.35rem; }
    h4 { font-size: 1.2rem; }

    .btn { padding: 0.7rem 1rem; font-size: 1rem; min-height: 44px; }
    .btn-sm { padding: 0.5rem 0.75rem; font-size: 0.9rem; min-height: 38px; }
    td .btn-sm, td .btn { min-height: 36px; padding: 0.4rem 0.6rem; }

    .form-control, .form-select { font-size: 1rem; padding: 0.65rem 0.8rem; min-height: 44px; }

    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { font-size: 0.95rem; }
    .table th, .table td { padding: 0.7rem 0.6rem; white-space: nowrap; }

    .card-body { padding: 1rem; }
}

@media (min-width: 992px) {
    .container, .container-fluid { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (prefers-contrast: more) {
    :root { --fz-text: #000; --fz-border: #8AA08A; }
    .card { border-width: 2px; }
}

/* ═══════════════════════════════════════════════════════════════════
   Header slim mobile (substitui a navbar grande no portrait)
   ═══════════════════════════════════════════════════════════════════ */
.fz-mobile-header {
    background-color: var(--fz-navbar-bg);
    color: var(--fz-navbar-text);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid var(--fz-brand);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--fz-shadow-sm);
}
.fz-mobile-brand {
    color: var(--fz-navbar-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.fz-mobile-user { font-size: 0.85rem; opacity: 0.85; display: flex; align-items: center; gap: 0.35rem; }

/* ═══════════════════════════════════════════════════════════════════
   Bottom Navigation (fixa no rodapé — mobile portrait)
   ═══════════════════════════════════════════════════════════════════ */
.fz-bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1040;
    background-color: var(--fz-bg-card);
    border-top: 1px solid var(--fz-border);
    box-shadow: 0 -2px 8px rgba(26, 42, 27, 0.07);
    display: flex;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
}
.fz-bottom-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.6rem 0.25rem;
    min-height: 60px;
    text-decoration: none;
    color: var(--fz-text-muted);
    background: none; border: none;
    border-top: 3px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.fz-bottom-item i { font-size: 1.4rem; line-height: 1; }
.fz-bottom-label { font-size: 0.72rem; font-weight: 500; }
.fz-bottom-item:hover, .fz-bottom-item:focus { color: var(--fz-brand); }
.fz-bottom-item.active {
    color: var(--fz-brand);
    border-top-color: var(--fz-brand);
    background-color: rgba(46, 125, 50, 0.06);
}

@media (max-width: 767.98px) {
    main.fz-main, body > main { padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   Offcanvas "Mais" — menu fullscreen no mobile
   ═══════════════════════════════════════════════════════════════════ */
.offcanvas.fz-offcanvas-fullscreen {
    height: 100vh !important;
    height: 100dvh !important;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    display: flex;
    flex-direction: column;
}
.fz-offcanvas-fullscreen .offcanvas-header { padding: 1rem 1.25rem; flex-shrink: 0; }
.fz-offcanvas-fullscreen .offcanvas-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}
.fz-menu-list .list-group-item {
    border: none;
    border-bottom: 1px solid var(--fz-border);
    padding: 0.95rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 1rem;
    color: var(--fz-text);
}
.fz-menu-list .list-group-item i { font-size: 1.3rem; flex-shrink: 0; width: 28px; text-align: center; }
.fz-menu-list .list-group-item:hover { background-color: var(--fz-bg-app); }
.fz-menu-section {
    background-color: var(--fz-bg-app);
    color: var(--fz-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.7rem 1.25rem;
    border-top: 1px solid var(--fz-border);
    border-bottom: 1px solid var(--fz-border);
    position: sticky;
    top: 0;
    z-index: 2;
}

/* ── Login ────────────────────────────────────────────────────────── */
.fz-login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #234D29 0%, #2E7D32 55%, #4E9A53 100%);
    padding: 1rem;
}
.fz-login-card {
    width: 100%;
    max-width: 400px;
    border: none;
    border-radius: 1rem;
    box-shadow: 0 0.75rem 2.5rem rgba(0,0,0,0.30);
    background-color: rgba(255,255,255,0.97);
}
.fz-login-logo {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--fz-brand);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: var(--fz-shadow-md);
}
