* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #f4f5f7;
    color: #1f2430;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.menu-lateral {
    width: 220px;
    background: #1f2430;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
}

.marca {
    font-weight: 700;
    font-size: 18px;
    padding: 0 20px;
}

.marca-versao {
    font-size: 11px;
    color: #8b93a7;
    padding: 2px 20px 20px;
    border-bottom: 1px solid #333a4d;
    margin-bottom: 10px;
}

.menu-lateral nav {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.menu-lateral nav a {
    color: #c7cbdb;
    text-decoration: none;
    padding: 12px 20px;
}

.menu-lateral nav a:hover {
    background: #2b3145;
    color: #fff;
}

/* Grupos recolhiveis do menu lateral (ex.: Relatorios, Configuracoes) - um
   <details>/<summary> por grupo, sem depender de JS. */
.menu-lateral nav details {
    display: flex;
    flex-direction: column;
}

.menu-lateral nav summary {
    color: #c7cbdb;
    padding: 12px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.menu-lateral nav summary::-webkit-details-marker {
    display: none;
}

.menu-lateral nav summary::before {
    content: '\25B8';
    display: inline-block;
    width: 14px;
    font-size: 11px;
}

.menu-lateral nav details[open] summary::before {
    content: '\25BE';
}

.menu-lateral nav summary:hover {
    background: #2b3145;
    color: #fff;
}

.menu-lateral nav details a {
    display: block;
    padding-left: 40px;
    font-size: 13px;
}

/* Quando o grupo (Relatorios, Configuracoes) esta aberto, o submenu ganha um
   fundo diferente do resto do menu lateral, pra ficar visualmente destacado
   como "voce esta dentro deste grupo agora". */
.menu-lateral nav details[open] {
    background: #171b28;
}

.menu-lateral nav details[open] summary {
    background: #11141d;
}

.rodape-menu {
    padding: 14px 20px 0;
    border-top: 1px solid #333a4d;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #9aa0b5;
}

.rodape-menu a {
    color: #ff8a8a;
    text-decoration: none;
}

.conteudo {
    flex-grow: 1;
    padding: 30px 36px;
    max-width: 1100px;
}

h1 {
    margin-top: 0;
}

.cartoes {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.cartao {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    min-width: 180px;
    flex: 1;
}

.cartao .rotulo {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
}

.cartao .valor {
    font-size: 24px;
    font-weight: 700;
    /* O "R$" nunca fica sozinho em uma linha (formatarMoeda() usa espaco fixo
       entre "R$" e o numero, entao esse par nunca quebra). O resto do texto
       usa a quebra padrao do navegador (so nos espacos normais) - suficiente
       para cartoes com texto longo tipo "R$ 95.251,20 (114,5%)" (quebra antes
       do parenteses) sem nunca partir um numero no meio. */
    /* Empurra o valor para o rodape do cartao, para os valores ficarem
       alinhados entre si mesmo quando o rotulo de um cartao quebra em
       2 linhas e o de outro cabe em 1 (ex.: "Estimativa de receita"). */
    margin-top: auto;
}

.valor.positivo { color: #16a34a; }
.valor.negativo { color: #dc2626; }

/* Cartoes que sao link (ex.: dashboard) levam para uma tela com o detalhe por
   tras do numero, pra dar pra conferir/analisar - sem isso pareceriam um
   <div> comum, ja que .cartao nao tem estilo proprio de link. */
a.cartao {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: box-shadow 0.12s ease, transform 0.06s ease;
}

a.cartao:hover {
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

th, td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid #eef0f4;
    font-size: 14px;
}

th {
    background: #f8f9fb;
    font-weight: 600;
    color: #4b5163;
}

form.form-inline {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

label {
    display: block;
    font-size: 13px;
    color: #4b5163;
    margin-bottom: 4px;
}

input, select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d7dae2;
    border-radius: 6px;
    font-size: 14px;
}

button, .botao {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

button:hover, .botao:hover {
    background: #1e4fc4;
}

.botao.perigo {
    background: #dc2626;
}

.botao.perigo:hover {
    background: #b91c1c;
}

.acoes {
    display: flex;
    gap: 8px;
}

/* Anexar comprovante: botao-icone (abre o seletor de arquivo) + suporte a
   arrastar-e-soltar sobre a linha da despesa/parcela + lista de anexos
   recolhida atras de um botao "Ver anexos", para nao poluir a tabela quando
   ha varios comprovantes. */
.botao-anexar-icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 7px;
    background: #eef1f6;
    color: #4b5568;
    border: 1px solid #dde1e9;
}

.botao-anexar-icone:hover {
    background: #dbe3fb;
    color: #2563eb;
    border-color: #b6c6f7;
}

.botao-ver-comprovantes {
    background: #eef2ff;
    color: #2563eb;
    border: 1px solid #dbe3fb;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.botao-ver-comprovantes:hover {
    background: #dbe3fb;
}

.linha-arrastando-arquivo,
.celula-comprovante.arrastando-arquivo {
    outline: 2px dashed #2563eb;
    outline-offset: -2px;
    background: #eef2ff;
}

.mensagem {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
}

.mensagem.sucesso { background: #dcfce7; color: #166534; }
.mensagem.erro { background: #fee2e2; color: #991b1b; }

.chave-api-gerada {
    background: #111827;
    color: #4ade80;
    padding: 14px;
    border-radius: 8px;
    font-family: monospace;
    word-break: break-all;
    margin-bottom: 18px;
}

.tela-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1f2430;
}

.caixa-login {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    width: 320px;
}

.caixa-login h1 {
    font-size: 20px;
    margin-bottom: 18px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge.pendente { background: #fef9c3; color: #854d0e; }
.badge.pago { background: #dcfce7; color: #166534; }
.badge.atrasado { background: #fee2e2; color: #991b1b; }
.badge.prevista { background: #dcfce7; color: #166534; }
.badge.inesperada { background: #dbeafe; color: #1e40af; }

/* Destaca a linha de um evento quando se chega nela via link com ancora (#id),
   vindo do calendario do dashboard ou de qualquer outro link direto. */
tr:target td {
    background: #fef9c3 !important;
}

.calendario {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
    border: 1px solid #eef0f4;
    margin-bottom: 20px;
}

.calendario-cabecalho {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.calendario-cabecalho strong {
    font-size: 16px;
    letter-spacing: 0.2px;
}

.calendario-grade {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.calendario-dia-semana {
    text-align: center;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #9aa1b1;
    font-weight: 700;
    padding: 4px 0 10px;
}

.calendario-dia {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 72px;
    padding: 8px 4px;
    border-radius: 10px;
    text-decoration: none;
    color: #1f2430;
    background: #fbfbfd;
    border: 1px solid #f1f2f5;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}

.calendario-dia:hover {
    background: #eef2ff;
    border-color: #dbe3fb;
}

.calendario-dia.vazio {
    visibility: hidden;
}

.calendario-dia.hoje {
    border-color: #2563eb;
    background: #f5f8ff;
}

.calendario-dia.hoje .calendario-dia-numero {
    background: #2563eb;
    color: #fff;
}

.calendario-dia.selecionado {
    background: #dbeafe;
    border-color: #93b8f5;
}

.calendario-dia-numero {
    font-size: 15px;
    font-weight: 700;
    color: #333a4d;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    margin-bottom: 6px;
}

.calendario-marcadores {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 14px;
}

.marcador {
    min-width: 15px;
    height: 15px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

.calendario-marcadores .marcador {
    display: inline-flex;
}

.marcador.verde { background: #16a34a; }
.marcador.vermelho { background: #dc2626; }
.marcador.azul { background: #2563eb; }

.resumo-dia {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 28px;
}

.resumo-dia h3 {
    margin-top: 0;
    font-size: 15px;
}

.evento-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eef0f4;
    text-decoration: none;
    color: #1f2430;
    font-size: 14px;
}

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

.evento-item:hover {
    color: #2563eb;
}

.evento-tipo {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    color: #fff;
    margin-right: 8px;
}

.evento-tipo.verde { background: #16a34a; }
.evento-tipo.vermelho { background: #dc2626; }
.evento-tipo.azul { background: #2563eb; }

/* Wrapper de cada evento do resumo do dia (Dashboard): mantem o mesmo visual de
   .evento-item (link com valor), mas agora tambem cabe o toggle "Pagar" embaixo. */
.evento-item-linha {
    padding: 10px 0;
    border-bottom: 1px solid #eef0f4;
    font-size: 14px;
}

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

.evento-item-topo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: #1f2430;
}

.evento-item-topo:hover {
    color: #2563eb;
}

.evento-pagar {
    margin-top: 6px;
}

.evento-pagar summary {
    cursor: pointer;
    font-size: 12px;
    color: #2563eb;
    list-style: none;
    width: fit-content;
}

.evento-pagar summary::-webkit-details-marker {
    display: none;
}

.evento-pagar-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 10px;
    background: #f8f9fb;
    border-radius: 8px;
}

.evento-pagar-form label {
    display: block;
    font-size: 11px;
    color: #4b5163;
    margin-bottom: 3px;
}

.evento-pagar-form input {
    font-size: 12px;
    padding: 5px 8px;
}

.evento-pagar-form button {
    padding: 6px 12px;
    font-size: 12px;
}
