/* ============================================
   Meu Financeiro — Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
    /* Cor */
    --bg: #12151b;
    --bg-elevated: #1b1f27;
    --bg-elevated-2: #242933;
    --border: #2e3440;
    --text: #ededec;
    --text-muted: #8b8d98;
    --gold: #d4a15c;
    --gold-ink: #12151b;
    --terracotta: #c15b4a;
    --terracotta-dim: #3a2622;
    --gold-dim: #3a301f;

    /* Tipografia */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    /* Espaçamento */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-tap-highlight-color: transparent;
}

body {
    padding-bottom: calc(180px + env(safe-area-inset-bottom));
}

h1, h2, h3, .display {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

/* Assinatura visual: todo valor monetário usa mono com tabular-nums */
.money {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: -0.02em;
}

a { color: inherit; }

/* --- Header padrão --- */
.app-header {
    padding: var(--space-6) var(--space-5) var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
}
.app-header .titulo-pagina {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}
.app-header .voltar {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-family: var(--font-body);
    padding-top: 2px;
}

/* --- Cards --- */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: var(--space-4);
}

.item-linha {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: var(--space-4);
    margin-bottom: var(--space-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    transition: transform 0.12s ease, border-color 0.12s ease;
}
.item-linha:active {
    transform: scale(0.98);
    border-color: var(--gold);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.badge {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    display: inline-block;
}
.badge.pendente { background: var(--bg-elevated-2); color: var(--text-muted); }
.badge.atrasado { background: var(--terracotta-dim); color: #f3b8ac; }
.badge.pago { background: var(--gold-dim); color: var(--gold); }

.vazio {
    color: var(--text-muted);
    font-size: 13px;
    padding: var(--space-5) 0;
    text-align: center;
}

/* --- Botões --- */
.btn {
    font-family: var(--font-body);
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s ease, opacity 0.1s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:active { transform: scale(0.96); }
.btn-primario { background: var(--gold); color: var(--gold-ink); }
.btn-perigo { background: var(--terracotta); color: #2a0f0a; }
.btn-secundario { background: var(--bg-elevated-2); color: var(--text); }
.btn-bloco { width: 100%; }
.btn-texto {
    background: none; border: none; color: var(--text-muted);
    font-size: 12px; text-decoration: underline; cursor: pointer; font-family: var(--font-body);
}
.btn-texto.perigo { color: var(--terracotta); }

/* --- FAB (ações principais fixas embaixo) --- */
.fab-area {
    position: fixed;
    left: var(--space-5);
    right: var(--space-5);
    bottom: calc(84px + env(safe-area-inset-bottom));
    display: flex;
    gap: var(--space-3);
    z-index: 40;
}
.fab-area .btn { flex: 1; padding: 16px; font-size: 15px; }

/* --- Modal (slide-up) --- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(10, 12, 16, 0.7);
    display: flex;
    align-items: flex-end;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-overlay.aberto { opacity: 1; pointer-events: auto; }

.modal {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: var(--space-6) var(--space-5) calc(var(--space-8) + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.aberto .modal { transform: translateY(0); }

.modal label {
    font-size: 12px; color: var(--text-muted); display: block;
    margin: var(--space-3) 0 6px; font-weight: 500;
}
.modal input, .modal select {
    width: 100%; background: var(--bg-elevated-2); border: 1px solid var(--border);
    border-radius: 10px; padding: 12px; color: var(--text); font-size: 16px;
    font-family: var(--font-body);
}
.modal input[type="color"] { padding: 4px; height: 44px; }
.modal .acoes { display: flex; gap: var(--space-3); margin-top: var(--space-5); }
.modal .acoes .btn { flex: 1; }

/* --- Barra de navegação inferior --- */
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 50;
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 0 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: relative;
}
.bottom-nav a .icone { font-size: 19px; line-height: 1; }
.bottom-nav a.ativo { color: var(--gold); }
.bottom-nav a.ativo::before {
    content: '';
    position: absolute;
    top: 0; left: 30%; right: 30%;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
}

/* --- Utilitário --- */
.text-positivo { color: var(--gold); }
.text-negativo { color: var(--terracotta); }

/* --- Leitura de boletos e contas --- */
.modal {
    max-height: 92vh;
    overflow-y: auto;
}

.modal textarea {
    width: 100%;
    resize: vertical;
    min-height: 82px;
    background: var(--bg-elevated-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.45;
    font-family: var(--font-body);
}

.modal-titulo {
    margin: 0;
    font-size: 20px;
}

.modal-subtitulo {
    margin: 6px 0 var(--space-4);
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.boleto-opcoes {
    display: flex;
    gap: var(--space-3);
}

.boleto-opcoes .btn {
    flex: 1;
}

.boleto-upload input {
    display: none;
}

.boleto-status {
    min-height: 20px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.boleto-status.erro {
    color: var(--terracotta);
}

.boleto-status.carregando {
    color: var(--gold);
}

.documento-info {
    margin-top: var(--space-3);
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--gold-dim);
    color: var(--gold);
    font-size: 12px;
}

@media (max-width: 390px) {
    .boleto-opcoes {
        flex-direction: column;
    }
}

.fab-area.tres-acoes .btn {
    padding-left: 8px;
    padding-right: 8px;
    font-size: 13px;
}
