* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #e8f3e5;
    min-height: 100vh;
}

/* Top Navigation */
.top-nav {
    background: #1a3b2b;
    color: white;
    padding: 12px 30px;
    box-shadow: 0 4px 12px rgba(0,40,0,0.2);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    color: #ffcccc;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #ffcccc;
    font-size: 0.9rem;
}

/* Container Principal */
.erp-container {
    max-width: 1400px;
    margin: 20px auto;
    background: white;
    border-radius: 30px;
    box-shadow: 0 15px 35px rgba(45, 85, 55, 0.3);
    overflow: hidden;
}

/* Header da Fazenda */
.header-farm {
    background: linear-gradient(135deg, #1e4d2b, #2f6b4a);
    padding: 20px 30px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo-area h1 {
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-area h1 span {
    background: #ffd966;
    color: #1a4d2b;
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 1rem;
}






/* Ajuste para o header com mais stats */
.header-stats {
    display: flex;
    gap: 20px;
    background: rgba(255,255,255,0.1);
    padding: 12px 20px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 1200px) {
    .header-stats {
        gap: 15px;
        padding: 10px 15px;
    }
}

@media (max-width: 768px) {
    .header-stats {
        width: 100%;
        justify-content: space-around;
    }
}




.stat-item {
    text-align: center;
}

.stat-value {
    font-weight: 700;
    font-size: 1.3rem;
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Abas de Navegação */
.tabs {
    display: flex;
    background: #dff0e3;
    padding: 0 20px;
    gap: 5px;
    border-bottom: 2px solid #b8d5c2;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 15px 20px;
    background: transparent;
    border: none;
    font-weight: 600;
    color: #1f4d2e;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: 0.2s;
    text-decoration: none;
    display: inline-block;
}

.tab-btn:hover {
    background: #c0e0cc;
    border-radius: 20px 20px 0 0;
}

.tab-btn.active {
    border-bottom: 3px solid #1f7b3e;
    color: #0d4f23;
    background: #ecffe6;
}

/* Painel de Conteúdo */
.content-panel {
    padding: 25px;
    background: #f5fff8;
    min-height: 600px;
}

/* Cards do Dashboard */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
}

.card-modulo {
    background: white;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(60, 110, 70, 0.1);
    border: 1px solid #c5e3d0;
    transition: 0.2s;
}

.card-modulo:hover {
    box-shadow: 0 8px 20px rgba(30, 100, 50, 0.2);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px dashed #b8e0cb;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.card-header h2 {
    color: #1f4d2e;
    font-size: 1.5rem;
}

.emoji-badge {
    background: #d2f0df;
    width: 45px;
    height: 45px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

/* Tabelas */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

table th {
    background: #e2f0e8;
    color: #1f4d2e;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

table td {
    padding: 10px 12px;
    border-bottom: 1px solid #deecdf;
}

table tr:hover {
    background: #f6fff0;
}

/* Botões */
.btn-primary {
    background: #2d8659;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.1s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    background: #1d6e45;
}

.btn-danger {
    background: #b13e3e;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
}

.btn-warning {
    background: #f4c542;
    color: #1f3d2b;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
}

.btn-small {
    background: #2d8659;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

/* Formulários */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #1f4d2e;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #c0ddce;
    border-radius: 30px;
    font-size: 1rem;
    transition: 0.2s;
}

.form-control:focus {
    border-color: #2d8659;
    outline: none;
    box-shadow: 0 0 0 3px rgba(45,134,89,0.2);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
}

/* Alertas */
.alert {
    padding: 15px 20px;
    border-radius: 30px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4f0da;
    color: #166534;
    border: 1px solid #86d9a0;
}

.alert-error {
    background: #ffe6e6;
    color: #991b1b;
    border: 1px solid #fba5a5;
}

/* Cards de Resumo Financeiro */
.finan-resumo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.caixa-item {
    background: #f0fcf2;
    border-radius: 20px;
    padding: 15px;
    text-align: center;
    border: 1px solid #bfe3ce;
}

.positivo {
    color: #1d8040;
    font-weight: bold;
    font-size: 1.2rem;
}

.negativo {
    color: #c13c3c;
    font-weight: bold;
}

/* Badges */
.badge-success {
    background: #d3f0dc;
    color: #0f6b2f;
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

/* Footer */
.footer-panel {
    background: #cde5d6;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #1a4a2b;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: #1a4a2b;
    text-decoration: none;
    cursor: pointer;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Responsividade */
@media (max-width: 768px) {
    .header-farm {
        flex-direction: column;
        align-items: start;
        gap: 15px;
    }
    
    .header-stats {
        width: 100%;
        justify-content: space-around;
    }
    
    .tabs {
        justify-content: center;
    }
    
    .footer-panel {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* ============================================== */
/* RESPONSIVIDADE PARA MOBILE */
/* ============================================== */

/* Ajustes gerais para mobile */
@media (max-width: 768px) {
    body {
        padding: 0;
        background: white;
    }
    
    .erp-container {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    .header-farm {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        border-radius: 0;
    }
    
    .logo-area h1 {
        font-size: 1.5rem;
        justify-content: center;
    }
    
    .header-stats {
        width: 100%;
        padding: 10px;
        gap: 10px;
        border-radius: 30px;
        flex-wrap: wrap;
    }
    
    .stat-item {
        flex: 1 1 calc(33.333% - 10px);
        min-width: 80px;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .tabs {
        padding: 10px 5px;
        gap: 3px;
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab-btn {
        padding: 10px 12px;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .content-panel {
        padding: 15px 10px;
    }
    
    .module-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .card-modulo {
        padding: 15px;
    }
    
    .card-header h2 {
        font-size: 1.3rem;
    }
    
    /* Cards de estatísticas */
    [style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .caixa-item {
        padding: 10px;
    }
    
    /* Tabelas responsivas */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 10px -5px;
        padding: 0 5px;
    }
    
    table {
        min-width: 600px;
        font-size: 0.85rem;
    }
    
    table th, table td {
        padding: 8px 5px;
    }
    
    /* Formulários */
    .form-container {
        padding: 15px;
        margin: 0 -5px;
        border-radius: 15px;
    }
    
    .form-row[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    .btn-primary, .btn-warning, .btn-danger {
        padding: 8px 12px;
        font-size: 0.9rem;
        width: 100%;
        text-align: center;
    }
    
    .actions {
        display: flex;
        gap: 5px;
        flex-wrap: wrap;
    }
    
    .actions .btn-small {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    /* Footer */
    .footer-panel {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 15px;
    }
    
    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* Gráficos */
    canvas {
        max-height: 200px !important;
    }
    
    /* Módulo específico - Gado */
    [style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Ajuste para os ícones de ação */
    .btn-small {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* Telas muito pequenas */
@media (max-width: 480px) {
    .header-stats {
        gap: 5px;
    }
    
    .stat-item {
        flex: 1 1 calc(50% - 10px);
    }
    
    .tabs {
        padding: 5px;
    }
    
    .tab-btn {
        padding: 8px 8px;
        font-size: 0.8rem;
    }
    
    .card-header {
        flex-direction: column;
        text-align: center;
    }
    
    .module-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch !important;
    }
    
    .module-header .btn-primary {
        width: 100%;
    }
}

/* Landscape */
@media (max-width: 900px) and (orientation: landscape) {
    .tabs {
        overflow-x: auto;
    }
    
    .stat-item {
        flex: 1 1 calc(16.666% - 10px);
    }
}