/* ================= DESIGN SYSTEM NICE MOBILE (CORRIGIDO) ================= */
:root {
    --bg-dark: #121212;
    --card-bg: #ffffff;
    --text-main: #2c3e50;
    --accent: #9b59b6;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f1c40f;
    --header-height: 60px;
}

/* Reset para garantir que tudo caiba na tela */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding-bottom: 40px;
    overflow-x: hidden;
    /* Impede que o corpo da página balance */
}

/* ================= BARRA SUPERIOR FIXA ================= */
.user-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5) !important;
}

/* ================= CONTAINER PRINCIPAL ================= */
#conteudoMensal {
    padding: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px;
}

/* ================= CARDS DE RESUMO ================= */
.resumo {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    /* Mantém 2 colunas nos cards */
    gap: 10px !important;
    width: 100% !important;
}

.resumo div {
    border-radius: 12px !important;
    padding: 10px !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.resumo span {
    font-size: 16px !important;
    font-weight: 800;
}

/* ================= TABELAS (O SEGREDO DO "NÃO ESMAGADO") ================= */
/* Adicione esta classe em volta de todas as suas tabelas no HTML */
.tabela-container {
    width: 100%;
    overflow-x: auto;
    /* Ativa o scroll se espremer demais */
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    -webkit-overflow-scrolling: touch;
}

table {
    display: table !important;
    /* CORREÇÃO: Nunca use block em tabelas complexas */
    width: 100% !important;
    min-width: 320px;
    /* Largura mínima para celulares pequenos */
    border-collapse: collapse;
    background: white;
}

/* Tabela de gastos fixos precisa de mais espaço lateral */
#totalFixos,
#totalExtras,
#totalCompras {
    font-weight: bold;
}

th {
    font-size: 10px;
    text-transform: uppercase;
    background-color: #f8f9fa;
    color: #7f8c8d;
    padding: 8px 4px !important;
    text-align: center;
}

td {
    padding: 4px 2px !important;
    border-bottom: 1px solid #f2f2f2;
    text-align: center;
}

/* ================= INPUTS COMPACTOS ================= */
input,
select {
    font-size: 13px !important;
    /* Tamanho bom para leitura */
    padding: 4px !important;
    height: 32px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    width: 100% !important;
    min-width: 60px;
    /* Impede que o input suma */
}

/* Ajuste específico para datas não quebrarem */
input[type="date"] {
    min-width: 95px;
    font-size: 11px !important;
}

input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
}

/* ================= MESES (DESLIZAR HORIZONTAL) ================= */
.navegacao-meses {
    display: flex;
    overflow-x: auto;
    padding: 10px 0;
    gap: 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.btn-mes {
    flex: 0 0 auto;
    background: #34495e;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 15px !important;
    font-size: 12px;
}

/* ================= GRÁFICO ================= */
#graficoGastos {
    max-height: 220px !important;
}

/* Efeito Zebra */
tr:nth-child(even) {
    background-color: #f9f9f9;
}