/* 
   FreteControl Premium Modern Design System
   "FilÃ© do Boi" Standard - Mobile First & Glassmorphism
*/

:root {
    /* Paleta Emerald Premium */
    --primary-color: #10B981;
    --primary-dark: #059669;
    --accent-color: #10B981;
    --accent-hover: #34D399;
    
    /* Cores de Feedback */
    --receita-color: #10B981;
    --despesa-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;
    
    /* Neutros e Dark Mode */
    --bg-main: #0B0F19; /* Deep Slate */
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-input: #1E293B;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    
    /* Tipografia */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Poppins', sans-serif;
}

/* Light Mode Overrides */
.light-mode {
    --bg-main: #F1F5F9;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-input: #FFFFFF;
    --border-color: rgba(0, 0, 0, 0.05);
    --text-main: #0F172A;
    --text-muted: #64748B;
}

* {
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.1s ease;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .nav-btn span {
    font-family: var(--font-heading);
    letter-spacing: -0.01em;
}

/* Glassmorphism Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.form-group {
    position: relative;
    margin-bottom: 1rem;
}

/* STEPPER UI */
.stepper-container {
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.stepper-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.stepper-steps::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--bg-input);
    z-index: 1;
}

.step-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 2;
    position: relative;
    color: var(--text-muted);
}

.step-indicator.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.step-indicator.completed {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.step-indicator.completed::after {
    content: 'âœ“';
}

.step-label {
    position: absolute;
    top: 40px;
    font-size: 0.7rem;
    white-space: nowrap;
    color: var(--text-muted);
}

.step-indicator.active .step-label {
    color: var(--primary-color);
    font-weight: 600;
}

/* Form Steps */
.form-step {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-step.active {
    display: block;
}

/* TransiÃ§Ã£o de SeÃ§Ãµes - Premium Slide + Fade */
@keyframes sectionEnter {
    from { 
        opacity: 0; 
        transform: translateX(20px); 
        filter: blur(5px);
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
        filter: blur(0);
    }
}

section.section.active {
    display: block !important;
    animation: sectionEnter 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
}

/* Staggered Entrance (Efeito Cascata) */
.animate-stagger > * {
    opacity: 0;
}

.animate-stagger.active > * {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Delays para o Stagger */
.animate-stagger.active > *:nth-child(1) { animation-delay: 0.1s; }
.animate-stagger.active > *:nth-child(2) { animation-delay: 0.15s; }
.animate-stagger.active > *:nth-child(3) { animation-delay: 0.2s; }
.animate-stagger.active > *:nth-child(4) { animation-delay: 0.25s; }
.animate-stagger.active > *:nth-child(5) { animation-delay: 0.3s; }
.animate-stagger.active > *:nth-child(6) { animation-delay: 0.35s; }

@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Pulse de SincronizaÃ§Ã£o Premium */
.sync-icon-container.syncing {
    color: var(--warning-color) !important;
    animation: premiumSyncPulse 2s infinite ease-in-out;
}

@keyframes premiumSyncPulse {
    0% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 0px var(--warning-color)); }
    50% { transform: scale(1.2); opacity: 0.7; filter: drop-shadow(0 0 8px var(--warning-color)); }
    100% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 0px var(--warning-color)); }
}

/* Melhora nos itens de lista para parecerem mais premium */
.list-item-premium {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.list-item-premium:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
    background: rgba(16, 185, 129, 0.03);
}

/* TOAST PREMIUM COM BARRA DE PROGRESSO */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 15000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast.hide {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { transform: translateX(100%) scale(0.9); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0) scale(1); opacity: 1; }
    to { transform: translateX(100%) scale(0.9); opacity: 0; }
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary-color);
    width: 100%;
    transform-origin: left;
    animation: toastProgress 5s linear forwards;
}

