/* ============================================
   ROCA INTELIGENTE - SaaS de Gestao Agricola
   Estilos Globais
   ============================================ */

:root {
    --verde-escuro: #2D5016;
    --verde-medio: #4A7C2F;
    --verde-claro: #7DB544;
    --terra: #8B4513;
    --palha: #F5E6C8;
    --areia: #FAF6EE;
    --amarelo: #F5A623;
    --vermelho: #D0021B;
    --azul: #1A5276;
    --cinza-claro: #F5F5F5;
    --branco: #FFFFFF;
    --cinza-medio: #E0E0E0;
    --cinza-texto: #1C1C1C;
    --cinza-subtexto: #666666;
    --sombra: 0 2px 8px rgba(0,0,0,0.08);
    --sombra-hover: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 8px;
    --sidebar-width: 250px;
    --header-height: 60px;
    --transition: all 0.3s ease;
    --font-hero: 'Playfair Display', serif;
    --font-subtitle: 'Nunito', sans-serif;
    --font-body: 'Rubik', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--areia);
    color: var(--cinza-texto);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--verde-medio);
    text-decoration: none;
}

a:hover {
    color: var(--verde-escuro);
}

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--verde-escuro);
    color: var(--branco);
    z-index: 1000;
    overflow-y: auto;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-header small {
    font-size: 11px;
    opacity: 0.7;
    display: block;
    margin-top: 4px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--branco);
}

.sidebar-nav a.active {
    background: rgba(255,255,255,0.15);
    color: var(--branco);
    border-left-color: var(--verde-claro);
    font-weight: 600;
}

.sidebar-nav a .nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Sidebar Footer (user info + logout) */
.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user {
    margin-bottom: 10px;
}
.sidebar-user strong {
    display: block;
    font-size: 13px;
    color: var(--branco);
}
.sidebar-user small {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
}
.btn-logout {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    color: var(--branco);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-logout:hover {
    background: rgba(255,255,255,0.2);
}
.sidebar-suporte {
    display: block;
    margin-top: 12px;
    font-size: 11px;
    line-height: 1.5;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    word-break: break-word;
}
.sidebar-suporte:hover {
    color: var(--branco);
}

/* ---- HEADER ---- */
.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--branco);
    border-bottom: 1px solid var(--cinza-medio);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
    transition: var(--transition);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h1 {
    font-size: 18px;
    color: var(--verde-escuro);
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

.header-date {
    font-size: 13px;
    color: var(--cinza-subtexto);
}

.header-user {
    font-size: 13px;
    font-weight: 600;
    color: var(--verde-escuro);
}

/* Botao Ajuda no header — abre modal de suporte. Criado 2026-05-25. */
.btn-ajuda {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: rgba(45, 80, 22, 0.08);
    color: var(--verde-escuro, #2D5016);
    border: 1.5px solid rgba(45, 80, 22, 0.25);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    font-family: 'Montserrat', sans-serif;
    padding: 0;
}
.btn-ajuda:hover, .btn-ajuda:focus {
    background: rgba(45, 80, 22, 0.16);
    border-color: rgba(45, 80, 22, 0.4);
    outline: none;
}
.btn-ajuda:active { transform: scale(0.95); }

/* Modal de suporte — overlay + card. Criado 2026-05-25. */
.support-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: supportFadeIn 0.15s ease-out;
}
@keyframes supportFadeIn { from { opacity: 0 } to { opacity: 1 } }

.support-modal-card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: supportSlideUp 0.2s ease-out;
}
@keyframes supportSlideUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.support-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.05);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--cinza-subtexto, #666);
    display: flex;
    align-items: center;
    justify-content: center;
}
.support-modal-close:hover { background: rgba(0,0,0,0.1); }

.support-modal-card h3 {
    margin: 0 0 6px 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--verde-escuro, #2D5016);
    padding-right: 32px;
}

