/* =========================================================
   AGRO DEL CAMPO - DESIGN SYSTEM & STYLES
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
    /* Paleta cálida y campesina: crema + verde campo + amarillo cosecha +
       café tierra. El azul (cielo) queda reservado para clima/tecnología. */
    --bg-primary: #F5F0E3;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #EFE7D3;
    --bg-card: rgba(255, 255, 255, 0.78);
    --bg-card-border: rgba(31, 107, 58, 0.16);
    --bg-secondary: #DCE8D2;

    --primary: #1F6B3A;
    --primary-hover: #17512C;
    --primary-glow: rgba(31, 107, 58, 0.22);
    --accent-gold: #F2A900;
    --accent-amber: #C98700;
    --accent-gold-ink: #7A5000;
    --accent-earth: #8A5A2B;
    --accent-sky: #3B82C4;
    --accent-sky-ink: #2A6094;
    --accent-emerald: #2F8B52;
    --accent-lime: #6B9B3F;

    /* accent-gold / accent-sky son para RELLENOS e íconos (contraste
       verificado en fondo, no en texto). Cuando el color va como texto
       sobre --bg-primary, usar las variantes -ink: sí pasan 4.5:1 AA. */
    --text-main: #173526;
    --text-muted: #5B6B57;
    --text-dim: #5A6A62;

    --bubble-bot: #EAF3E1;
    --bubble-bot-border: #1F6B3A;
    --bubble-user: #FFFFFF;

    --shadow-glow: 0 10px 26px -10px rgba(31, 107, 58, 0.35);
    --shadow-card: 0 8px 22px 0 rgba(90, 70, 40, 0.10);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(31, 107, 58, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(242, 169, 0, 0.08) 0%, transparent 40%);
}

/* Header & Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--bg-card-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1.5px solid var(--primary);
    box-shadow: var(--shadow-glow);
}

.brand-title {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--accent-gold-ink);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.5);
    padding: 4px;
    border-radius: var(--radius-full);
    border: 1px solid var(--bg-card-border);
}

.nav-item {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(31, 107, 58, 0.1);
}

.nav-item.active {
    color: #FFFFFF;
    background: var(--primary);
    box-shadow: 0 4px 14px rgba(31, 107, 58, 0.4);
}

.btn-monetize-badge {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-amber));
    color: #000000;
    font-weight: 800;
    font-size: 12px;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px rgba(242, 169, 0, 0.35);
}

.btn-monetize-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(242, 169, 0, 0.5);
}

/* Layout Container */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    padding: 24px 20px 100px;
    flex: 1;
}

/* Hero Section */
.hero-banner {
    background: linear-gradient(135deg, rgba(31, 107, 58, 0.12) 0%, rgba(255, 255, 255, 0.55) 100%);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: center;
    box-shadow: var(--shadow-card);
}

.hero-text h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.2;
}

.hero-text p {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
    max-width: 620px;
}

.hero-stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(31, 107, 58, 0.2);
    padding: 12px 18px;
    border-radius: var(--radius-md);
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-action-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--accent-gold);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(242, 169, 0, 0.15);
}

.hero-action-card h3 {
    font-size: 16px;
    color: var(--accent-gold-ink);
    margin-bottom: 8px;
}

.hero-action-card p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Compact per-module hero — se usa en cualquier sección que no sea
   Inicio, para que el contenido real del módulo quede mucho más
   arriba en vez de quedar siempre debajo del banner grande. */
.hero-banner.compact {
    grid-template-columns: 1fr;
    padding: 20px 28px;
    gap: 4px;
    align-items: flex-start;
    animation: heroFadeIn 0.25s ease;
}

.hero-compact-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.hero-compact-sub {
    font-size: 13.5px;
    color: var(--text-muted);
    max-width: 720px;
}

@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Section Cards & Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.glass-card:hover {
    border-color: rgba(31, 107, 58, 0.35);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(23, 53, 38, 0.08);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
}

.card-title i {
    color: var(--primary);
}

.badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-green { background: rgba(31, 107, 58, 0.2); color: var(--primary); border: 1px solid var(--primary); }
.badge-gold { background: rgba(242, 169, 0, 0.2); color: var(--accent-gold-ink); border: 1px solid var(--accent-amber); }
.badge-blue { background: rgba(138, 90, 43, 0.16); color: var(--accent-earth); border: 1px solid var(--accent-earth); }