.toast.success .toast-progress { background: var(--receita-color); }
.toast.error .toast-progress { background: var(--despesa-color); }
.toast.warning .toast-progress { background: var(--warning-color); }
.toast.info .toast-progress { background: var(--info-color); }

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.toast-icon { font-size: 1.25rem; }
.toast.success .toast-icon { color: var(--receita-color); }
.toast.error .toast-icon { color: var(--despesa-color); }
.toast.warning .toast-icon { color: var(--warning-color); }
.toast.info .toast-icon { color: var(--info-color); }

.toast-content { flex: 1; }
.toast-title { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 2px; }
.toast-message { font-size: 0.85rem; color: var(--text-muted); margin: 0; line-height: 1.4; }

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: 0.2s;
}

.toast-close:hover { opacity: 1; transform: scale(1.1); }

.step-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    gap: 1rem;
}

/* MODAIS PREMIUM */
.modal-premium {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-premium.active {
    display: flex;
}

.modal-premium .modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 450px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* DOCUMENT RECEIPT PREVIEW */
.receipt-container {
    background: #fff;
    color: #1a1a1a;
    border-radius: 12px;
    padding: 2rem;
    text-align: left;
    margin: 1.5rem 0;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
    position: relative;
    border: 1px dashed #ccc;
}

.receipt-container::before, .receipt-container::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 10px;
}

.receipt-header {
    text-align: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.5rem 0;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.receipt-row span:first-child {
    color: #64748b;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.receipt-row strong {
    max-width: 65%;
    word-break: break-word;
    text-align: right;
}

/* Scrollable receipt modal body */
#documentPreviewModal .modal-content {
    max-height: 92vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#documentReceipt {
    overflow-y: auto;
    max-height: 58vh;
    -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
}

/* Modal de Detalhes do Dia (Agenda) */
.day-detail-box {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    width: 100%;
    max-width: 650px;
    margin: 20px auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    color: var(--text-main);
    max-height: 90vh;
    overflow-y: auto;
}

.light-mode .day-detail-box {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.day-detail-box h4 {
    margin-top: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Custom Scrollbar para o modal mobile */
.day-detail-box::-webkit-scrollbar {
    width: 6px;
}

.day-detail-box::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #10B981 rgba(0,0,0,0.1);
    padding-right: 4px; /* space for scrollbar */
}

#documentReceipt::-webkit-scrollbar {
    width: 5px;
}

#documentReceipt::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
}

#documentReceipt::-webkit-scrollbar-thumb {
    background: #10B981;
    border-radius: 10px;
}

@media (max-width: 600px) {
    #documentReceipt {
        max-height: 50vh;
    }
}

/* Buttons */
.btn {
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    background: var(--primary-color);
    color: white;
}

.btn-full { width: 100%; justify-content: center; }

.btn:active { transform: scale(0.98); }

/* Custom File Upload */
.custom-file-upload {
    background: var(--bg-input);
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
}

/* Scrollbar Modern */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Mobile Optimizations */
@media (max-width: 768px) {
    .card { padding: 0.85rem; border-radius: 16px; margin-bottom: 1rem; }
    .card-header { padding-bottom: 0.5rem; margin-bottom: 0.8rem; gap: 8px; }
    .card-header h2 { font-size: 1rem; }
    .card-header i { font-size: 1rem; }
    
    .form-grid { grid-template-columns: 1fr; gap: 0.6rem; }
    .form-group { margin-bottom: 0.6rem; }
    .form-group label { font-size: 0.8rem; margin-bottom: 2px; }
    .form-group input, .form-group select, .form-group textarea { 
        padding: 0.6rem 0.75rem; 
        font-size: 0.9rem; 
        border-radius: 10px;
    }
    
    .btn { padding: 0.65rem 1rem; font-size: 0.85rem; border-radius: 10px; }
    .step-label { display: none; }
    .stepper-container { margin-bottom: 1rem; padding: 0.25rem 0; }
    .stepper-steps::before { top: 12px; }
    .step-indicator { width: 28px; height: 28px; font-size: 0.75rem; }
    
    .modal-premium .modal-content { padding: 1.25rem; border-radius: 20px; }
    .step-actions { margin-top: 1.5rem; gap: 0.8rem; }
}

