:root {
    /* Agro-Tech Colors */
    --color-income: #00E676; /* Neon Green */
    --color-expense: #FF5252; /* Vibrant Red */
    --color-primary: #F59E0B; /* Dynamic Theme Color */

    /* UI Variables */
    --color-bg: #f3f4f6; /* Lighter background to pop the cards */
    --color-card: #ffffff;
    --color-text: #121212;
    --color-text-light: #546e7a;
    --font-family: 'Inter', 'Poppins', system-ui, sans-serif;
    --border-radius: 16px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

.app-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    width: 100%;
    height: 70px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 9999;
    transition: all 0.3s ease;
    pointer-events: auto !important;
}

.brand-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.logo-text-row {
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1;
}

.header-icon-img {
    height: 32px;
    width: auto;
    display: block;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.brand-lidagro {
    line-height: 1;
    letter-spacing: -1px;
}
.brand-lid { 
    font-weight: 800; 
    font-size: 1.6rem; 
    color: #00E676; 
}
.brand-agro { 
    font-weight: 800; 
    font-size: 1.6rem; 
    color: #1a1a1a; 
}
#farm-name-display.farm-name-subtitle { 
    display: block; 
    font-size: 0.75rem; 
    color: var(--color-text); 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1.5px; 
    opacity: 0.7;
    margin-top: 5px;
}

.header-actions {
    display: flex; 
    gap: 15px; 
    align-items: center; 
    flex-shrink: 0;
}

.dark-mode {
    --color-bg: #0A0A0A;
    --color-card: #1A1A1A; /* Standard Graphite */
    --color-text: #FFFFFF;
    --color-text-light: #94a3b8;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
}

.dark-mode .app-header {
    box-shadow: none;
    background-color: rgba(10, 10, 10, 0.75);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .brand-lid {
    text-shadow: 0 0 12px rgba(0, 230, 118, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.header-bell {
    color: var(--color-income);
}

.dark-mode .header-bell {
    color: var(--color-text);
}

.header-bell:hover {
    opacity: 0.8;
}

#btn-theme-toggle, #btn-notifications {
    cursor: pointer !important;
    pointer-events: auto !important;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    padding: 2rem;
    padding-top: 0; 
    padding-bottom: 0; /* Default no padding for login */
    display: flex;
    justify-content: center;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Password Toggle Styling */
.password-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    display: flex;
    align-items: center;
    padding: 6px;
    z-index: 10;
    transition: color 0.2s ease, transform 0.1s active;
}

.password-toggle:hover {
    color: #666;
}

.dark-mode .password-toggle {
    color: #94a3b8;
}

.dark-mode .password-toggle:hover {
    color: #E0E0E0;
}

/* ==========================================================================
   SELECT2 CUSTOM STYLES (Premium Theme & Z-Index Fix)
   ========================================================================== */
   
.select2-container--default .select2-selection--single {
    background-color: #ffffff;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    height: auto !important;
    min-height: 48px !important;
    display: flex;
    align-items: center;
    padding: 12px;
    font-size: 1rem;
    color: var(--color-text);
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05) !important;
    transition: all 0.2s ease;
}

.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default .select2-selection--single:hover {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 2px 4px rgba(0,0,0,0.02);
}

.dark-mode .select2-container--default .select2-selection--single {
    background-color: #2a2a2a;
    color: #e2e8f0;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--color-text) !important;
    font-weight: 500;
    line-height: normal !important;
}

.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #e2e8f0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 48px !important;
    right: 15px !important;
}

/* Fix Z-Index para abrir sobre o Modal */
.select2-container--open {
    z-index: 99999 !important;
}

/* Estilo do Dropdown Menu */
.select2-dropdown {
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    overflow: hidden;
    padding: 8px 0;
}

.dark-mode .select2-dropdown {
    background-color: #1a1a1a;
    border-color: #333 !important;
}

/* Estilo do Input de Busca */
.select2-search--dropdown .select2-search__field {
    border-radius: 8px !important;
    border: 1px solid #ddd !important;
    padding: 8px 12px !important;
    outline: none !important;
}

.dark-mode .select2-search--dropdown .select2-search__field {
    background: #2a2a2a;
    border-color: #444 !important;
    color: #fff;
}

/* Opções e Categorias */
.select2-results__group {
    font-weight: 700 !important;
    font-size: 0.8rem;
    color: var(--color-text-light) !important;
    padding: 10px 16px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #fdfdfd;
}

.dark-mode .select2-results__group {
    background: #222;
}

.select2-results__option {
    padding: 10px 20px !important;
    font-size: 0.95rem;
    transition: background 0.15s ease;
}

.select2-results__option--highlighted[aria-selected] {
    background-color: rgba(37, 99, 235, 0.1) !important;
    color: #2563eb !important;
    font-weight: 600;
}

.dark-mode .select2-results__option--highlighted[aria-selected] {
    color: #60a5fa !important;
}

/* ==========================================================================
   PREMIUM INPUTS (Shared Styling)
   ========================================================================== */
.premium-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: #ffffff;
    color: var(--color-text);
    outline: none;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    appearance: none;
}

.premium-input:hover,
.premium-input:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 2px 4px rgba(0,0,0,0.02);
}

select.premium-input {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%239ca3af%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 0.65em auto;
    padding-right: 2.5rem;
}

