* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    /* Imagem de fundo clareada */
    background: linear-gradient(rgba(248, 250, 252, 0.85), rgba(241, 245, 249, 0.90)), url('fundo.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #1e293b; /* Texto principal escuro */
    min-height: 100vh;
    padding: 24px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header { margin-bottom: 32px; }

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 0px;
}

.title-text {
    /* Degradê azul mais escuro para fundo claro */
    background: linear-gradient(to right, #0284c7, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo {
    height: 100px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    margin-right: 10px;
}

.subtitle { color: #64748b; font-size: 1rem; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

/* Cards com cores fortes (destaque no fundo claro) */
.stat-card {
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: white; /* Texto branco dentro dos cards coloridos */
    border: none;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15); }

.stat-received { background: linear-gradient(135deg, #10b981, #059669); }
.stat-pending { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-clients { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-debtors { background: linear-gradient(135deg, #f97316, #ea580c); }

.stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.icon { width: 32px; height: 32px; }
.icon-small { width: 24px; height: 24px; }
.stat-value { font-size: 1.75rem; font-weight: 700; margin-bottom: 4px; }
.stat-label { font-size: 0.875rem; opacity: 0.9; }

/* Paineis e Containers (Efeito Vidro Claro) */
.controls-panel, .add-client-form, .table-container, .chart-container, .stats-predict, .empty-state {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.controls-panel { padding: 24px; margin-bottom: 24px; }
.add-client-form { padding: 24px; margin-bottom: 24px; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

.controls-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.controls-left, .controls-right { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }

.icon-control { width: 24px; height: 24px; color: #0284c7; }

/* Inputs e Selects */
.select-input, .select-filter, .form-input {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 16px;
    color: #1e293b;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-input:focus, .select-filter:focus, .form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.filters-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid #e2e8f0; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; cursor: pointer; color: #475569; }
.client-count { margin-left: auto; font-size: 0.875rem; color: #64748b; }

/* Botões */
.btn {
    display: flex; align-items: center; gap: 8px; padding: 10px 20px;
    border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 500;
    cursor: pointer; transition: all 0.3s ease; color: white;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15); filter: brightness(1.05); }
.btn-icon { width: 20px; height: 20px; }

.btn-add { background: linear-gradient(to right, #0284c7, #2563eb); }
.btn-report { background: linear-gradient(to right, #7c3aed, #6d28d9); }
.btn-report-general { background: linear-gradient(to right, #4f46e5, #4338ca); }
.btn-save { background: linear-gradient(to right, #10b981, #059669); }
.btn-cancel { background: #e2e8f0; color: #475569; }
.btn-cancel:hover { background: #cbd5e1; }
.btn-export { background: linear-gradient(to right, #f59e0b, #d97706); }
.btn-import { background: linear-gradient(to right, #8b5cf6, #6d28d9); }
.btn-danger { background: linear-gradient(to right, #ef4444, #b91c1c); }

.form-title { font-size: 1.5rem; font-weight: 700; color: #0f172a; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-bottom: 16px; }
.form-input { padding: 12px 16px; width: 100%; }
.full-width { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 12px; }

/* Tabela */
.table-container { width: 100%; overflow: auto; max-height: 65vh; }
.clients-table { width: 100%; border-collapse: collapse; }
.clients-table thead th {
    position: sticky; top: 0; z-index: 10;
    background-color: #f8fafc;
    color: #475569;
    padding: 16px 24px; text-align: left; font-size: 0.85rem; font-weight: 700; text-transform: uppercase;
    border-bottom: 2px solid #e2e8f0;
}
.clients-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background-color 0.2s ease; }
.clients-table tbody tr:hover { background: #f8fafc; }
.clients-table td { padding: 16px 24px; font-size: 0.9rem; color: #334155; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Status Badges */
.status-badge { display: inline-block; padding: 6px 16px; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.status-paid { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.status-debtor { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.status-overdue { background: #fef2f2; color: #991b1b; animation: pulse 2s infinite; border: 1px solid #fecaca; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
.status-future { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.status-new { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Ícones da Tabela */
.boleto-actions, .action-btns { display: flex; gap: 8px; justify-content: center; }
.boleto-btn, .action-btn { padding: 6px; background: transparent; border: none; border-radius: 4px; cursor: pointer; transition: all 0.2s ease; }
.boleto-btn svg, .action-btn svg { width: 18px; height: 18px; }
.boleto-btn.active { color: #10b981; }
.boleto-btn.active-blue { color: #3b82f6; }
.boleto-btn.active-purple { color: #a855f7; }
.boleto-btn.inactive { color: #94a3b8; }
.boleto-btn:hover, .action-btn:hover { background: #f1f5f9; }
.action-btn-edit { color: #0ea5e9; }
.action-btn-delete { color: #ef4444; }

/* Empty State */
.empty-state { padding: 48px; text-align: center; }
.empty-icon { width: 64px; height: 64px; color: #94a3b8; margin: 0 auto 16px; }
.empty-text { color: #64748b; font-size: 1.125rem; margin-bottom: 16px; }

/* LOGIN OVERLAY */
.login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(248, 250, 252, 0.8); backdrop-filter: blur(8px);
    z-index: 9999; display: flex; justify-content: center; align-items: center;
}
.login-box {
    background: rgba(255, 255, 255, 0.9);
    padding: 2.5rem; border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    width: 100%; max-width: 400px; text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.login-box h2 { color: #0f172a; margin-bottom: 10px; font-size: 1.8rem; }
.login-box p { color: #64748b; margin-bottom: 25px; }
.login-box input {
    width: 100%; padding: 12px; margin-bottom: 15px;
    background: #f8fafc; border: 1px solid #cbd5e1;
    color: #1e293b; border-radius: 8px; transition: all 0.3s;
}
.login-box input:focus { border-color: #3b82f6; background: #ffffff; outline: none; }
.login-btn {
    width: 100%; padding: 12px;
    background: linear-gradient(to right, #3b82f6, #2563eb);
    color: white; border: none; border-radius: 8px;
    cursor: pointer; font-weight: bold; font-size: 1rem;
    transition: transform 0.2s;
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(37, 99, 235, 0.2); }
.login-links { margin-top: 20px; font-size: 0.9rem; color: #64748b; }
.login-links a { color: #2563eb; text-decoration: none; }
.login-links a:hover { text-decoration: underline; }

/* Pesquisa */
.search-wrapper { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 10px; width: 16px; height: 16px; color: #94a3b8; pointer-events: none; }
.search-input { padding-left: 36px !important; min-width: 200px; }
.search-input:focus + .search-icon { color: #0284c7; }

/* Status Certificado */
.status-cert-ok { color: #059669; font-size: 0.8rem; font-weight: 600; }
.status-cert-warn { color: #d97706; font-size: 0.8rem; font-weight: 600; background: #fef3c7; padding: 2px 6px; border-radius: 4px; }
.status-cert-err { color: #dc2626; font-size: 0.8rem; font-weight: 600; background: #fee2e2; padding: 2px 6px; border-radius: 4px; }

/* Rolagem Customizada */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; border: 2px solid #f1f5f9; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Widget IA Simplificado para Fundo Claro */
.ai-float-btn {
    position: fixed; bottom: 20px; right: 20px; width: 60px; height: 60px;
    background: linear-gradient(135deg, #0ea5e9, #2563eb); border-radius: 50%;
    border: none; color: white; cursor: pointer; box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3); z-index: 1000;
}
.ai-widget {
    position: fixed; bottom: 90px; right: 20px; width: 350px; height: 500px;
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px);
    border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    z-index: 1000; display: none; flex-direction: column; overflow: hidden;
}
.ai-header { padding: 15px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.ai-title { display: flex; align-items: center; gap: 8px; font-weight: bold; color: #0f172a; }
.close-chat { background: none; border: none; color: #64748b; font-size: 1.2rem; cursor: pointer; }
.ai-messages { flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { padding: 10px 14px; border-radius: 12px; font-size: 0.9rem; max-width: 85%; }
.ai-msg.bot { background: #f1f5f9; color: #1e293b; align-self: flex-start; border-bottom-left-radius: 2px; }
.ai-msg.user { background: #3b82f6; color: white; align-self: flex-end; border-bottom-right-radius: 2px; }
.ai-input-area { padding: 15px; border-top: 1px solid #e2e8f0; display: flex; gap: 8px; background: #f8fafc;}
.ai-input-area input { flex: 1; background: white; border: 1px solid #cbd5e1; padding: 10px; border-radius: 8px; color: #1e293b; }
.ai-input-area button { background: #3b82f6; border: none; color: white; width: 40px; border-radius: 8px; cursor: pointer; }

/* Dashboard Titles Light */
.chart-container h3 { color: #0f172a !important; }
.stats-predict h3 { color: #059669 !important; }
.stats-predict p { color: #334155 !important; }

@media (max-width: 768px) {
    .title { font-size: 2rem; }
    .controls-row, .controls-left, .controls-right { flex-direction: column; width: 100%; align-items: stretch; }
    .btn { width: 100%; justify-content: center; }
    .clients-table { min-width: 900px; }
}

/* ========================================================
   FORÇAR TAMANHO CORRETO DOS ÍCONES DE PESQUISA E FILTRO
   ======================================================== */
.search-wrapper { position: relative; display: flex; align-items: center; }

.search-icon { 
    position: absolute !important; 
    left: 10px !important; 
    width: 18px !important; 
    height: 18px !important; 
    color: #64748b !important; 
    pointer-events: none; 
}

.search-input { padding-left: 36px !important; min-width: 200px; }
.search-input:focus + .search-icon { color: #0284c7 !important; }

.icon-control { 
    width: 22px !important; 
    height: 22px !important; 
    color: #0284c7 !important; 
}