/* Mobile Layout Optimization (v2.7) - Standardized for all mobile devices */
@media (max-width: 768px) {
    .card { padding: 12px !important; margin-bottom: 12px !important; margin-top: 0 !important; }
    .card-header { display: flex !important; margin-bottom: 10px !important; border-bottom: 1px solid var(--border-color); padding-bottom: 8px !important; }
    .card-header h2 { font-size: 0.95rem !important; }
    
    .stepper-container { margin-bottom: 12px !important; padding: 4px 0 !important; }
    .step-indicator { width: 28px !important; height: 28px !important; font-size: 12px !important; }
    .stepper-steps::before { top: 13px !important; }
    
    .form-group { margin-bottom: 8px !important; position: relative; }
    .form-group label { font-size: 0.75rem !important; margin-bottom: 3px !important; font-weight: 600; }
    .form-group input, .form-group select, .form-group textarea { 
        padding: 9px 12px !important; 
        font-size: 15px !important; 
        min-height: 42px !important;
        border-radius: 8px !important;
    }
    
    .btn { padding: 11px 18px !important; font-size: 14px !important; font-weight: 600 !important; }
    .step-actions { margin-top: 1.25rem; }

    /* Layout de Grade para Mobile (empilhado por padrÃ£o, 2 colunas se houver espaÃ§o) */
    .form-row-mobile {
        display: grid !important;
        grid-template-columns: 1fr !important; /* Volto para 1 coluna por padrÃ£o no mobile */
        gap: 10px !important;
        grid-column: span 2 !important;
        width: 100% !important;
    }

    @media (min-width: 601px) {
        .form-row-mobile {
            grid-template-columns: 1fr 1fr !important;
        }
    }
    
    .form-row-mobile > .form-group {
        margin-bottom: 0 !important;
    }

    /* AÃ§Ãµes de Filtro Mobile */
    .filter-actions-mobile {
        display: flex !important;
        gap: 8px !important;
        width: 100% !important;
    }
    .filter-actions-mobile .btn { flex: 1 !important; }
    
    .hide-mobile { display: none !important; }

    /* ForÃ§a empilhamento em 1 coluna para qualquer linha mobile se for muito estreito */
    @media (max-width: 500px) {
        .form-row-mobile {
            grid-template-columns: 1fr !important;
        }
        .form-group input {
            font-size: 14px !important;
        }
    }
    
    /* Ajuste para o botÃ£o de chat */
    #chat-widget-button { transform: scale(0.85); bottom: 10px; right: 10px; opacity: 0.9; }
}

/* Subtle Cards for Sustainability */
.card-subtle {
    border: 1px solid var(--border-color) !important;
    background: rgba(16, 185, 129, 0.03) !important;
    padding: 1rem !important;
}

.card-subtle .card-header i { font-size: 1.1rem; }
.card-subtle .card-header h2 { font-size: 1rem; }

.mini-feature-card {
    text-align: center;
    padding: 0.75rem !important;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.mini-feature-card i { font-size: 1.4rem !important; margin-bottom: 6px !important; }
.mini-feature-card p { font-size: 0.8rem !important; line-height: 1.3; }
.mini-feature-card .btn { padding: 0.5rem 0.8rem; font-size: 0.8rem; margin-top: 8px; }

/* Feedback de ValidaÃ§Ã£o */
.input-error {
    border-color: var(--despesa-color) !important;
    animation: shake 0.3s ease-in-out;
    background-color: rgba(239, 68, 68, 0.05) !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Status Cards & Stat Values Optimizations (v3.1) */
.status-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.status-card {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.glow-card {
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.2);
}

.glow-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.05), transparent 70%);
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.5s ease;
}