.dark-mode .premium-input {
    background: #2a2a2a;
    border-color: #444;
    color: #e2e8f0;
}

.dark-mode .premium-input:hover,
.dark-mode .premium-input:focus {
    border-color: #60a5fa;
    background: #333;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1), 0 2px 4px rgba(0,0,0,0.02);
}

/* Vaccine Button Styling */
#btn-save-vaccine {
    background-color: #1d4ed8;
    color: #ffffff;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease;
}

#btn-save-vaccine:hover {
    background-color: #1e40af;
}

.app-container {
    max-width: 600px;
    width: 100%;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
    padding-bottom: 120px; /* Garante respiro global no final da tela para não encavalar o FAB */
}

.tab-content.active {
    display: block;
}


@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bottom-nav {
    display: none; /* Hidden by default, JS shows it on login */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    justify-content: space-around;
    padding: 0.8rem 0;
    padding-bottom: calc(0.8rem + env(safe-area-inset-bottom)); /* Keep nav items above iPhone bar */
    z-index: 9999; /* Increased for mobile layering */
    border-top: 1px solid #eee;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.dark-mode .bottom-nav {
    background: #1e1e1e;
    border-top: 1px solid #333;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-light);
    font-size: 0.75rem;
    font-weight: 500;
    gap: 0.3rem;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    border-radius: 12px;
}

.bottom-nav .nav-item.active {
    color: var(--color-income);
    background: rgba(0, 150, 0, 0.05);
}

.bottom-nav .nav-item svg {
    stroke-width: 2.5;
}

header {
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--color-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

.card h2 {
    font-size: 0.9rem;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.card .amount {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.card.income .amount {
    color: var(--color-income);
}

.card.expense .amount {
    color: var(--color-expense);
}

.card.balance {
    grid-column: span 2;
    background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);
}

.card.balance .amount {
    font-size: 2.5rem;
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

button {
    border: none;
    padding: 1.2rem;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-income {
    background-color: var(--color-income);
    box-shadow: 0 4px 14px rgba(0, 150, 0, 0.2);
}

.btn-income:hover {
    background-color: rgb(0, 130, 0);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 150, 0, 0.3);
}

.btn-expense {
    background-color: var(--color-expense);
    box-shadow: 0 4px 14px rgba(200, 0, 0, 0.2);
}

.btn-expense:hover {
    background-color: rgb(180, 0, 0);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200, 0, 0, 0.3);
}

.transactions-section h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--color-text);
    font-weight: 600;
}

.transactions-list {
    background: transparent;
    box-shadow: none;
    padding-bottom: 100px; /* Space for bottom navigation */
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.2rem 1.5rem;
    background: var(--color-card);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    gap: 12px;
}

.transaction-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.dark-mode .transaction-item {
    border-color: #333;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
}

.transaction-item.income {
    border-left: 4px solid var(--color-income);
}

.transaction-item.expense {
    border-left: 4px solid var(--color-expense);
}

.transaction-title {
    font-weight: 800; /* Bolder per user request */
    font-size: 1.05rem;
    color: var(--color-text);
    margin-bottom: 2px;
}

.transaction-date {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-top: 0.3rem;
}

.transaction-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.transaction-amount.income {
    color: var(--color-income);
}

.transaction-amount.expense {
    color: var(--color-expense);
}

/* RESPONSIVE TRANSACTION CARDS (2 COLUMNS) */
@media (max-width: 480px) {
    .transaction-item {
        padding: 15px 12px; /* Espaço lateral otimizado no Mobile */
        width: 100%;
        max-width: 100%;
    }
}

/* Animal Cards - Premium Glassmorphism */
.animal-card {
    display: flex;
    flex-direction: column;
    padding: 1.2rem 1.5rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    margin-bottom: 12px;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 10px 30px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.animal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.dark-mode .animal-card {
    background: rgba(30, 41, 59, 0.5); /* translucent slate */
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4);
}

