body { margin: 0; font-family: 'Segoe UI', sans-serif; background: #eef7f0; }

/* MODO ESCURO */
body.dark { background: #0d1f0e; color: #e0f2e0; }
body.dark .card { background: #1a2e1a; color: #e0f2e0; box-shadow: 0 10px 25px rgba(0,0,0,0.4); }
body.dark nav { background: #0a1a0a; }
body.dark footer { background: #0a1a0a; }
body.dark .sim-input { background: #1a2e1a; color: #e0f2e0; border-color: #2e7d32; }
body.dark .sustentabilidade-links a { background: #1a3320; color: #81c784; }
body.dark .sustentabilidade-links a:hover { background: #1f4028; }
body.dark #toggle-dark { background: #81c784; color: #0d1f0e; }

#toggle-dark {
    position: fixed; bottom: 20px; left: 20px;
    background: #1b5e20; color: white;
    border: none; border-radius: 50px; padding: 10px 16px;
    cursor: pointer; font-size: 18px; z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: 0.3s;
}
#toggle-dark:hover { transform: scale(1.1); }

/* CHATBOT */
#btn-chatbot {
    position: fixed; bottom: 20px; right: 20px;
    background: #2e7d32; color: white;
    border: none; border-radius: 50px; padding: 10px 16px;
    cursor: pointer; font-size: 20px; z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: 0.3s;
}
#btn-chatbot:hover { transform: scale(1.1); }
#chat-overlay {
    display: none; position: fixed; bottom: 80px; right: 20px;
    width: 360px; max-height: 520px; background: white;
    border-radius: 18px; box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    z-index: 1001; flex-direction: column; overflow: hidden;
    border: 1px solid #c8e6c9;
}
#chat-overlay.aberto { display: flex; }
body.dark #chat-overlay { background: #1a2e1a; border-color: #2e7d32; }
#chat-header {
    background: #1b5e20; color: white; padding: 14px 18px;
    font-weight: bold; font-size: 15px;
    display: flex; justify-content: space-between; align-items: center;
}
#chat-header button { background: none; border: none; color: white; font-size: 18px; cursor: pointer; padding: 0; }
#chat-mensagens {
    flex: 1; overflow-y: auto; padding: 14px;
    display: flex; flex-direction: column; gap: 10px; max-height: 360px;
}
.chat-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; }
.chat-msg.bot { background: #e8f5e9; color: #1b2e1b; align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-msg.user { background: #1b5e20; color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
body.dark .chat-msg.bot { background: #1f3d1f; color: #e0f2e0; }
.chat-msg.loading { opacity: 0.6; font-style: italic; }
#chat-input-area {
    display: flex; gap: 8px; padding: 12px;
    border-top: 1px solid #c8e6c9; background: #f9fbe7;
}
body.dark #chat-input-area { background: #0f1f0f; border-color: #2e7d32; }
#chat-input {
    flex: 1; padding: 9px 12px; border-radius: 20px;
    border: 1px solid #a5d6a7; outline: none; font-size: 13px;
    background: white; color: #1b2e1b;
}
body.dark #chat-input { background: #1a2e1a; color: #e0f2e0; border-color: #2e7d32; }
#chat-send {
    background: #1b5e20; color: white; border: none;
    border-radius: 50%; width: 36px; height: 36px;
    font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
#chat-send:hover { background: #2e7d32; }
@media (max-width: 600px) {
    #chat-overlay { width: calc(100vw - 20px); right: 10px; bottom: 75px; }
    #toggle-dark { bottom: 75px; left: 15px; }
    #btn-chatbot { bottom: 75px; right: 15px; }
}

/* ===== MENU ACESSIBILIDADE / DALTONISMO ===== */
#acesso-wrap {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 9999;
    font-family: 'Segoe UI', sans-serif;
}
#acesso-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #fff;
    color: #1b5e20;
    border: 2px solid #1b5e20;
    border-radius: 30px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0,0,0,0.18);
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
#acesso-btn:hover { background: #1b5e20; color: #fff; }
#acesso-btn svg { flex-shrink: 0; }
body.dark #acesso-btn { background: #1a2e1a; color: #81c784; border-color: #81c784; }
body.dark #acesso-btn:hover { background: #2e7d32; color: #fff; }

#acesso-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 230px;
    background: #fff;
    border: 1.5px solid #c8e6c9;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    overflow: hidden;
}
body.dark #acesso-menu { background: #1a2e1a; border-color: #2e7d32; }