.glow-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.3);
    border-color: rgba(16, 185, 129, 0.3);
}

/* Light Mode Card Enhancements */
.light-mode .status-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
    border: 1px solid rgba(16, 185, 129, 0.1);
    box-shadow: 0 8px 25px -10px rgba(0, 0, 0, 0.1);
}

.light-mode .glow-card::after {
    background: radial-gradient(circle at 20% 20%, rgba(16, 185, 129, 0.1), transparent 50%);
}

.light-mode .status-card:hover {
    box-shadow: 0 12px 30px -10px rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1100px) {
    .status-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .status-card {
        display: flex;
        flex-direction: row !important;
        align-items: center;
        gap: 1.25rem;
        padding: 1.25rem !important;
    }

    .status-card-icon {
        margin-top: 0 !important;
        width: 40px !important;
        height: 40px !important;
        flex-shrink: 0;
    }

    .status-card-info {
        margin-top: 0 !important;
        text-align: left !important;
        flex: 1;
    }

    .stat-value {
        font-size: 1.25rem !important;
        margin-top: 2px !important;
    }
}

@media (max-width: 480px) {
    .status-card {
        padding: 1rem !important;
    }
    .stat-value {
        font-size: 1.15rem !important;
    }
}

/* MovimentaÃ§Ãµes de Caixa & General Lancamento Items Fix (v3.0) */
.lancamento-item-premium {
    width: 100%;
    overflow: hidden;
}

@media (max-width: 480px) {
    .lancamento-item-premium {
        padding: 0.75rem !important;
    }
    
    .lancamento-item-premium .info-value, 
    .lancamento-item-premium .stat-value,
    .lancamento-item-premium div[style*="font-weight: 800"] {
        font-size: 0.95rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

    .lancamento-item-premium div[style*="font-weight: 700"] {
        font-size: 0.9rem !important;
    }
}

/* 
   HISTORY MODERN INTERFACE (v2.7) 
   Timeline Cards & Filter Tabs
*/

.history-controls {
    margin-bottom: 2rem;
}

.history-tabs {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: 14px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.h-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.h-tab i { font-size: 0.9rem; }

.h-tab.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.h-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* History Summary Box */
.history-premium-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 1rem;
    animation: fadeIn 0.5s ease;
}

.h-summary-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
}

.h-summary-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 4px;
}

.h-summary-value {
    font-size: 1.15rem;
    font-weight: 800;
}

.h-summary-value.in { color: var(--receita-color); }
.h-summary-value.out { color: var(--despesa-color); }

/* Timeline Container & Cards */
.history-timeline-container {
    position: relative;
    padding-left: 10px;
}

.history-timeline-container::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-color), transparent);
    opacity: 0.2;
}

.history-card {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    margin-left: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    animation: fadeInUp 0.4s ease backwards;
}

.history-card::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid var(--bg-main);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    z-index: 2;
}

.history-card:hover {
    transform: translateX(5px);
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(255, 255, 255, 0.04);
}

.h-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.h-card-icon.in { 
    background: rgba(16, 185, 129, 0.1); 
    color: var(--receita-color); 
}

.h-card-icon.out { 
    background: rgba(239, 68, 68, 0.1); 
    color: var(--despesa-color); 
}

.h-card-info {
    flex: 1;
    min-width: 0;
}

.h-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.h-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.h-card-value {
    text-align: right;
    flex-shrink: 0;
}

.h-card-amount {
    font-size: 1.1rem;
    font-weight: 800;
    display: block;
}

.h-card-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
    margin-top: 4px;
    display: inline-block;
}