.dark-mode .animal-card:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Animal Card Actions */
.btn-view-details {
    background-color: #2563eb;
    color: #ffffff;
    padding: 6px 14px;
    font-size: 0.85rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-view-details:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn-sell-animal {
    background-color: #28a745;
    color: #ffffff;
    padding: 6px 14px;
    font-size: 0.85rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.btn-sell-animal:hover {
    background-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-card-text {
    background: transparent;
    border: none;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-card-text.edit {
    color: var(--color-income);
}
.btn-card-text.edit:hover {
    background: rgba(0, 230, 118, 0.1);
}

.btn-card-text.delete {
    color: var(--color-expense);
}
.btn-card-text.delete:hover {
    background: rgba(255, 82, 82, 0.1);
}

.animal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.animal-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.animal-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f4f8;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 1px solid #e2e8f0;
}

.dark-mode .animal-avatar {
    background: #2d3748;
    border-color: #4a5568;
}

.animal-name {
    font-weight: 800; /* Extra peso no nome */
    font-size: 1.15rem;
    color: #1e3a8a; /* Azul marinho escuro */
}

.dark-mode .animal-name {
    color: #60a5fa; /* Azul claro p/ Dark Mode */
}

.animal-breed {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.status-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
}

.status-lactacao {
    background: rgba(0, 150, 0, 0.1);
    color: var(--color-income);
}

.status-secagem {
    background: rgba(255, 165, 0, 0.1);
    color: #ed8936;
}

.status-seca {
    background: rgba(200, 0, 0, 0.1);
    color: var(--color-expense);
}

.status-novilha {
    background: rgba(50, 50, 200, 0.1);
    color: #3182ce;
}

.lactation-progress-container {
    width: 100%;
    margin-top: 0.5rem;
}

.lactation-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.lactation-progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.dark-mode .lactation-progress-bar-bg {
    background: #4a5568;
}

.lactation-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease, background-color 0.5s ease;
}

.animal-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
    background: #f8fafc;
    padding: 0.8rem;
    border-radius: 8px;
}

.dark-mode .animal-details {
    background: #2d3748;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    height: -webkit-fill-available;
    background: rgba(0, 0, 0, 0.2); /* Light Mode default */
    display: none !important; 
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    z-index: 99999;
}

.dark-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.modal-overlay.active {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: white;
    padding: 20px;
    border-radius: 16px;
    width: 95%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Scroll & Height Fixes for PWA */
    height: auto !important;
    max-height: 85vh !important;
    max-height: 85dvh !important;
    position: relative;
    z-index: 10001;
    pointer-events: none !important; /* Default off */
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    border: none;
}

.modal-overlay.active .modal {
    pointer-events: all !important;
}

.modal-scroll-container {
    height: 100%;
    width: 100%;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding-bottom: 120px; /* Safe space for nav bar */
}

body.no-scroll {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

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

.modal h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--color-text);
    font-size: 1.5rem;
}

.dark-mode .modal {
    background: #1A1A1A; /* Deep Graphite */
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
    border-radius: 16px;
    border: none;
}

.dark-mode .modal h2 {
    color: #FFFFFF;
}

.segment-toggle {
    display: flex;
    width: 100%;
    background: #fafafa;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 0.4rem;
    gap: 0.4rem;
    align-items: stretch;
    box-sizing: border-box;
}

.segment-toggle input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    appearance: none;
}

.segment-toggle label {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.2rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text-light);
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid transparent;
    gap: 0.3rem;
    margin-bottom: 0;
    min-width: 0; /* Prevents overflow in flex */
}

.segment-toggle .toggle-icon {
    font-size: 24px;
    line-height: 1;
}

.segment-toggle .toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.segment-toggle label:hover {
    background: rgba(0, 0, 0, 0.03);
}

.segment-toggle input[type="radio"]:checked+label {
    background: #DCFCE7; /* bg-green-50 */
    color: #166534; /* text-green-800 */
    border-color: #22C55E; /* border-green-500 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.dark-mode .segment-toggle {
    background: #1a1a1a;
    border-color: #444;
}

.dark-mode .segment-toggle label {
    color: #94a3b8;
}

.dark-mode .segment-toggle label:hover {
    background: #252525;
}

.dark-mode .segment-toggle input[type="radio"]:checked+label {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: #22C55E;
}

.form-group {
    margin-bottom: 1.5rem; /* Increased for mobile comfort */
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 500;
    color: #555;
    font-size: 0.95rem;
}


.dark-mode .form-group label {
    color: #E0E0E0; /* Matte White for visibility */
    font-weight: 500;
}

.dark-mode .form-group small {
    color: #94a3b8;
}

.form-group input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    background: #fafafa;
    min-height: 48px;
}

.form-group input:focus {
    outline: none;
    border-color: #999;
    background: #fff;
    box-shadow: none;
}

.dark-mode .form-group input, 
.dark-mode .form-group textarea {
    background: #FFFFFF !important;
    border: 1px solid #444 !important;
    color: #000000 !important;
    min-height: 48px;
    box-shadow: none !important;
}

.dark-mode .form-group select {
    background: #F5F5F5 !important;
    border: 1px solid #CCC !important;
    color: #000000 !important;
    min-height: 48px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' 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 1rem center;
    background-size: 1.2rem;
    padding-right: 3rem !important;
    box-shadow: none !important;
}

.dark-mode .form-group input::placeholder {
    color: #888;
}

.dark-mode .form-group input:focus {
    border-color: var(--color-income) !important;
    background: #333 !important;
    box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.1);
}

.modal-actions {
    display: flex;
    flex-direction: column; /* Stacked for mobile focus */
    gap: 0.8rem;
    margin-top: 2rem;
    justify-content: center;
}

.btn-cancel {
    background: transparent;
    color: #FF4D4D;
    flex: 1;
    border: 1px solid #FF4D4D;
    padding: 1rem;
    box-shadow: none;
    font-weight: 500;
}

.dark-mode .btn-cancel {
    background: transparent;
    border: 1px solid #FF4D4D;
    color: #FF4D4D;
}

.btn-cancel:hover {
    background: rgba(255, 77, 77, 0.05);
    transform: translateY(-2px);
}

.profile-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    margin-top: 2rem !important;
    margin-bottom: 120px !important;
    width: 100% !important;
}

.profile-actions button {
    flex: 1 !important;
    width: auto !important;
    margin-top: 0 !important;
    padding: 1.2rem !important;
    font-size: 1.1rem !important;
}