/* ---------------------------------------------------------
   Precios DANE — filtros, chips por grupo y alertas de precio
--------------------------------------------------------- */
.prices-filters-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.prices-filter-item {
    flex: 1;
    min-width: 180px;
}

.prices-group-chips {
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.price-alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(138, 90, 43, 0.1);
    border: 1px solid var(--accent-earth);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 12.5px;
    color: var(--text-main);
}

.price-alert-item.triggered {
    background: rgba(242, 169, 0, 0.14);
    border-color: var(--accent-gold);
    color: var(--accent-gold-ink);
}

/* Quick reply chips (chat) — opciones cortas para no tener que escribir */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.chip-btn {
    background: rgba(31, 107, 58, 0.1);
    border: 1px solid var(--primary);
    color: var(--text-main);
    font-size: 12.5px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip-btn:hover {
    background: var(--primary);
    color: #FFFFFF;
}

/* Interactive AI Chat & Diagnosis */
.chat-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 6px;
    margin-bottom: 16px;
}

.bubble-bot {
    background: var(--bubble-bot);
    border: 1px solid var(--bubble-bot-border);
    color: var(--text-main);
    border-radius: 16px 16px 16px 4px;
    padding: 14px 16px;
    font-size: 13.5px;
    line-height: 1.6;
    max-width: 88%;
    align-self: flex-start;
}

.bubble-user {
    background: var(--bubble-user);
    color: var(--text-main);
    border-radius: 16px 16px 4px 16px;
    padding: 14px 16px;
    font-size: 13.5px;
    line-height: 1.6;
    max-width: 88%;
    align-self: flex-end;
    border: 1px solid rgba(23, 53, 38, 0.12);
}

.diagnosis-preview {
    width: 100%;
    height: 160px;
    border-radius: var(--radius-md);
    object-fit: cover;
    margin-top: 8px;
    border: 1px solid var(--primary);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
}

.input-field {
    flex: 1;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 107, 58, 0.15);
}

.btn-primary {
    background: var(--primary);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: rgba(31, 107, 58, 0.15);
}

/* Tables & Market Lists */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table th {
    text-align: left;
    padding: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(23, 53, 38, 0.12);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(23, 53, 38, 0.06);
    color: var(--text-main);
}

.data-table tr:hover td {
    background: rgba(31, 107, 58, 0.05);
}

.price-up { color: #EF4444; font-weight: 700; }
.price-down { color: var(--primary); font-weight: 700; }

/* Pricing & Monetization Cards */
.pricing-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.pricing-card.popular {
    border: 2px solid var(--accent-gold);
    box-shadow: 0 12px 35px rgba(242, 169, 0, 0.25);
    transform: scale(1.03);
}

.pricing-header {
    margin-bottom: 20px;
}

.pricing-price {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    margin: 12px 0;
}

.pricing-price span {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 400;
}

.pricing-features {
    list-style: none;
    margin-bottom: 24px;
    flex: 1;
}

.pricing-features li {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pricing-features li i {
    color: var(--primary);
}

/* ---------------------------------------------------------
   Login Gate — acceso controlado por cuenta creada a mano
--------------------------------------------------------- */
.login-gate {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(31, 107, 58, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(242, 169, 0, 0.10) 0%, transparent 40%),
        var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: contain;
    background: #FFF;
    padding: 6px;
    border: 2px solid var(--accent-gold);
    margin-bottom: 12px;
}

.login-card h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 6px;
}

.login-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.login-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid #EF4444;
    color: #B91C1C;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 12.5px;
    margin-top: 14px;
    text-align: left;
}

/* Aviso de "esto es un ejemplo/demo" — informativo, no es un error */
.demo-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(242, 169, 0, 0.10);
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold-ink);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 12.5px;
    line-height: 1.5;
    margin-bottom: 18px;
}

.demo-notice i {
    margin-top: 1px;
}