.h-card-badge.in { background: rgba(16, 185, 129, 0.15); color: var(--receita-color); }
.h-card-badge.out { background: rgba(239, 68, 68, 0.15); color: var(--despesa-color); }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .history-card {
        padding: 0.8rem;
        gap: 10px;
        margin-left: 15px;
    }
    
    .history-timeline::before {
        left: 5px;
    }

    .h-card-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .h-card-amount {
        font-size: 0.95rem;
    }
    
    .h-card-title {
        font-size: 0.8rem;
    }

    .history-filters {
        padding: 12px;
    }

    .historico-resumo {
        grid-template-columns: 1fr !important;
        gap: 12px;
        width: 100%;
    }

    .card-resumo-mini {
        padding: 12px;
        min-height: 80px;
    }

    @media (min-width: 420px) {
        .historico-resumo {
            grid-template-columns: 1fr 1fr !important;
        }
    }

    .card-resumo-mini {
        padding: 0.8rem;
    }
}

@media (max-width: 480px) {
    .history-card {
        margin-left: 0 !important;
        padding: 10px;
        border-radius: 12px;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* ForÃ§a o empilhamento em 1 coluna para o histÃ³rico em todo o range mobile */
    .history-filters .form-row-mobile {
        grid-template-columns: 1fr !important;
    }

    .history-timeline.card {
        padding: 10px 6px !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .history-premium-summary {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    @media (min-width: 601px) {
        .history-premium-summary {
            grid-template-columns: 1fr 1fr !important;
        }
    }

    /* Esconde a linha e a bolinha da timeline em telas muito pequenas para ganhar espaÃ§o */
    .history-timeline::before,
    .history-card::before {
        display: none !important;
    }

    .history-filters {
        padding: 8px !important;
        margin-bottom: 1.2rem;
        width: 100%;
        box-sizing: border-box;
        border-radius: 12px;
    }

    .h-card-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .h-card-right {
        width: 100%;
        text-align: left !important;
        margin-top: 6px;
        justify-content: flex-start !important;
        padding-left: 0;
    }

    .history-filters .form-group {
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    .filter-actions-mobile {
        flex-direction: row !important; /* Lado a lado para nÃ£o ficar gigante */
        width: 100% !important;
        gap: 8px !important;
    }

    .filter-actions-mobile .btn {
        flex: 1 !important;
        justify-content: center;
        padding: 6px !important;
        height: 36px; /* Mais baixo ainda a pedido */
    }

    .h-card-amount {
        font-size: 1.1rem !important; /* Destaca o valor */
    }
}



/* History Filters (v2.7+) */
.history-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.history-filters .form-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
}

@media (min-width: 769px) {
    .history-filters {
        flex-direction: row;
        align-items: flex-end;
        gap: 16px;
    }
    .history-filters .form-row-mobile {
        flex: 1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-bottom: 0 !important;
    }
    .history-filters .filter-actions-mobile {
        width: auto !important;
    }
}

/* SKELETON SCREENS */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border-color) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 8px;
    color: transparent !important;
    pointer-events: none;
    min-height: 1em;
    display: inline-block;
    width: 100%;
}

@keyframes skeleton-loading {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* PREMIUM TABLE HOVER */
.table-container table tbody tr {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.table-container table tbody tr:hover {
    background: rgba(16, 185, 129, 0.06) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    z-index: 5;
}

.light-mode .table-container table tbody tr:hover {
    background: rgba(16, 185, 129, 0.08) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}



/* GLASSMORPHISM PARA MODAIS */
.modal { backdrop-filter: blur(8px) saturate(180%); -webkit-backdrop-filter: blur(8px) saturate(180%); background-color: rgba(15, 23, 42, 0.7) !important; }
.modal-content { background: rgba(30, 41, 59, 0.9) !important; backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, 0.1) !important; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important; }
.light-mode .modal-content { background: rgba(255, 255, 255, 0.85) !important; border: 1px solid rgba(0, 0, 0, 0.05) !important; }

/* FLOATING ACTION BUTTON (FAB) - AJUSTE MOBILE ONLY */
.fab-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999; /* Abaixo do modal */
    display: none;
}

.fab-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}



/* FLOATING ACTION BUTTON (FAB) - ULTRA COMPACTO */
.fab-container {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 900;
    display: none;
}