.btn-logout-styled {
    background: transparent;
    color: var(--color-expense);
    border: 2px solid var(--color-expense);
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto !important;
    position: relative;
    z-index: 9999;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout-styled:hover {
    background: rgba(200, 0, 0, 0.05);
    transform: translateY(-2px);
}

.btn-save {
    background: var(--color-primary);
    color: #FFFFFF;
    width: 100%;
    flex: none; 
    box-shadow: none;
    padding: 1rem;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    transition: all 0.2s ease;
}

.btn-save:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.dark-mode .btn-save {
    background: var(--color-primary);
    color: #000000 !important; /* Premium high contrast */
    font-weight: 800;
    transition: all 0.2s ease;
}

/* Premium Dashboard Filter Bar */
.filter-btn {
    background: transparent;
    color: var(--color-text-light);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.filter-btn:hover {
    background: rgba(150,150,150,0.1);
}
.filter-btn.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.premium-date-input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text);
    background: #fdfdfd;
}

.dark-mode .premium-date-input {
    background: #2a2a2a;
    border-color: #444;
    color: #ffffff;
    color-scheme: dark;
}

.dark-mode .btn-save:hover {
    filter: brightness(0.9);
}

/* Pricing & Upgrade Modals */
.plan-toggle-container {
    display: flex;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.dark-mode .plan-toggle-container {
    background: #1a1a1a;
}

.plan-toggle-btn {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--color-text-light);
    transition: all 0.2s ease;
    position: relative;
}

.plan-toggle-btn.active.mode-mensal {
    background: #ffffff;
    color: var(--color-text);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-weight: 700;
}

.dark-mode .plan-toggle-btn.active.mode-mensal {
    background: #333333;
    color: #ffffff;
}

.plan-toggle-btn.active.mode-anual {
    background: var(--color-primary);
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dark-mode .plan-toggle-btn.active.mode-anual {
    color: #000000;
}

.pricing-text-main {
    font-weight: 800;
    font-size: 2.2rem;
    color: var(--color-text);
}

.dark-mode .pricing-text-main {
    color: #ffffff !important;
}

.btn-outline {
    background: transparent;
    color: var(--color-text-light);
    border: 1px solid #ddd;
    width: 100%;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark-mode .btn-outline {
    border-color: #555;
    color: #ffffff;
}
.dark-mode .btn-outline:hover {
    background: rgba(255,255,255,0.05);
}

.btn-primary-text {
    color: #ffffff;
}
.dark-mode .btn-primary-text {
    color: #000000 !important;
}



.btn-pro-export {
    color: white;
    transition: all 0.2s ease;
}

.btn-pro-export:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-2px);
}

.btn-view-receipt {
    background: none;
    border: none;
    color: rgb(100, 100, 100);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background: #f0f0f0;
}

.btn-view-receipt:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

/* Responsiveness */
@media (max-width: 480px) {
    body {
        padding: 1rem;
    }

    .dashboard {
        grid-template-columns: 1fr;
    }

    .card.balance {
        grid-column: span 1;
    }

    .actions {
        grid-template-columns: 1fr;
    }
}

/* Registro de Usuário - Welcome Screen */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000; /* Bloqueio Total da Interface */
}

.auth-modal {
    background: white;
    padding: 2.5rem;
    border: 2px solid #ddd; /* Simpler border for safe testing */
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.auth-modal h2 {
    margin-bottom: 1rem;
    color: var(--color-text);
}

.auth-modal p {
    margin-bottom: 1.5rem;
    color: var(--color-text-light);
}

/* Dashboard Module Selection */
#active-modules {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 2rem;
}

.module-card {
    flex: 1 1 calc(50% - 15px);
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    border: 2px solid #e0e0e0;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    transition: transform 0.2s, background 0.2s;
    border-radius: 12px;
    min-width: 150px;
}

.module-card:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
}

.module-card span {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.module-card h3 {
    color: #333;
    margin: 0;
    font-size: 1rem;
}

#module-misto-btn {
    flex: 1 1 100%;
    background: var(--color-card);
    border: 1px solid #ddd;
    flex-direction: row;
    gap: 0.8rem;
    padding: 1.2rem;
}

#module-misto-btn span {
    font-size: 1.4rem;
    margin-bottom: 0;
}

#module-misto-btn h3 {
    color: var(--color-text-light);
    font-size: 1rem;
}

.dark-mode .module-card {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border-color: #444;
}

.dark-mode .module-card h3 {
    color: #fff;
}

.dark-mode #module-misto-btn {
    background: #2a2a2a;
    border-color: #333;
}

/* ==========================================================================
   PROJECTION METRICS (KPIs)
   ========================================================================== */
