
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', sans-serif; background: linear-gradient(135deg, #1a237e 0%, #283593 100%); min-height: 100vh; padding: 15px; }
.container { max-width: 1000px; margin: 5px auto; background: white; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden; }

/* Header */
.header { background: linear-gradient(135deg, #1a237e, #283593); color: white; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.header h2 { font-size: 18px; }
.header-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-add { background: white; color: #1a237e; border: none; padding: 8px 16px; border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer; }
.btn-back { background: rgba(255,255,255,0.2); color: white; border: 2px solid white; padding: 7px 13px; border-radius: 6px; font-weight: 600; font-size: 13px; text-decoration: none; }
.versao { font-size: 10px; opacity: 0.6; margin-top: 2px; }
.content { padding: 15px 20px; }

/* Summary cards */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 15px; }
.summary-card { border-radius: 10px; padding: 12px; text-align: center; }
.summary-card .label { font-size: 10px; font-weight: 600; opacity: 0.85; margin-bottom: 4px; text-transform: uppercase; }
.summary-card .value { font-size: 16px; font-weight: 800; }
.s-mensal { background: #e8eaf6; color: #1a237e; }
.s-anual  { background: #e3f2fd; color: #0d47a1; }
.s-alerta { background: #fff3e0; color: #e65100; }
.s-total  { background: #e8f5e9; color: #1b5e20; }

/* Totais por moeda */
.moeda-row { display: flex; gap: 10px; margin-bottom: 15px; }
.moeda-card { flex: 1; border-radius: 10px; padding: 12px; text-align: center; background: #f5f5f5; }
.moeda-card .moeda-label { font-size: 10px; font-weight: 700; color: #888; text-transform: uppercase; margin-bottom: 4px; }
.moeda-card .moeda-valor { font-size: 20px; font-weight: 800; color: #1a237e; }
.moeda-card .moeda-sub { font-size: 10px; color: #999; }

/* Alertas de vencimento */
.alerta-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; margin-bottom: 6px; font-size: 13px; cursor: pointer; }
.alerta-vermelho { background: #fdecea; color: #c62828; border-left: 4px solid #e53935; }
.alerta-amarelo  { background: #fff8e1; color: #f57f17; border-left: 4px solid #ffc107; }
.alerta-azul     { background: #e3f2fd; color: #1565c0; border-left: 4px solid #1976d2; }
.alerta-item .al-nome { font-weight: 700; flex: 1; }
.alerta-item .al-dias { font-size: 11px; background: rgba(0,0,0,0.08); padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.alerta-item .al-obs  { font-size: 11px; opacity: 0.75; }

/* Totais por empresa */
.empresa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 15px; }
.empresa-card { border-radius: 10px; padding: 12px 14px; background: #f5f5f5; }
.empresa-card .emp-nome { font-size: 11px; font-weight: 700; color: #666; margin-bottom: 4px; }
.empresa-card .emp-valor { font-size: 17px; font-weight: 800; color: #1a237e; }
.empresa-card .emp-sub { font-size: 10px; color: #999; margin-top: 2px; }

/* Filtros */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 15px; }
.filter-btn { padding: 6px 14px; border-radius: 20px; border: 2px solid #ddd; background: white; font-size: 12px; font-weight: 600; cursor: pointer; color: #555; transition: all 0.2s; }
.filter-btn.active { background: #1a237e; color: white; border-color: #1a237e; }

/* Lista despesas */
.despesas-list { display: flex; flex-direction: column; gap: 8px; }
.despesa-item { border: 2px solid #e0e0e0; border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 12px; }
.despesa-item:hover { border-color: #1a237e; box-shadow: 0 3px 12px rgba(0,0,0,0.1); transform: translateY(-1px); }
.despesa-item.alerta-urgente { border-color: #e53935; }
.despesa-item.alerta-atencao { border-color: #ffc107; }
.desp-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.icon-mensal { background: #e8eaf6; }
.icon-anual  { background: #e3f2fd; }
.desp-info { flex: 1; min-width: 0; }
.desp-nome { font-size: 14px; font-weight: 700; color: #222; }
.desp-tags { font-size: 11px; color: #666; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tag { background: #f0f0f0; padding: 2px 7px; border-radius: 8px; font-size: 10px; font-weight: 600; color: #555; }
.tag-empresa { background: #e8eaf6; color: #1a237e; }
.tag-trocar  { background: #fff3e0; color: #e65100; }
.desp-obs { font-size: 11px; color: #888; margin-top: 3px; }
.desp-valor { text-align: right; flex-shrink: 0; min-width: 80px; }
.valor-principal { font-size: 15px; font-weight: 800; color: #1a237e; }
.valor-periodo { font-size: 10px; color: #888; }
.valor-mensal { font-size: 10px; color: #888; }
.vence-badge { font-size: 10px; padding: 2px 7px; border-radius: 8px; font-weight: 600; display: inline-block; margin-top: 3px; }
.vb-ok  { background: #e8f5e9; color: #2e7d32; }
.vb-30  { background: #fff8e1; color: #f57f17; }
.vb-15  { background: #fdecea; color: #c62828; }

/* Seção title */
.section-title { font-size: 12px; font-weight: 700; color: #999; text-transform: uppercase; letter-spacing: 0.5px; margin: 15px 0 8px; }

/* Empty / loading */
.empty-state { text-align: center; padding: 40px 20px; color: #bbb; font-size: 14px; }

/* Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; padding: 15px; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: 16px; width: 100%; max-width: 500px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { background: linear-gradient(135deg, #1a237e, #283593); color: white; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; border-radius: 16px 16px 0 0; position: sticky; top: 0; z-index: 1; }
.modal-header h3 { font-size: 16px; }
.btn-close { background: rgba(255,255,255,0.2); border: none; color: white; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.modal-body { padding: 20px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 11px; font-weight: 700; color: #555; margin-bottom: 5px; text-transform: uppercase; }
.form-group input, .form-group select { width: 100%; padding: 10px 12px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 14px; font-family: 'Segoe UI', sans-serif; transition: border-color 0.2s; background: white; }
.form-group input:focus, .form-group select:focus { border-color: #1a237e; outline: none; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #555; cursor: pointer; }
.check-label input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.btn-save { background: #1a237e; color: white; border: none; padding: 14px; border-radius: 10px; font-weight: 700; font-size: 15px; cursor: pointer; width: 100%; margin-top: 10px; }
.btn-save:hover { background: #283593; }
.btn-delete { background: #c62828; color: white; border: none; padding: 10px; border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer; width: 100%; margin-top: 8px; }
.btn-delete:hover { background: #b71c1c; }
.divider { border: none; border-top: 1px solid #eee; margin: 14px 0; }


/* Abas */
.abas { display: flex; gap: 8px; margin-bottom: 15px; }
.aba { padding: 8px 18px; border-radius: 20px; border: 2px solid #ddd; background: white; font-size: 12px; font-weight: 700; cursor: pointer; color: #555; transition: all 0.2s; }
.aba.aba-active { background: #1a237e; color: white; border-color: #1a237e; }

/* Painel vencimentos */
.venc-mes { margin-bottom: 18px; }
.venc-mes-titulo { font-size: 12px; font-weight: 800; color: #888; text-transform: uppercase; letter-spacing: 0.5px; padding: 6px 0; border-bottom: 2px solid #f0f0f0; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.venc-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; margin-bottom: 6px; background: #fafafa; border: 1px solid #eee; cursor: pointer; transition: all 0.15s; }
.venc-row:hover { border-color: #1a237e; background: #f0f4ff; }
.venc-row.urgente { background: #fdecea; border-color: #ef9a9a; }
.venc-row.atencao { background: #fff8e1; border-color: #ffe082; }
.venc-row.normal  { background: #f3f9ff; border-color: #bbdefb; }
.venc-dias { width: 54px; height: 54px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.venc-dias .num { font-size: 20px; font-weight: 900; line-height: 1; }
.venc-dias .lab { font-size: 9px; font-weight: 700; opacity: 0.8; }
.venc-dias.d-urgente { background: #e53935; color: white; }
.venc-dias.d-atencao { background: #ffc107; color: #333; }
.venc-dias.d-normal  { background: #1976d2; color: white; }
.venc-info { flex: 1; min-width: 0; }
.venc-nome { font-size: 14px; font-weight: 700; color: #222; }
.venc-meta { font-size: 11px; color: #666; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; }
.venc-val { text-align: right; flex-shrink: 0; }
.venc-val .val { font-size: 15px; font-weight: 800; color: #1a237e; }
.venc-val .data { font-size: 10px; color: #888; margin-top: 2px; }
.venc-trocar { background: #fff3e0; color: #e65100; padding: 2px 7px; border-radius: 6px; font-size: 10px; font-weight: 700; }
.venc-vazio { text-align: center; padding: 40px; color: #bbb; font-size: 14px; }
@media (max-width: 600px) {
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .empresa-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .moeda-row { flex-direction: column; }
    .header { flex-direction: column; text-align: center; }
}