.fab-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .fab-container {
        display: block;
    }
}

.fab-options {
    position: absolute;
    bottom: 55px;
    right: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.25s ease;
}

.fab-container.active .fab-options {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.fab-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    font-size: 14px;
}

.fab-option:hover {
    background: var(--primary);
    color: white;
}

.fab-option[data-label]::after {
    content: attr(data-label);
    position: absolute;
    right: 50px;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
}



/* BUSCA VIVA - PREMIUM MOBILE FIXED */
.search-input-wrapper {
    position: relative;
    margin-bottom: 15px;
    width: 100%;
    max-width: 100%; /* No mobile ocupa tudo */
    display: block !important; /* Garante que apareÃ§a */
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    z-index: 5;
}

.search-input-wrapper .search-live {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    border-radius: 10px !important;
    padding: 10px 10px 10px 38px !important;
    font-size: 0.85rem !important;
    width: 100% !important;
    -webkit-appearance: none;
}

.search-input-wrapper .search-live:focus {
    border-color: var(--primary) !important;
    background: var(--bg-card) !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15) !important;
    outline: none !important;
}

.search-input-wrapper .search-live::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}
.search-input-wrapper .search-live { padding-left: 35px !important; }


/* --- SISTEMA PREMIUM DE BOTÕES FLUTUANTES --- */
#btnFeedbackFlutuante, .fab-container { position: fixed; z-index: 999; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: none; }
#btnFeedbackFlutuante, .fab-btn { width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important; border-radius: 50% !important; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(0,0,0,0.3); border: none; cursor: pointer; padding: 0 !important; }
#btnFeedbackFlutuante i, .fab-btn i { font-size: 18px !important; }
.pos-right { right: 15px !important; left: auto !important; bottom: 15px !important; display: block !important; }
.pos-right .fab-options { right: 0 !important; left: auto !important; align-items: flex-end !important; }
.pos-right .fab-option[data-label]::after { right: 50px !important; left: auto !important; }
.pos-left { left: 15px !important; right: auto !important; bottom: 15px !important; display: block !important; }
.pos-left .fab-options { left: 4px !important; right: auto !important; align-items: flex-start !important; }
.pos-left .fab-option[data-label]::after { left: 50px !important; right: auto !important; }
#btnFeedbackFlutuante.pos-right { display: flex !important; }

/* === MELHORIAS VISUAIS PREMIUM - BOTÕES FLUTUANTES (FAB) === */

/* Botão Principal */
#btnFeedbackFlutuante, .fab-btn {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4), inset 0 2px 0 rgba(255,255,255,0.2) !important;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s !important;
}

#btnFeedbackFlutuante:hover, .fab-btn:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.5), inset 0 2px 0 rgba(255,255,255,0.2) !important;
}

#btnFeedbackFlutuante i, .fab-btn i { 
    font-size: 22px !important; 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important; 
}

/* Animação de rotação ao abrir (Transforma o + em X) */
.fab-container.active .fab-btn i { 
    transform: rotate(135deg) !important; 
}

/* Botões Menores (Opções) */
.fab-option {
    width: 44px !important;
    height: 44px !important;
    background: var(--bg-card) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: var(--primary) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.fab-option:hover {
    background: var(--primary) !important;
    color: white !important;
    transform: scale(1.15) !important;
    border-color: transparent !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4) !important;
}

.fab-option i { 
    font-size: 18px !important; 
}

/* Labels (Textos dos botões menores) */
.fab-option[data-label]::after {
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
    transition: all 0.2s ease !important;
}

/* Ajuste de distância dos labels para o novo tamanho dos botões */
.pos-right .fab-option[data-label]::after,
.fab-container:not(.pos-left) .fab-option[data-label]::after { 
    right: 60px !important; 
}

.pos-left .fab-option[data-label]::after { 
    left: 60px !important; 
}