.proj-kpi-card {
    padding: 0.8rem;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.proj-kpi-card .kpi-label {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    opacity: 0.9;
}

.proj-kpi-card .kpi-value-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.proj-kpi-card .kpi-icon {
    font-size: 1.2rem;
}

.proj-kpi-card .kpi-val {
    font-size: 1.2rem;
    font-weight: 800;
}

/* Themes */
.kpi-leite-theme {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    color: #1565c0;
}

.kpi-corte-theme {
    background: linear-gradient(135deg, #efebe9 0%, #d7ccc8 100%);
    border: 1px solid #bcaaa4;
    color: #5d4037;
}

/* Dark Mode Overrides for KPIs */
.dark-mode .kpi-leite-theme {
    background: linear-gradient(135deg, rgba(21, 101, 192, 0.2) 0%, rgba(21, 101, 192, 0.4) 100%);
    border-color: rgba(21, 101, 192, 0.5);
    color: #90caf9;
}

.dark-mode .kpi-corte-theme {
    background: linear-gradient(135deg, rgba(93, 64, 55, 0.3) 0%, rgba(93, 64, 55, 0.5) 100%);
    border-color: rgba(141, 110, 99, 0.5);
    color: #bcaaa4;
}

/* ==========================================================================
   ABA DE MERCADO (COTAÇÕES)
   ========================================================================== */
.market-scroll {
    display: flex;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    gap: 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.market-scroll::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   AUTH SCREEN ISOLATION - FAB, NAV e HEADER ficam INVISÍVEIS no Login
   ========================================================================== */
body.auth-screen .fab-wrapper,
body.auth-screen .bottom-nav,
body.auth-screen .app-header,
body.auth-screen .app-container {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ==========================================================================
   FLOATING ACTION BUTTON (FAB) - PREMIUM REFINEMENT
   ========================================================================== */
.fab-wrapper {
    position: fixed !important;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 20px;
    z-index: 99999 !important;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none; /* Deixa o clique vazar para os itens de trás (Sair) */
}

.fab-main {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #FF4D4D; /* Vibrant Red */
    border: none !important;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 77, 77, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 2;
    outline: none;
    pointer-events: auto; /* Restaura o clique apenas pro botão */
}

.fab-main:active {
    transform: scale(0.92);
}

.fab-main svg {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

.fab-wrapper.active .fab-main {
    background: #FF4D4D;
    box-shadow: 0 4px 15px rgba(255, 77, 77, 0.4);
}

.fab-wrapper.active .fab-main svg {
    transform: rotate(45deg); /* Professional 'X' rotation */
}

.fab-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 20px;
    pointer-events: none;
}

.fab-wrapper.active .fab-menu {
    pointer-events: auto;
}

.fab-menu-group {
    display: flex;
    align-items: center; /* Perfect vertical centering */
    gap: 12px;
    justify-content: flex-end;
    opacity: 0;
    transform: translateY(20px);
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-wrapper.active .fab-menu-group {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

/* Staggered animation */
.fab-wrapper.active .fab-menu-group:nth-child(1) { transition-delay: 0.05s; }
.fab-wrapper.active .fab-menu-group:nth-child(2) { transition-delay: 0.1s; }
.fab-wrapper.active .fab-menu-group:nth-child(3) { transition-delay: 0.15s; }
.fab-wrapper.active .fab-menu-group:nth-child(4) { transition-delay: 0.20s; }

.fab-label {
    background: #FFFFFF !important;
    color: #000000 !important; /* Pure Black for maximum contrast */
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px; /* Pill shape */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Stronger shadow for Light Mode */
    border: 1px solid #E5E7EB !important; /* Subtle border for separation */
    pointer-events: none;
    white-space: nowrap;
}

.dark-mode .fab-label {
    background: #FFFFFF !important;
    color: #444444 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border: none !important;
}

.fab-item {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    /* removed forced background/color to allow inline dynamic glassmorphism */
    border: 1px solid #e0e0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0; /* Clear any padding */
}

.fab-item svg {
    width: 24px;
    height: 24px;
    display: block;
}

.fab-item:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.fab-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3); /* iOS styled darken */
    backdrop-filter: blur(4px);
    z-index: 99998; /* Immediately below FAB (99999) */
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Blocked when closed */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-wrapper.active ~ .fab-overlay,
.fab-wrapper.active + .fab-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Active when FAB open */
}

.dark-mode .fab-overlay {
    background: rgba(0, 0, 0, 0.6); /* Darker for better dark mode contrast */
    backdrop-filter: blur(4px);
}

#reproductive-fields, #bezerro-fields {
    transition: all 0.3s ease-in-out;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
}

#reproductive-fields.visible, #bezerro-fields.visible {
    opacity: 1;
    max-height: 200px;
    margin-top: 10px;
    margin-bottom: 20px;
}

.status-macho {
    background-color: #4a5568 !important; /* Dark Gray */
    color: white !important;
}

.status-bezerro {
    background-color: #3182ce !important; /* Blue */
    color: white !important;
}

/* ==========================================================================
   HERD FILTERS & CHIPS
   ========================================================================== */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.herd-filters .chip {
    padding: 0.6rem 1.4rem;
    border-radius: 20px;
    background: #eef2f5;
    color: #546e7a;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: inline-block;
    height: auto;
    width: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.herd-filters .chip:hover {
    background: #e2e8f0;
}

.herd-filters .chip.active {
    background: var(--color-income);
    color: #000;
    box-shadow: 0 4px 12px rgba(0, 230, 118, 0.3);
}

.dark-mode .herd-filters .chip {
    background: #1e1e1e;
    color: #94a3b8;
}

.dark-mode .herd-filters .chip.active {
    background: var(--color-income);
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.4);
}

.search-box-wrapper input::placeholder {
    color: #94a3b8;
}

.dark-mode .search-box-wrapper input {
    background: #141414 !important;
    border: 1px solid #333 !important;
}

.market-card {
    background: var(--color-card);
    border-radius: var(--border-radius);
    padding: 20px;
    min-width: 160px;
    flex-shrink: 0;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--color-income);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.market-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.market-title {
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-weight: 600;
}

.market-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
}

.market-var {
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.market-var.up {
    color: var(--color-income);
}

.market-var.down {
    color: var(--color-expense);
}

/* ALERTS SYSTEM */
@keyframes alert-blink {
    0% {
        border-color: var(--color-expense);
        transform: scale(1);
        box-shadow: 0 0 0 rgba(200, 0, 0, 0);
    }

    50% {
        border-color: #ff3333;
        transform: scale(1.02);
        box-shadow: 0 4px 12px rgba(200, 0, 0, 0.4);
    }

    100% {
        border-color: var(--color-expense);
        transform: scale(1);
        box-shadow: 0 0 0 rgba(200, 0, 0, 0);
    }
}

/* SIMULATOR CHART COLLAPSE */
.simulator-chart-collapsed {
    height: 0;
    opacity: 0;
    overflow: hidden;
    transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease-out, margin 0.3s ease;
    margin-top: 0;
}

.simulator-chart-collapsed.sim-active {
    height: 200px;
    opacity: 1;
    margin-top: 1rem;
}

.commodity-card.alert-triggered {
    animation: alert-blink 1.5s infinite !important;
    position: relative;
    overflow: visible;
}

.alert-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--color-bg);
    border-radius: 50%;
    padding: 0.3rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 100;
    color: var(--color-text-light);
    /* Default color before trigger */
}