.badge-demo {
    background: rgba(242, 169, 0, 0.15);
    color: var(--accent-gold-ink);
    border: 1px solid var(--accent-gold);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 680px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(23, 53, 38, 0.35);
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.close-btn:hover { color: var(--text-main); }

/* Plan badge (navbar) */
.plan-badge-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(31, 107, 58, 0.12);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Usage meter (freemium gating) */
.usage-meter {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.usage-meter-track {
    width: 100%;
    height: 6px;
    background: rgba(23, 53, 38, 0.10);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 6px;
}

.usage-meter-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.usage-meter-fill.limit-reached {
    background: #EF4444;
}

.paywall-box {
    background: rgba(242, 169, 0, 0.12);
    border: 1px solid var(--accent-gold);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    margin-top: 12px;
}

.paywall-box p {
    font-size: 13px;
    color: var(--text-main);
    margin-bottom: 10px;
}

/* Tabs (audience switch: Productor / Comprador B2B) */
.tab-switch {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-full);
    padding: 4px;
    margin-bottom: 18px;
}

.tab-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: var(--primary);
    color: #FFFFFF;
}

/* Billing toggle (mensual / anual) */
.billing-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(23, 53, 38, 0.18);
    border-radius: var(--radius-full);
    transition: 0.2s;
}

.switch-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #FFF;
    border-radius: 50%;
    transition: 0.2s;
}

.switch input:checked + .switch-slider {
    background: var(--primary);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.savings-tag {
    background: rgba(31, 107, 58,0.2);
    color: var(--primary);
    font-size: 10.5px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* Sponsored / featured marketplace listings */
.glass-card.sponsored {
    border: 1.5px solid var(--accent-gold);
    box-shadow: 0 12px 30px rgba(242, 169, 0, 0.2);
}

.badge-sponsored {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-amber));
    color: #000;
    border: none;
}