.support-modal-sub {
    margin: 0 0 18px 0;
    font-size: 14px;
    color: var(--cinza-subtexto, #666);
    line-height: 1.4;
}

.support-modal-field {
    margin-bottom: 14px;
}
.support-modal-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--cinza-subtexto, #666);
    margin-bottom: 4px;
}
.support-modal-field label .opcional {
    font-size: 11px;
    font-weight: 500;
    color: #999;
    margin-left: 4px;
}
.support-modal-field label .obrigatorio {
    color: var(--vermelho, #c0392b);
}
.support-modal-field input, .support-modal-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--cinza-medio, #ddd);
    border-radius: 8px;
    /* 16px obrigatorio: evita zoom iOS Safari */
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    color: var(--cinza-texto, #333);
    box-sizing: border-box;
}
.support-modal-field textarea {
    resize: vertical;
    min-height: 100px;
}
.support-modal-field input:focus, .support-modal-field textarea:focus {
    outline: none;
    border-color: var(--verde-principal, #4a7c2f);
    box-shadow: 0 0 0 3px rgba(74, 124, 47, 0.15);
}

.support-modal-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 480px) {
    .support-modal-row { grid-template-columns: 1fr; gap: 0; }
}

.support-modal-hint {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    line-height: 1.3;
}

.support-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    flex-wrap: wrap;
}
.support-modal-actions button {
    min-height: 44px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    font-family: inherit;
}
.support-modal-actions .btn-primary {
    background: var(--verde-escuro, #2D5016);
    color: #fff;
}
.support-modal-actions .btn-primary:hover { background: var(--verde-principal, #4a7c2f); }
.support-modal-actions .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.support-modal-actions .btn-secondary {
    background: rgba(0,0,0,0.05);
    color: var(--cinza-texto, #333);
}
.support-modal-actions .btn-secondary:hover { background: rgba(0,0,0,0.1); }

@media (max-width: 480px) {
    .support-modal-actions { flex-direction: column-reverse; }
    .support-modal-actions button { width: 100%; }
}

.btn-hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--verde-escuro);
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
}

.btn-voltar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--cinza-claro);
    color: var(--verde-escuro);
    font-size: 20px;
    text-decoration: none;
    transition: var(--transition);
    margin-right: 8px;
    flex-shrink: 0;
}

.btn-voltar:hover {
    background: var(--verde-claro);
    color: var(--branco);
}

.btn-notificacoes {
    position: relative;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.btn-notificacoes:hover {
    background: var(--cinza-claro);
}

.badge-notificacao {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--vermelho);
    color: var(--branco);
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
    transition: var(--transition);
}

/* ---- CARDS ---- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: var(--branco);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--sombra);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--sombra-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.card-title {
    font-size: 13px;
    color: var(--cinza-subtexto);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.card-icon {
    font-size: 24px;
}

.card-valor {
    font-size: clamp(16px, 2.8vw, 28px);
    font-weight: 700;
    color: var(--cinza-texto);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-valor.positivo { color: var(--verde-medio); }
.card-valor.negativo { color: var(--vermelho); }
.card-valor.neutro { color: var(--azul); }

.card-comparativo {
    font-size: 12px;
    color: var(--cinza-subtexto);
}

.card-comparativo .up { color: var(--verde-medio); }
.card-comparativo .down { color: var(--vermelho); }

/* ---- GRAFICOS ---- */
.graficos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.grafico-container {
    background: var(--branco);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--sombra);
}

.grafico-container h3 {
    font-size: 15px;
    color: var(--cinza-texto);
    margin-bottom: 16px;
    font-weight: 600;
}

/* ---- ALERTAS ---- */
.alertas-section {
    margin-bottom: 24px;
}

.alertas-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--cinza-texto);
}

.alerta-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--branco);
    border-radius: var(--radius);
    margin-bottom: 8px;
    box-shadow: var(--sombra);
    border-left: 4px solid var(--amarelo);
}

.alerta-item.urgente { border-left-color: var(--vermelho); }
.alerta-item.info { border-left-color: var(--azul); }
.alerta-item.sucesso { border-left-color: var(--verde-medio); }

.alerta-icon {
    font-size: 20px;
}

.alerta-texto {
    flex: 1;
}

.alerta-texto strong {
    display: block;
    font-size: 14px;
}

.alerta-texto small {
    color: var(--cinza-subtexto);
    font-size: 12px;
}

/* ---- TABELAS ---- */
.tabela-container {
    background: var(--branco);
    border-radius: var(--radius);
    box-shadow: var(--sombra);
    overflow: hidden;
    margin-bottom: 24px;
}

.tabela-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cinza-medio);
    flex-wrap: wrap;
    gap: 12px;
}

.tabela-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.tabela-filtros {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: var(--cinza-claro);
    padding: 12px 16px;
    text-align: left;
    /* 13px legivel em mobile (era 12px). Header de tabela e texto critico. Fix UX 2026-05-25. */
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cinza-subtexto);
    font-weight: 600;
    border-bottom: 2px solid var(--cinza-medio);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--cinza-claro);
}

tbody tr:hover {
    background: rgba(125, 181, 68, 0.05);
}

.tabela-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid var(--cinza-medio);
    font-size: 13px;
    color: var(--cinza-subtexto);
}

.paginacao {
    display: flex;
    gap: 4px;
}