.commodity-card.alert-triggered .alert-icon {
    display: flex !important;
    color: var(--color-expense) !important;
    /* Red when triggered */
    background: var(--color-card);
}

.active-alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: var(--color-bg);
    border-radius: 6px;
    border-left: 3px solid var(--color-text-light);
}

.active-alert-item .btn-remove-alert {
    background: transparent;
    border: none;
    color: var(--color-expense);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    padding: 0.2rem 0.5rem;
}

.active-alert-item .btn-remove-alert:hover {
    background: rgba(200, 0, 0, 0.1);
    border-radius: 4px;
}

#alert-modal {
    display: none !important;
    pointer-events: none;
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    justify-content: center;
    align-items: center;
}

#alert-modal.active {
    display: flex !important;
    pointer-events: auto;
}

/* Dashboard Alerts Style */
.dashboard-alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    background: var(--color-card);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--color-income);
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dashboard-alert-item .btn-remove-alert {
    background: transparent;
    border: none;
    color: var(--color-expense);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.dashboard-alert-item .btn-remove-alert:hover {
    background: rgba(200, 0, 0, 0.1);
}

/* Notification Dropdown Styles */
.notification-dropdown {
    position: absolute;
    top: 50px;
    right: -10px;
    width: 320px;
    background: var(--color-card);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(150, 150, 150, 0.1);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dark-mode .notification-dropdown {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-bg);
    border-bottom: 1px solid rgba(150, 150, 150, 0.1);
}

.notification-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-text);
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(150, 150, 150, 0.05);
    border-left: 4px solid var(--color-primary);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: background-color 0.2s;
    cursor: default;
}

.notification-item:hover {
    background-color: var(--color-bg);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.notification-icon.warning {
    background-color: rgba(237, 137, 54, 0.1); /* orange */
    color: rgb(237, 137, 54);
}

.notification-icon.critical {
    background-color: rgba(220, 38, 38, 0.1); /* intense red */
    color: rgb(220, 38, 38);
}

.notification-icon.success {
    background-color: rgba(0, 150, 0, 0.1);
    color: rgb(0, 150, 0);
}

.notification-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notification-message {
    font-size: 0.85rem;
    color: var(--color-text);
    line-height: 1.3;
}

.notification-time {
    font-size: 0.7rem;
    color: var(--color-text-light);
}

/* Charts */
.charts-container {
    display: none;
    /* hidden if no data */
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 2rem;
}

.chart-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#expense-donut-card {
    background: rgba(255, 255, 255, 0.7) !important; 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px !important; 
    border: 1px solid rgba(255, 255, 255, 0.3) !important; 
    box-shadow: rgba(0, 0, 0, 0.05) 0px 10px 30px !important;
}

.dark-mode #expense-donut-card {
    background: rgba(30, 41, 59, 0.7) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.projection-card {
    border: 2px solid transparent;
    background: linear-gradient(var(--color-card), var(--color-card)) padding-box,
        linear-gradient(145deg, var(--color-income), #FFD700) border-box;
}

.simulator-card {
    background: var(--color-card);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark-mode .simulator-card {
    border-color: rgba(255, 255, 255, 0.05);
}

.simulator-card input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0;
    height: 6px;
    border-radius: 4px;
    outline: none;
    transition: background 0.3s;
}

body.dark-mode .simulator-card input[type="range"] {
    background: #444;
}

.simulator-card input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-income);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#sim-cost-range::-webkit-slider-thumb {
    background: var(--color-expense);
}

