/* ============================================================
   Cartão Familiar — Estilos Globais
   Fonte: system-ui | Sem frameworks externos
   ============================================================ */

/* --- Reset e base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: #3b6fd4; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout container --- */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Navbar --- */
.navbar {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 12px 0;
    margin-bottom: 32px;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1a1a1a;
    letter-spacing: -0.3px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
}

.navbar-nav a {
    color: #444;
    font-size: 0.9rem;
}

.navbar-nav a:hover { color: #3b6fd4; text-decoration: none; }

.navbar-user {
    font-size: 0.85rem;
    color: #666;
}

/* --- Títulos de página --- */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
}

.page-header p {
    color: #666;
    font-size: 0.95rem;
    margin-top: 4px;
}

/* --- Cards --- */
.card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

.card-highlight {
    background: #3b6fd4;
    color: #fff;
    border: none;
}

.card-highlight .card-label {
    font-size: 0.85rem;
    opacity: 0.85;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-highlight .card-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-top: 4px;
}

.card-highlight .card-sub {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 6px;
}

.card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1a1a1a;
}

/* Grid de cards resumo */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* --- Tabelas --- */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    margin-bottom: 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: #f5f5f5;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid #e0e0e0;
}

tbody tr { border-bottom: 1px solid #f0f0f0; }
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) { background: #fafafa; }
tbody tr:hover { background: #f0f4ff; }

tbody td {
    padding: 10px 14px;
    vertical-align: middle;
}

/* --- Formulários --- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}

.form-control {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: #3b6fd4;
    box-shadow: 0 0 0 3px rgba(59,111,212,0.12);
}

.form-hint {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}

.form-hint.info {
    color: #3b6fd4;
    font-weight: 500;
}

/* --- Botões --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
    gap: 6px;
}

.btn:hover { text-decoration: none; opacity: 0.9; }
.btn:active { opacity: 0.8; }

.btn-primary   { background: #3b6fd4; color: #fff; }
.btn-secondary { background: #e0e0e0; color: #333; }
.btn-danger    { background: #c62828; color: #fff; }
.btn-sm        { padding: 5px 12px; font-size: 0.8rem; }

/* --- Badges de status --- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-pago     { background: #e8f5e9; color: #2e7d32; }
.badge-pendente { background: #fff3e0; color: #e65100; }

/* --- Alertas e mensagens --- */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 18px;
    border-left: 4px solid transparent;
}

.alert-error   { background: #ffebee; color: #c62828; border-left-color: #c62828; }
.alert-success { background: #e8f5e9; color: #2e7d32; border-left-color: #2e7d32; }
.alert-info    { background: #e3f2fd; color: #1565c0; border-left-color: #1565c0; }

/* --- Filtro de mês --- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #444;
}

.filter-bar select {
    padding: 7px 12px;
    font-size: 0.9rem;
    font-family: inherit;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
    cursor: pointer;
}

/* --- Página de login/cadastro --- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.auth-box h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-box .auth-sub {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.875rem;
    color: #666;
}

/* --- Totais e destaques numéricos --- */
.total-row td {
    font-weight: 700;
    border-top: 2px solid #e0e0e0;
    background: #f5f5f5 !important;
}

.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: #888; font-size: 0.85rem; }
.text-strong { font-weight: 700; }

/* --- Ações na tabela --- */
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- Mês atual destacado no select --- */
option.current-month { font-weight: 700; }

/* --- Divisor simples --- */
hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 24px 0;
}

/* --- Utilitários de espaçamento --- */
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }

/* ============================================================
   Responsivo — Mobile
   ============================================================ */
@media (max-width: 600px) {
    .navbar .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .navbar-nav { gap: 12px; }

    .card-highlight .card-value { font-size: 1.7rem; }

    .auth-box { padding: 24px 18px; }

    thead { display: none; }

    tbody tr {
        display: block;
        border: 1px solid #e0e0e0;
        border-radius: 6px;
        margin-bottom: 10px;
        padding: 8px 4px;
    }

    tbody td {
        display: flex;
        justify-content: space-between;
        padding: 6px 12px;
        border-bottom: 1px solid #f0f0f0;
        font-size: 0.85rem;
    }

    tbody td:last-child { border-bottom: none; }

    tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex-shrink: 0;
        margin-right: 8px;
    }

    tbody tr:nth-child(even) { background: #fff; }

    .filter-bar { flex-direction: column; align-items: flex-start; }

    .cards-grid { grid-template-columns: 1fr; }
}