.paginacao button {
    padding: 6px 12px;
    border: 1px solid var(--cinza-medio);
    background: var(--branco);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.paginacao button:hover,
.paginacao button.active {
    background: var(--verde-medio);
    color: var(--branco);
    border-color: var(--verde-medio);
}

/* ---- BOTOES ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--verde-medio);
    color: var(--branco);
}

.btn-primary:hover {
    background: var(--verde-escuro);
}

.btn-secondary {
    background: var(--branco);
    color: var(--cinza-texto);
    border: 1px solid var(--cinza-medio);
}

.btn-secondary:hover {
    background: var(--cinza-claro);
}

.btn-danger {
    background: var(--vermelho);
    color: var(--branco);
}

.btn-danger:hover {
    background: #b0011a;
}

.btn-small {
    padding: 10px 14px;
    font-size: 13px;
    /* min 44px = WCAG 2.2 AAA touch target. Antes era 36px, errar toque era facil. Fix UX 2026-05-25. */
    min-height: 44px;
}

.btn-icon {
    padding: 8px;
    border-radius: 50%;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    /* min 44px = WCAG 2.2 AAA. Antes era 40px. Fix UX 2026-05-25. */
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--cinza-claro);
}

/* ---- FORMULARIOS ---- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    /* 14px legivel em mobile (era 13px). Labels de form sao texto critico. Fix UX 2026-05-25. */
    font-size: 14px;
    font-weight: 600;
    color: var(--cinza-subtexto);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--cinza-medio);
    border-radius: var(--radius);
    /* font-size 16px obrigatorio: iOS Safari da zoom automatico em inputs <16px ao tocar. UX terrivel em iPhone. Fix UX 2026-05-25. */
    font-size: 16px;
    transition: var(--transition);
    background: var(--branco);
    color: var(--cinza-texto);
}

.form-control:focus {
    outline: none;
    border-color: var(--verde-medio);
    box-shadow: 0 0 0 3px rgba(74,124,40,0.15);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-inline {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* ---- MODAL ---- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 16px;
    overflow-y: auto;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--branco);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cinza-medio);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--cinza-subtexto);
    padding: 0 4px;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--cinza-medio);
}

/* ---- ABAS ---- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--cinza-medio);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--cinza-subtexto);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
}

.tab:hover {
    color: var(--verde-medio);
}

.tab.active {
    color: var(--verde-escuro);
    border-bottom-color: var(--verde-medio);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ---- STATUS BADGES ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-ativo { background: #E8F5E9; color: #2E7D32; }
.badge-colhido { background: #E3F2FD; color: #1565C0; }
.badge-perdido { background: #FFEBEE; color: #C62828; }
.badge-planejado { background: #FFF3E0; color: #E65100; }
.badge-pago { background: #E8F5E9; color: #2E7D32; }
.badge-pendente { background: #FFF3E0; color: #E65100; }
.badge-manutencao { background: #FFF3E0; color: #E65100; }
.badge-encerrado { background: #ECEFF1; color: #546E7A; }
.badge-cancelado { background: #FFEBEE; color: #C62828; }
.badge-percentual { background: #E3F2FD; color: #1565C0; }
.badge-valor_fixo { background: #FFF8E1; color: #F57F17; }
.badge-recebido { background: #E8F5E9; color: #2E7D32; }
.badge-a_receber { background: #FFF3E0; color: #E65100; }
.badge-inativo { background: #ECEFF1; color: #546E7A; }

/* ---- PAINEL LATERAL (MAPA) ---- */
.painel-lateral {
    position: fixed;
    right: -400px;
    top: var(--header-height);
    width: 400px;
    height: calc(100vh - var(--header-height));
    background: var(--branco);
    box-shadow: -4px 0 16px rgba(0,0,0,0.1);
    z-index: 500;
    overflow-y: auto;
    transition: var(--transition);
}

.painel-lateral.open {
    right: 0;
}

.painel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cinza-medio);
    background: var(--verde-escuro);
    color: var(--branco);
}

.painel-body {
    padding: 20px;
}

/* ---- TIMELINE ---- */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--cinza-medio);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding-left: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--verde-medio);
    border: 2px solid var(--branco);
}

.timeline-data {
    font-size: 12px;
    color: var(--cinza-subtexto);
    margin-bottom: 4px;
}

.timeline-titulo {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.timeline-desc {
    font-size: 13px;
    color: var(--cinza-subtexto);
}

/* ---- UTILITARIOS ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--cinza-subtexto); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }

.valor-positivo { color: var(--verde-medio); font-weight: 600; }
.valor-negativo { color: var(--vermelho); font-weight: 600; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--cinza-subtexto);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 16px;
}

/* ---- NOTIFICACOES PANEL ---- */
.notificacoes-panel {
    position: fixed;
    top: var(--header-height);
    right: 24px;
    width: 360px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--branco);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: none;
    z-index: 1001;
}