@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   PRINT STYLES (PDF EXPORT)
   ========================================================================== */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    #print-header,
    #print-footer {
        display: block !important;
    }

    nav,
    header,
    .actions,
    .tools-section,
    .pro-report-section,
    .btn-remove,
    .transaction-actions,
    .filter-section {
        display: none !important;
    }

    #dark-mode-toggle,
    #btn-new-income-tab,
    #btn-new-expense-tab {
        display: none !important;
    }

    .market-alerts-container,
    #dashboard-active-alerts-section {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
        border: none !important;
        box-shadow: none !important;
        background: white !important;
    }

    .dashboard-cards {
        gap: 15px;
        margin-bottom: 2rem;
    }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
        page-break-inside: avoid;
        background: white !important;
        color: black !important;
    }

    .transaction-item {
        page-break-inside: avoid;
        border: 1px solid #ddd;
        box-shadow: none;
        background: white !important;
        color: black !important;
    }

    .transaction-amount.income {
        color: #008000 !important;
    }

    .transaction-amount.expense {
        color: #cc0000 !important;
    }
}

/* Autocomplete List IBGE */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-card);
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    list-style: none;
    padding: 0;
    margin: 0;
}

.autocomplete-list li {
    padding: 0.8rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--color-text);
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.autocomplete-list li:last-child {
    border-bottom: none;
}

.autocomplete-list li:hover {
    background: rgba(0, 150, 0, 0.05);
    color: var(--color-income);
}

/* Privacy Mode Transitions */
.masked-value {
    animation: fadeInPrivacy 0.3s ease forwards;
}

.unmasked-value {
    animation: fadeInPrivacy 0.3s ease forwards;
}

@keyframes fadeInPrivacy {
    from {
        opacity: 0;
        filter: blur(2px);
    }
    to {
        opacity: 1;
        filter: blur(0px);
    }
}

/* Commodities Dark Mode Fixes */
.commodity-card {
    flex: 0 0 140px; 
    background: rgba(255, 255, 255, 0.7); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px; 
    padding: 12px; 
    border: 1px solid rgba(255, 255, 255, 0.3); 
    scroll-snap-align: start; 
    box-shadow: rgba(0, 0, 0, 0.05) 0px 10px 30px; 
    position: relative;
    transition: background 0.3s, border-color 0.3s;
}

.commodity-title {
    font-size: 0.8rem; font-weight: 600; color: #555;
}

.commodity-value {
    font-size: 1.25rem; font-weight: 800; color: var(--color-text); text-shadow: 0px 1px 2px rgba(255, 255, 255, 0.5);
}

.dark-mode .commodity-value {
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5);
}

.commodity-var {
    font-size: 0.75rem; margin-top: 4px; display: flex; align-items: center; gap: 4px; color: #888;
}

.commodity-subtitle {
    font-size: 0.7rem; color: #888; margin-top: 4px;
}

.btn-alerta {
    background: #3b82f6;
    color: white;
    border: 1px solid #2563eb;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.dark-mode .commodity-card {
    background: rgba(30, 41, 59, 0.7); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .commodity-title {
    color: #cbd5e1; /* text-slate-300 */
}

.dark-mode .commodity-var, .dark-mode .commodity-subtitle {
    color: #94a3b8; /* text-slate-400 */
}

.dark-mode .btn-alerta {
    background: #1e40af; /* darker blue */
    border-color: #1e3a8a;
    color: #eff6ff;
}

/* ==========================================================================
   GLASSMORPHISM: EMPTY STATES
   ========================================================================== */
.empty-state-glass {
    padding: 3rem; 
    text-align: center; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    position: relative; 
    /* overflow: hidden; Removed to let watermark breathe */
    background: rgba(255, 255, 255, 0.4); 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px); 
    border: 1px solid rgba(255, 255, 255, 0.3); 
    border-radius: 20px; 
    min-height: 250px;
}