.btn-boost {
    width: 100%;
    justify-content: center;
    background: transparent;
    border: 1px dashed var(--accent-gold);
    color: var(--accent-gold-ink);
    font-weight: 700;
    font-size: 12.5px;
    padding: 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-boost:hover {
    background: rgba(242, 169, 0, 0.12);
}

/* Revenue dashboard */
.revenue-stat {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.revenue-stat .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.revenue-stat .value {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
}

/* ---------------------------------------------------------
   Finance charts — Gastos por Categoría & Flujo de Caja
--------------------------------------------------------- */
.chart-card {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
}

.chart-card-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 12px;
}

.chart-legend {
    display: flex;
    gap: 14px;
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}

/* Shared floating tooltip for both finance charts */
.chart-tooltip {
    position: fixed;
    transform: translate(-50%, calc(-100% - 10px));
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 8px 10px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease;
    z-index: 500;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

.chart-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

/* Horizontal bar list (Gastos por Categoría) */
.barchart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.barchart-row {
    display: grid;
    grid-template-columns: 42% 1fr auto;
    align-items: center;
    gap: 10px;
    cursor: default;
    border-radius: 6px;
    outline: none;
}

.barchart-row:focus-visible {
    box-shadow: 0 0 0 2px var(--primary);
}

.barchart-label {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.barchart-track {
    background: rgba(23, 53, 38, 0.08);
    border-radius: var(--radius-full);
    height: 14px;
    overflow: hidden;
}

.barchart-fill {
    height: 100%;
    border-radius: 0 4px 4px 0;
    transition: width 0.3s ease;
}

.barchart-value {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Diverging monthly cash-flow bars (zero baseline at center) */
.cashflow-chart {
    display: flex;
    align-items: stretch;
    height: 170px;
    gap: 8px;
}

.cashflow-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    border-radius: 6px;
    outline: none;
}

.cashflow-col:focus-visible {
    box-shadow: 0 0 0 2px var(--primary);
}

.cashflow-upper {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.cashflow-lower {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.cashflow-baseline {
    width: 100%;
    height: 1px;
    background: rgba(23, 53, 38, 0.16);
    flex-shrink: 0;
}

.cashflow-bar {
    width: 18px;
    max-width: 60%;
    position: relative;
}

.cashflow-bar.positive {
    background: var(--primary);
    border-radius: 4px 4px 0 0;
    align-self: flex-end;
}

.cashflow-bar.negative {
    background: #EF4444;
    border-radius: 0 0 4px 4px;
    align-self: flex-start;
}

.cashflow-tip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

.cashflow-bar.positive .cashflow-tip {
    bottom: calc(100% + 4px);
}

.cashflow-bar.negative .cashflow-tip {
    top: calc(100% + 4px);
}

.cashflow-month-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ---------------------------------------------------------
   Bitácora de Finca — botones grandes de registro rápido
--------------------------------------------------------- */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.quick-action-btn {
    background: rgba(31, 107, 58, 0.08);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.quick-action-btn:hover {
    background: rgba(31, 107, 58, 0.18);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.quick-action-btn .qa-icon {
    font-size: 30px;
    line-height: 1;
}

/* Quick-entry modal fields */
.qe-label {
    display: block;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* Lote de rentabilidad */
.lote-card {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 16px;
    border-left: 3px solid var(--text-dim);
}

.lote-card.tono-bien { border-left-color: var(--primary); }
.lote-card.tono-alerta { border-left-color: var(--accent-gold); }
.lote-card.tono-espera { border-left-color: var(--accent-earth); }
.lote-card.tono-neutral { border-left-color: var(--text-dim); }

.lote-card-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 2px;
}

.lote-card-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.lote-veredicto {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(23, 53, 38, 0.06);
}

.tono-bien .lote-veredicto { color: var(--primary); background: rgba(31, 107, 58, 0.12); }
.tono-alerta .lote-veredicto { color: var(--accent-gold-ink); background: rgba(242, 169, 0, 0.14); }
.tono-espera .lote-veredicto { color: var(--accent-earth); background: rgba(138, 90, 43, 0.12); }
.tono-neutral .lote-veredicto { color: var(--text-muted); }

/* Farm log feed */
.farmlog-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px dashed rgba(23, 53, 38, 0.10);
    font-size: 12.5px;
}

.farmlog-item .fl-icon { font-size: 16px; }
.farmlog-item .fl-date { color: var(--text-dim); font-size: 11px; margin-left: auto; white-space: nowrap; }

/* ---------------------------------------------------------
   Resumen de Hoy + Racha — el hero de "Mis Lotes", pensado
   para que el agricultor lo revise cada día (clima + precio +
   racha de registro), igual que ya revisa el clima o el precio
   por su cuenta.
--------------------------------------------------------- */
.today-summary-card {
    background: linear-gradient(135deg, rgba(31, 107, 58, 0.14) 0%, rgba(255, 255, 255, 0.6) 100%);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.today-summary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.today-summary-date {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    text-transform: capitalize;
}

.streak-badge {
    background: rgba(242, 169, 0, 0.16);
    border: 1px solid var(--accent-amber);
    color: var(--accent-gold-ink);
    font-weight: 800;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
}

.today-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.today-summary-item {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 12.5px;
    color: var(--text-main);
}

.streak-next-milestone {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.today-summary-cta {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}

.whatsapp-reminder-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 16px;
}

/* Créditos agropecuarios */
.credit-card {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.credit-card.paid {
    opacity: 0.6;
}

.credit-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    padding: 5px 0;
    border-bottom: 1px dashed rgba(23, 53, 38, 0.10);
}

.credit-row strong {
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

/* Navbar actions (plan badge + monetize button) */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Mobile menu toggle */
.btn-mobile-menu {
    display: none;
    background: transparent;
    border: 1px solid var(--bg-card-border);
    color: var(--text-main);
    font-size: 16px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
}

/* Finance tab panels */
.finance-tab-panel {
    margin-top: 6px;
}

/* Footer */
.app-footer {
    border-top: 1px solid var(--bg-card-border);
    background: rgba(255, 255, 255, 0.5);
    padding: 24px 20px;
    margin-top: 20px;
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--primary);
}

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

.footer-links a {
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .btn-mobile-menu {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 68px;
        left: 12px;
        right: 12px;
        flex-direction: column;
        align-items: stretch;
        border-radius: var(--radius-md);
        padding: 10px;
        z-index: 200;
        background: rgba(255, 255, 255, 0.97);
        box-shadow: var(--shadow-card);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-item {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .hero-banner {
        grid-template-columns: 1fr;
    }
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
    .footer-links {
        justify-content: center;
    }
}