.notificacoes-panel.show {
    display: block;
}

.notificacoes-panel h4 {
    padding: 12px 16px;
    border-bottom: 1px solid var(--cinza-medio);
    font-size: 14px;
}

.notificacao-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--cinza-claro);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.notificacao-item:hover {
    background: var(--cinza-claro);
}

/* ---- LOADING ---- */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--cinza-medio);
    border-top-color: var(--verde-medio);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- TELA DE LOGIN ---- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--verde-escuro) 0%, var(--verde-medio) 100%);
}

.login-box {
    background: var(--branco);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    text-align: center;
}

.login-box h1 {
    color: var(--verde-escuro);
    font-size: 22px;
    margin-bottom: 4px;
}

.login-box p {
    color: var(--cinza-subtexto);
    font-size: 14px;
    margin-bottom: 24px;
}

.login-box .form-control {
    text-align: center;
    font-size: 16px;
}

.login-box .btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    justify-content: center;
    margin-top: 12px;
}

.login-error {
    color: var(--vermelho);
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

/* ---- TOAST ---- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    color: var(--branco);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
    max-width: 360px;
}

.toast-success { background: var(--verde-medio); }
.toast-error { background: var(--vermelho); }
.toast-warning { background: var(--amarelo); color: var(--cinza-texto); }
.toast-info { background: var(--azul); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .header {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .btn-hamburger {
        display: block;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .graficos-grid {
        grid-template-columns: 1fr;
    }

    .painel-lateral {
        width: 100%;
        right: -100%;
    }

    .modal {
        max-width: calc(100vw - 32px);
        margin: 16px auto;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .tabela-container {
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    .notificacoes-panel {
        position: fixed;
        width: calc(100vw - 32px);
        right: 16px;
    }

    /* Esconder colunas menos importantes em tabelas no mobile/tablet */
    .hide-mobile {
        display: none !important;
    }
}

@media (max-width: 480px) {
    table {
        min-width: auto;
    }

    .cards-grid {
        grid-template-columns: 1fr 1fr;
    }

    .card-valor {
        font-size: clamp(16px, 8vw, 22px);
    }

    .main-content {
        padding: 12px;
    }

    .resumo-cards {
        grid-template-columns: 1fr 1fr;
    }

    .notificacoes-panel {
        width: calc(100vw - 24px);
        right: 12px;
    }

    table {
        min-width: auto;
    }

    .tabela-header {
        flex-direction: column;
        gap: 8px;
    }

    .tabela-filtros {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .tabela-filtros .form-control,
    .tabela-filtros .btn {
        width: 100%;
    }
}

/* ---- INSIGHT CARDS (Dicas Inteligentes) ---- */
.insights-section {
    margin-bottom: 24px;
}

.insights-section h3 {
    font-size: 16px;
    color: var(--cinza-texto);
    margin-bottom: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insights-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.insight-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--branco);
    border-radius: var(--radius);
    box-shadow: var(--sombra);
    border-left: 4px solid var(--cinza-medio);
    transition: var(--transition);
    position: relative;
}

.insight-card:hover {
    box-shadow: var(--sombra-hover);
}

.insight-card.insight-clima {
    border-left-color: #3b82f6;
}

.insight-card.insight-financeiro {
    border-left-color: #f59e0b;
}

.insight-card.insight-colheita {
    border-left-color: var(--verde-medio);
}

.insight-card.insight-alerta {
    border-left-color: var(--vermelho);
}

.insight-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.insight-body {
    flex: 1;
    min-width: 0;
}

.insight-titulo {
    font-size: 14px;
    font-weight: 600;
    color: var(--cinza-texto);
    margin-bottom: 2px;
}

.insight-texto {
    font-size: 13px;
    color: var(--cinza-subtexto);
    line-height: 1.4;
}

.insight-fechar {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--cinza-subtexto);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    opacity: 0.5;
    transition: var(--transition);
}

.insight-fechar:hover {
    opacity: 1;
    background: var(--cinza-claro);
}

@media (max-width: 768px) {
    .insight-card {
        padding: 12px 14px;
    }

    .insight-titulo {
        font-size: 13px;
        padding-right: 24px;
    }

    .insight-texto {
        font-size: 12px;
    }
}

/* ---- SAUDACAO ---- */
.saudacao h2 {
    font-family: var(--font-subtitle);
    font-size: 22px;
    color: var(--verde-escuro);
    font-weight: 600;
}

.saudacao p {
    font-size: 14px;
}

