/*GERAL & VARIAVEIS*/
:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --muted: #64748b;
    --primary: #0ea5e9;
    --accent: #7c3aed;
    --font-color: #0f172a;
    --border-color: #e2e8f0;
    --shadow-color: rgba(16, 24, 40, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--font-color);
    line-height: 1.6;
}

/*LAYOUT PRINCIPAL*/
.topbar {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    color: #fff;
    padding: 20px 28px;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0.2px;
}

.topbar .subtitle {
    opacity: .95;
    margin: 6px 0 0;
    font-size: 14px;
}

.container {
    max-width: 1400px;
    margin: 24px auto;
    padding: 0 24px;
}

.footer {
    text-align: center;
    padding: 20px;
    color: var(--muted);
    margin-top: 24px;
    font-size: 14px;
}

/*SECÇÕES*/
section {
    background: var(--surface);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--shadow-color);
    border: 1px solid var(--border-color);
    margin-top: 20px;
}

/*CONTROLOS E FILTROS*/
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.file-upload {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filters {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    flex-direction: column;
}

.filter-item label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
}

select, input[type=date], input[type=search] {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    min-width: 180px;
    font-size: 14px;
}

input[type="file"] {
    display: none;
}

/*BOTÕES*/
.btn {
    background: linear-gradient(90deg, var(--accent), var(--primary));
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 6px 18px var(--shadow-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}

.btn.secondary {
    background: var(--surface);
    color: var(--font-color);
    border: 1px solid var(--border-color);
}

/*CARDS*/
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.card {
    background: var(--surface);
    padding: 20px;
    border-radius: 12px;
}

.card small {
    color: var(--muted);
    font-weight: 500;
}

.card-value {
    font-weight: 700;
    margin-top: 10px;
    font-size: 24px;
    color: var(--font-color);
}

/*RÁFICO E TABELA*/
.visuals {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    margin-top: 20px;
}

.chart-wrap {
    padding: 16px;
}

.table-wrap {
    max-height: 520px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    position: sticky;
    top: -1px;
    background: #f8fafc;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
}

tbody td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
}

tbody tr:hover {
    background: #f8fafc;
}

#txCount {
    font-size: 13px;
    color: var(--muted);
    padding: 6px 10px;
}


.ai-output {
    background: #f1f5f9;
    color: var(--font-color);
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
    max-height: 220px;
    overflow: auto;
    font-family: monospace;
    font-size: 13px;
    white-space: pre-wrap;
}


@media(max-width: 1000px) {
    .visuals {
        grid-template-columns: 1fr;
    }
    .filters {
        width: 100%;
        justify-content: flex-start;
    }
}

.unpaid-row {
    background-color: #fff1f2 !important; 
    color: #9f1239; 
}

.unpaid-row:hover {
    background-color: #ffe4e6 !important;
}


.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-pago {
    background-color: #dcfce7;
    color: #166534;
}

.status-previsto {
    background-color: #fee2e2;
    color: #991b1b;
}


.value-revenue {
    color: #166534; 
    font-weight: 500;
}

.value-expense {
    color: #991b1b; 
    font-weight: 500;
}


.btn-small {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    background: var(--muted);
    color: white;
    cursor: pointer;
    border: none;
}



#aiOutput {
    white-space: normal;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.7;
}

#aiOutput p {
    margin: 0 0 10px 0;
}

#aiOutput .insight-highlight {
    background-color: #f0f9ff; 
    border-left: 4px solid var(--primary);
    padding: 15px;
    margin-top: 15px;
    border-radius: 0 8px 8px 0;
}

#aiOutput .insight-highlight strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 8px;
}

#aiOutput .error-message {
    color: #ef4444;
    font-weight: 500;
}

.value-cell {
    display: flex;
    align-items: center;
    gap: 8px; 
    font-weight: 500;
}

.value-indicator {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: white;
    text-align: center;
    line-height: 18px;
    font-size: 12px;
}

.indicator-revenue {
    background-color: #16a34a; 
}

.indicator-expense {
    background-color: #ef4444; 
}

#notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    padding: 15px 20px;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(120%);
    animation: slideIn 0.5s forwards, fadeOut 0.5s 4.5s forwards;
}

.notification.success {
    background: linear-gradient(90deg, #10b981, #14b8a6);
}

.notification.error {
    background: linear-gradient(90deg, #f43f5e, #ef4444);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(120%);
    }
}