.dark-mode .empty-state-glass {
    background: rgba(30, 41, 59, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

.empty-state-watermark {
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    opacity: 0.04; 
    pointer-events: none;
    font-size: 5rem; /* Ajustado para caber sem cortar */
    width: 100%;
    text-align: center;
    font-weight: 900; 
    letter-spacing: -2px;
    color: var(--color-text);
}

.empty-state-content {
    position: relative; 
    z-index: 2; 
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.empty-state-content h3 {
    color: var(--color-text); 
    margin-bottom: 8px; 
    font-weight: 700;
}

.empty-state-content p {
    color: var(--color-text-light); 
    font-size: 0.95rem; 
    margin-bottom: 20px;
}

.empty-state-btn {
    background: transparent; 
    border: 2px solid var(--color-income); 
    color: var(--color-income); 
    padding: 8px 24px; 
    border-radius: 20px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.3s;
    margin-top: 20px;
}

.empty-state-btn:hover {
    background: var(--color-income); 
    color: white;
}

/* ==========================================================================
   MODAL DE COMPARAÇÃO PREMIUM (UPGRADE)
   ========================================================================== */
.upgrade-comparison-modal {
    animation: modalBounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh; /* Ocupar no máximo 90% da altura da tela */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Scroll será tratado internamente pela .modal-scroll-area */
    border-radius: 20px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
}

/* Esconder scrollbar para um visual mais limpo (opcional) */
.upgrade-comparison-modal::-webkit-scrollbar {
    width: 6px;
}
.upgrade-comparison-modal::-webkit-scrollbar-track {
    background: transparent;
}
.upgrade-comparison-modal::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

@keyframes modalBounceIn {
    from { opacity: 0; transform: scale(0.8) translateY(30px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.dark-mode .comparison-grid {
    background: #333;
    border-color: #333;
}

.comp-col-header {
    background: #fdfdfd;
    padding: clamp(8px, 1.5vh, 14px) clamp(6px, 1.5vw, 24px);
    font-size: clamp(0.55rem, 2.5vw, 0.75rem);
    font-weight: 800;
    text-align: left;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dark-mode .comp-col-header {
    background: #1a1a1a;
    color: #aaa;
}

.comp-col-header.pro-header {
    background: #e8f5e9;
    color: #2e7d32;
}

.dark-mode .comp-col-header.pro-header {
    background: #1b2e1b;
    color: #81c784;
}

.comp-cell {
    background: white;
    padding: clamp(6px, 1.3vh, 12px) clamp(6px, 1.5vw, 24px);
    font-size: clamp(0.6rem, 3.1vw, 0.85rem);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(4px, 1.5vw, 12px);
    text-align: left;
    color: var(--color-text);
}

.dark-mode .comp-cell {
    background: #222;
}

/* Rodapé de Conversão - Agora STICKY no rodapé do modal */
.upgrade-pricing-footer {
    background: white !important; /* Garantir fundo branco para o efeito sticky */
    padding: clamp(10px, 1.5vh, 25px) 24px;
    border-top: 1px solid #eee; /* Borda superior leve */
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
    z-index: 100; /* Z-index de elite para garantir visibilidade */
    box-shadow: 0 -10px 30px rgba(0,0,0,0.03); /* Sombra suave para o efeito sticky */
}

/* Área de Scroll Interno do Modal */
.modal-scroll-area {
    max-height: none;
    overflow-y: hidden !important;
    padding: clamp(5px, 1vh, 10px) clamp(10px, 1.5vw, 20px); 
}

.modal-scroll-area::-webkit-scrollbar {
    width: 6px;
}
.modal-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}
.modal-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

.dark-mode .upgrade-pricing-footer {
    background: #1a1a1a;
}

.btn-upgrade-primary {
    background: linear-gradient(135deg, #2e7d32 0%, #1a4731 100%);
    color: #ffd700;
    border: none;
    padding: clamp(0.8rem, 1.5vh, 1.2rem);
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    font-weight: 800;
    border-radius: 14px;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(26, 71, 49, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: clamp(6px, 1.5vh, 12px);
}

.btn-upgrade-secondary {
    background: transparent;
    border: 1px solid #ddd;
    color: #888;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    width: 100%;
    cursor: pointer;
}

.dark-mode .btn-upgrade-secondary {
    border-color: #444;
}

.free-cell {
    color: #888;
    background: #fcfcfc;
}

.pro-cell {
    background: #e8f5e9;
    font-weight: 500;
}

.dark-mode .pro-cell {
    background: #282828;
}

.pro-cell strong {
    color: #2e7d32;
}

.dark-mode .pro-cell strong {
    color: #81c784;
}

/* Responsividade do Grid */
@media (max-width: 480px) {
    /* Grid mantido em 1fr 1fr pelo uso de clamp e vw nas células main */
}

/* --- SELETOR DE PLANO (UPGRADE) --- */
.plan-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.plan-option {
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    background: white;
}

.dark-mode .plan-option {
    background: #222;
    border-color: #333;
}

.plan-option.selected {
    border-color: #1a4731;
    background: #f0fdf4;
}

.dark-mode .plan-option.selected {
    border-color: #2e7d32;
    background: #1b2e1b;
}

.plan-option input[type="radio"] {
    display: none;
}

.plan-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.plan-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--color-text);
}

.plan-price-sub {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.plan-badge {
    background: #22c55e;
    color: white;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 4px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.plan-selection-dot {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.plan-option.selected .plan-selection-dot {
    border-color: #1a4731;
    background: #1a4731;
}

.dark-mode .plan-option.selected .plan-selection-dot {
    border-color: #2e7d32;
    background: #2e7d32;
}

.plan-option.selected .plan-selection-dot::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}


/* --- DANGER ZONE & ACCOUNT RESET (PROFILE TAB) --- */
.danger-zone-container {
    margin-top: 50px !important;
    padding: 25px 20px !important;
    background-color: #fff8f8 !important;
    border: 1px dashed #ffcccc !important;
    border-radius: 16px !important;
    text-align: center !important;
    transition: all 0.3s ease !important;
}

.danger-zone-title {
    color: #555 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px !important;
    margin-bottom: 15px !important;
}

.btn-reset-discreto {
    background: transparent !important;
    color: #444 !important;
    border: 1px solid #999 !important;
    padding: 8px 18px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.btn-reset-discreto:hover {
    background: #d32f2f !important;
    color: #ffffff !important;
    border-color: #d32f2f !important;
    transform: translateY(-1px) !important;
}

.dark-mode .danger-zone-container {
    background-color: rgba(211, 47, 47, 0.05) !important;
    border-color: rgba(211, 47, 47, 0.3) !important;
}

.dark-mode .danger-zone-title {
    color: #ec7a7a !important;
}

.dark-mode .btn-reset-discreto {
    color: #ec7a7a !important;
    border-color: #ec7a7a !important;
}