/* ---- TRIAL BANNER ---- */
.trial-banner {
    padding: 10px 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 998;
}

.trial-banner + .header {
    top: 40px;
}

.trial-banner + .header ~ .main-content {
    margin-top: calc(var(--header-height) + 40px);
}

.trial-aviso {
    background: #fef3c7;
    border-bottom: 1px solid #f59e0b;
    color: #92400e;
}

.trial-bloqueado {
    background: #fee2e2;
    border-bottom: 1px solid #f87171;
    color: #991b1b;
}

.trial-banner .btn-small {
    background: var(--verde-medio);
    color: var(--branco);
    border: none;
    border-radius: var(--radius);
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
}

/* ---- KPI MONO FONT ---- */
.card-valor {
    font-family: var(--font-mono);
}

/* ---- SIDEBAR HEADER FONT ---- */
.sidebar-header h2 {
    font-family: var(--font-subtitle);
}

/* ---- HEADER TITLE FONT ---- */
.header-left h1 {
    font-family: var(--font-subtitle);
}

/* ---- TALHOES DASHBOARD CARDS ---- */
.talhoes-dash-section {
    margin-bottom: 24px;
}

.talhoes-dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.talhoes-dash-header h3 {
    font-size: 16px;
    color: var(--cinza-texto);
    font-weight: 600;
}

.talhoes-dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.talhao-dash-card {
    background: var(--branco);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--sombra);
    cursor: pointer;
    transition: var(--transition);
    border-left: 5px solid var(--verde-medio);
}

.talhao-dash-card:hover {
    box-shadow: var(--sombra-hover);
    transform: translateY(-2px);
}

.talhao-dash-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.talhao-dash-nome {
    font-size: 15px;
    font-weight: 600;
    color: var(--verde-escuro);
    margin: 0 0 2px 0;
}

.talhao-dash-area {
    font-size: 12px;
    color: var(--cinza-subtexto);
    font-family: var(--font-mono);
}

.talhao-dash-cultivo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--cinza-texto);
    margin-bottom: 10px;
}

.talhao-dash-sem-cultivo {
    color: var(--cinza-subtexto);
    font-style: italic;
}

.talhao-dash-metricas {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.talhao-dash-metrica {
    flex: 1;
}

.talhao-dash-metrica-label {
    display: block;
    /* 13px legivel em mobile (era 11px). Label de metrica do talhao. Fix UX 2026-05-25. */
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--cinza-subtexto);
    font-weight: 600;
    margin-bottom: 2px;
}

.talhao-dash-metrica-valor {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.talhao-dash-colheita {
    font-size: 12px;
    color: var(--terra);
    background: #FFF8E1;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

@media (max-width: 768px) {
    .talhoes-dash-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .talhao-dash-metricas {
        flex-direction: column;
        gap: 6px;
    }
}

/* ---- PRINT ---- */
@media print {
    .sidebar,
    .header,
    .btn,
    .modal-overlay,
    .toast-container {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    body {
        background: white;
    }
}

/* ============================================================
   A BARRA DE BAIXO — 4 botões no celular   (11/08/2026)

   No celular o menu lateral sai da tela e fica atrás de um hambúrguer, com
   até 12 itens dentro. Esta barra põe na mão do polegar as 3 telas que as
   fazendas realmente usam (financeiro 120 · talhões 104) mais a porta pro
   resto.

   Só existe até 768px: no computador o menu lateral já está sempre visível e
   uma barra embaixo seria ruído.
   ============================================================ */
.barra-inferior { display: none; }

@media (max-width: 768px) {
    .barra-inferior {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 900;
        background: var(--branco, #fff);
        border-top: 1px solid rgba(45,80,22,0.15);
        /* o recorte do iPhone come a barra se ela não respeitar a área segura */
        padding-bottom: env(safe-area-inset-bottom, 0);
        box-shadow: 0 -2px 12px rgba(0,0,0,0.07);
    }
    .barra-item {
        /* 60px: acima do mínimo de 48 do Android, porque aqui é dedo no sol */
        min-height: 60px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        border: 0;
        background: transparent;
        font-family: inherit;
        font-size: 11px;
        font-weight: 600;
        color: #5b5b5b;
        text-decoration: none;
        cursor: pointer;
    }
    .barra-item .barra-icone { font-size: 21px; line-height: 1; }
    .barra-item.ativo { color: var(--verde-escuro, #2D5016); }

    /* A barra é fixa: sem esta folga ela cobre o último lançamento da lista,
       e o produtor nunca vê o que acabou de anotar. */
    .main-content {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }
}

@media print {
    .barra-inferior { display: none !important; }
}