.acesso-titulo {
    padding: 9px 16px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888;
}
body.dark .acesso-titulo { color: #66bb6a; }

.acesso-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 16px;
    font-size: 13.5px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: #1b2e1b;
    transition: background 0.15s;
    font-family: inherit;
}
.acesso-item:hover { background: #f1f8f1; }
body.dark .acesso-item { color: #c8e6c9; }
body.dark .acesso-item:hover { background: #223322; }
.acesso-item.ativo { background: #e8f5e9; font-weight: 700; color: #1b5e20; }
body.dark .acesso-item.ativo { background: #1f3d1f; color: #81c784; }
.acesso-item .dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid #ccc; flex-shrink: 0;
}
.acesso-item.ativo .dot { border-color: #1b5e20; background: #1b5e20; }
body.dark .acesso-item.ativo .dot { border-color: #81c784; background: #81c784; }
.acesso-sep { height: 1px; background: #e8f5e9; margin: 2px 0; }
body.dark .acesso-sep { background: #2e3d2e; }

/* AMOSTRAS DE COR */
.acesso-swatch {
    display: flex; gap: 3px; margin-left: auto;
}
.acesso-swatch span {
    width: 10px; height: 10px; border-radius: 50%;
    display: inline-block;
}

@media (max-width: 480px) {
    #acesso-wrap { top: 8px; left: 8px; }
    #acesso-btn { font-size: 12px; padding: 6px 12px; }
    #acesso-menu { min-width: 200px; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.page.active .card {
    animation: fadeInUp 0.4s ease both;
}

/* FUNDO DE LOGIN CORRIGIDO */
#tela-login {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #1b5e20 url('café.w.png') no-repeat center center fixed;
    background-size: cover;
    display: flex; align-items: center; justify-content: center; z-index: 2000;
}

.login-box { 
    background: rgba(255, 255, 255, 0.15); 
    backdrop-filter: blur(15px);
    padding: 40px; border-radius: 20px; 
    text-align: center; width: 320px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.login-box h2 { color: white; text-shadow: 1px 1px 4px rgba(0,0,0,0.6); margin-bottom: 20px; }
.login-box input { display: block; width: 90%; margin: 15px auto; padding: 12px; border: none; border-radius: 8px; outline: none; }

header {
   
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)),
    url('girassol.png');
    background-size: cover; background-position: center;
    color: white; text-align: center; padding: 90px 20px;
    position: relative;
}
header h1 { font-size: 45px; margin: 0; }

#info-usuario-canto {
    position: absolute; top: 10px; right: 15px;
    font-size: 12px; text-align: right;
    background: rgba(0,0,0,0.3); padding: 5px 10px; border-radius: 20px;
}

/* ===== NAV DESKTOP — GRUPOS COM DROPDOWN ===== */
nav {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1b5e20;
    gap: 4px;
    padding: 0 16px;
    position: relative;
    z-index: 500;
}

/* link direto */
nav > a {
    color: white;
    padding: 13px 14px;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
    white-space: nowrap;
}
nav > a:hover { background: rgba(255,255,255,0.15); border-radius: 6px; }

/* grupo dropdown */
.nav-grupo {
    position: relative;
}
.nav-grupo > .nav-grupo-btn {
    color: white;
    padding: 13px 14px;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    user-select: none;
    transition: background 0.2s;
    border-radius: 6px;
}
.nav-grupo > .nav-grupo-btn:hover,
.nav-grupo:hover > .nav-grupo-btn { background: rgba(255,255,255,0.15); }

.nav-grupo-btn .chevron {
    font-size: 9px;
    opacity: 0.75;
    transition: transform 0.2s;
}
.nav-grupo:hover .chevron { transform: rotate(180deg); }

/* dropdown panel */
.nav-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    background: #1b5e20;
    border-radius: 0 10px 10px 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    min-width: 190px;
    overflow: hidden;
    z-index: 600;
}
.nav-grupo:hover .nav-dropdown { display: block; }

.nav-dropdown a {
    display: flex;
    align-items: center;
    gap: 9px;
    color: white;
    text-decoration: none;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
    white-space: nowrap;
}
.nav-dropdown a:hover { background: rgba(255,255,255,0.15); }
.nav-dropdown a .dd-icon { font-size: 15px; }

body.dark .nav-dropdown { background: #0a1a0a; }
body.dark nav { background: #0a1a0a; }

.container { padding: 20px; }
.card {
    background: white; padding: 20px; margin: 15px 0;
    border-radius: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: 0.3s;
}
.card:hover { transform: translateY(-6px); }

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 20px; 
}

img { width: 100%; height: 200px; object-fit: cover; border-radius: 12px; }
.metric { text-align: center; font-size: 20px; }
button { padding: 10px 15px; border: none; background: #43a047; color: white; border-radius: 8px; cursor: pointer; font-weight: bold; }
button:hover { background: #2e7d32; }
.page { display: none; }
.active { display: block; }
footer { text-align: center; padding: 15px; background: #2e7d32; color: white; }

.sim-input { width: 100%; padding: 8px; margin: 5px 0 10px 0; border: 1px solid #ddd; border-radius: 8px; box-sizing: border-box; }
.tech-info { border-left: 4px solid #43a047; padding-left: 15px; list-style: none; padding-top: 5px; line-height: 1.8; }
.tech-info b { color: #1b5e20; }

.cronograma-item { border-bottom: 2px solid #eef7f0; padding: 10px 0; }
.cronograma-item b { color: #1b5e20; display: block; margin-bottom: 5px; }

.sustentabilidade-links { margin-top: 25px; padding-top: 15px; border-top: 2px solid #eef7f0; }
.sustentabilidade-links a { 
    display: block; 
    color: #2e7d32; 
    text-decoration: none; 
    margin: 12px 0; 
    font-weight: bold;
    padding: 10px;
    background: #f0fdf4;
    border-radius: 8px;
    border-left: 4px solid #1b5e20;
}
.sustentabilidade-links a:hover { background: #dcfce7; }

/* CRONOGRAMA VISUAL */
.crono-visual { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 12px; }
.crono-visual th { background: #1b5e20; color: white; padding: 6px 4px; text-align: center; }
.crono-visual td { padding: 5px 4px; text-align: center; border: 1px solid #eef7f0; }
.crono-barra { border-radius: 4px; height: 18px; display: block; }
.crono-plantio { background: #81c784; }
.crono-colheita { background: #f9a825; }
.crono-florada { background: #64b5f6; }
.crono-legenda { display: flex; gap: 15px; margin-top: 8px; font-size: 12px; flex-wrap: wrap; }
.crono-legenda span { display: flex; align-items: center; gap: 5px; }
.crono-legenda .dot { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }

/* PRAGAS */
.praga-card { border-left: 4px solid #e53935; padding: 10px 15px; margin: 8px 0; background: #fff8f8; border-radius: 8px; }
body.dark .praga-card { background: #2a1a1a; }
.praga-card b { color: #c62828; }

/* CALCULADORA DE CUSTO */
.custo-resultado { margin-top: 15px; padding: 15px; background: #f0fdf4; border-radius: 10px; border-left: 4px solid #43a047; font-size: 15px; line-height: 2; }
body.dark .custo-resultado { background: #1a3320; }

/* DIÁRIO AGRÍCOLA */
.diario-nota {
    background: #f0fdf4;
    border-left: 4px solid #43a047;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    position: relative;
}
body.dark .diario-nota { background: #1a3320; }
.diario-nota-data {
    font-size: 11px;
    color: #888;
    margin-bottom: 6px;
    font-weight: 600;
    letter-spacing: 0.03em;
}
body.dark .diario-nota-data { color: #81c784; }
.diario-nota-texto {
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}
.diario-btn-excluir {
    position: absolute;
    top: 10px; right: 12px;
    background: none;
    border: none;
    color: #e53935;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1;
    font-weight: bold;
    transition: background 0.15s;
}
.diario-btn-excluir:hover { background: #fff0f0; }
body.dark .diario-btn-excluir:hover { background: #3a1a1a; }
.diario-vazio {
    text-align: center;
    color: #aaa;
    font-size: 14px;
    padding: 30px 0;
    border: 2px dashed #c8e6c9;
    border-radius: 10px;
    margin-top: 8px;
}
body.dark .diario-vazio { border-color: #2e5c2e; color: #66bb6a; }

/* CLIMA */
.clima-box { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.clima-temp { font-size: 48px; font-weight: bold; color: #1b5e20; }
.clima-info { font-size: 14px; line-height: 1.8; }
body.dark .clima-temp { color: #81c784; }

/* ========== MOBILE NAV BOTTOM BAR ========== */
#mobile-nav { display: none; }
#drawer-extra { display: none; }

@media (max-width: 600px) {
    .grid { grid-template-columns: 1fr; }
    header h1 { font-size: 28px; }
    header { padding: 60px 15px 50px; }
    .crono-visual { font-size: 10px; }

    nav:not(#mobile-nav) { display: none !important; }

    #mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: #1b5e20;
        z-index: 999;
        justify-content: space-around;
        align-items: center;
        padding: 8px 0 10px;
        box-shadow: 0 -3px 12px rgba(0,0,0,0.25);
    }
    #mobile-nav a {
        color: white;
        text-decoration: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: 10px;
        gap: 3px;
        flex: 1;
        opacity: 0.85;
        transition: opacity 0.2s;
    }
    #mobile-nav a:hover { opacity: 1; }
    #mobile-nav a span.icon { font-size: 20px; }

    #btn-menu-extra {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: white;
        font-size: 10px;
        gap: 3px;
        flex: 1;
        cursor: pointer;
        background: none;
        border: none;
        padding: 0;
        opacity: 0.85;
    }
    #btn-menu-extra span.icon { font-size: 20px; }

    #drawer-extra {
        display: none;
        position: fixed;
        bottom: 62px; left: 0; right: 0;
        background: #1b5e20;
        z-index: 998;
        padding: 12px 15px 16px;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    #drawer-extra.aberto { display: flex; }
    #drawer-extra a {
        color: white;
        text-decoration: none;
        font-size: 13px;
        font-weight: bold;
        background: rgba(255,255,255,0.15);
        padding: 8px 14px;
        border-radius: 20px;
        transition: background 0.2s;
    }
    #drawer-extra a:hover { background: rgba(255,255,255,0.25); }

    .container { padding-bottom: 80px; }
    footer { margin-bottom: 62px; }
}
