/* ==========================================================================
   Contas da Casa - Design System 2026
   Display: Space Grotesk / Corpo: Inter
   ========================================================================== */

:root {
    --brand: #0f766e;
    --brand-escuro: #115e59;
    --brand-claro: #14b8a6;
    --acento: #f59e0b;
    --fundo: #f2f6f5;
    --superficie: #ffffff;
    --borda: #e3ebe9;
    --texto: #10201d;
    --texto-suave: #5f7370;
    --sombra: 0 1px 2px rgba(16, 32, 29, .05), 0 4px 16px rgba(16, 32, 29, .06);
    --raio: 16px;
}

[data-bs-theme="dark"] {
    --fundo: #0b1413;
    --superficie: #12201e;
    --borda: #1f312e;
    --texto: #e6efed;
    --texto-suave: #8ba39f;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --bs-body-bg: #0b1413;
    --bs-body-color: #e6efed;
    --bs-border-color: #1f312e;
    --bs-secondary-color: #8ba39f;
}

* { -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--fundo);
    color: var(--texto);
    min-height: 100vh;
}

h1, h2, h3, .stat-value, .hero-value, .card-cc-valor, .month-label {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

/* ---------- Estrutura ---------- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 256px;
    background: var(--superficie);
    border-right: 1px solid var(--borda);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1045;
    transition: transform .25s ease;
}

.main-area {
    flex: 1;
    margin-left: 256px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.content {
    padding: 1.5rem;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding-bottom: 5rem;
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.aberta { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .main-area { margin-left: 0; }
    .content { padding: 1rem; }
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1040;
}
.sidebar-backdrop.aberta { display: block; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--borda);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand), var(--brand-claro));
    color: #fff;
    font-size: 1.05rem;
    flex-shrink: 0;
}
.brand-mark-lg { width: 54px; height: 54px; border-radius: 16px; font-size: 1.5rem; }

.brand-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.15rem;
    letter-spacing: -.02em;
}
.brand-text strong { color: var(--brand); font-weight: 700; }

.btn-close-sidebar {
    margin-left: auto;
    background: none;
    border: 0;
    color: var(--texto-suave);
    font-size: 1.2rem;
}

.sidebar-nav { padding: 1rem .75rem; overflow-y: auto; flex: 1; }

.nav-section {
    display: block;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--texto-suave);
    padding: 1rem .75rem .35rem;
}
.nav-section:first-child { padding-top: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .75rem;
    border-radius: 10px;
    color: var(--texto);
    text-decoration: none;
    font-size: .92rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s;
}
.nav-item i { width: 20px; text-align: center; color: var(--texto-suave); }
.nav-item:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); color: var(--texto); }
.nav-item.active { background: color-mix(in srgb, var(--brand) 13%, transparent); color: var(--brand); font-weight: 600; }
.nav-item.active i { color: var(--brand); }

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1.5rem;
    background: color-mix(in srgb, var(--superficie) 85%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--borda);
    position: sticky;
    top: 0;
    z-index: 1020;
}
@media (max-width: 991.98px) { .topbar { padding: .6rem 1rem; } }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--borda);
    background: var(--superficie);
    color: var(--texto);
    text-decoration: none;
    transition: background .15s;
    font-size: .95rem;
}
.btn-icon:hover { background: color-mix(in srgb, var(--brand) 8%, var(--superficie)); color: var(--brand); }

.badge-alert {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #e11d48;
    color: #fff;
    font-size: .66rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .3rem .7rem .3rem .3rem;
    border-radius: 999px;
    border: 1px solid var(--borda);
    background: var(--superficie);
    color: var(--texto);
    font-size: .88rem;
    font-weight: 500;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-claro));
    color: #fff;
    font-weight: 700;
    font-size: .82rem;
    flex-shrink: 0;
}
.user-avatar-sm { width: 22px; height: 22px; font-size: .7rem; }

/* ---------- Títulos ---------- */
.page-title { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-subtitle { color: var(--texto-suave); font-size: .9rem; }

/* ---------- Hero: quanto posso gastar hoje ---------- */
.hero-card {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
    padding: 1.75rem 2rem;
    border-radius: 22px;
    background:
        radial-gradient(1200px 300px at 110% -40%, rgba(255,255,255,.16), transparent 60%),
        linear-gradient(120deg, #0d5f58, var(--brand) 45%, #0d9488);
    color: #fff;
    box-shadow: 0 12px 32px rgba(15, 118, 110, .28);
}
.hero-label { display: block; font-size: .85rem; font-weight: 600; opacity: .85; text-transform: uppercase; letter-spacing: .06em; }
.hero-value {
    display: block;
    font-size: clamp(2.3rem, 6vw, 3.4rem);
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.1;
    margin: .15rem 0;
}
.hero-hint { display: block; font-size: .84rem; opacity: .8; max-width: 460px; }
.hero-side { display: flex; gap: 1rem; }
.hero-stat {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 14px;
    padding: .8rem 1.1rem;
    min-width: 140px;
    backdrop-filter: blur(4px);
}
.hero-stat-label { display: block; font-size: .74rem; opacity: .85; }
.hero-stat-value { display: block; font-family: 'Space Grotesk', sans-serif; font-size: 1.15rem; font-weight: 700; }
.text-danger-emphasis { color: #fecdd3 !important; }

@media (max-width: 575.98px) {
    .hero-card { padding: 1.4rem 1.25rem; }
    .hero-side { width: 100%; }
    .hero-stat { flex: 1; min-width: 0; }
}

/* ---------- Cards e painéis ---------- */
.stat-card {
    display: flex;
    align-items: center;
    gap: .85rem;
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    padding: 1rem 1.1rem;
    box-shadow: var(--sombra);
    height: 100%;
}
.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    font-size: 1.05rem;
    flex-shrink: 0;
}
.stat-label { display: block; font-size: .76rem; color: var(--texto-suave); font-weight: 500; }
.stat-value { display: block; font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; }

.panel {
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    padding: 1.25rem;
    box-shadow: var(--sombra);
}
.panel-hover { transition: transform .15s, box-shadow .15s; }
.panel-hover:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,32,29,.12); }
.panel-alert { border-left: 4px solid var(--acento); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.panel-title { font-size: 1rem; font-weight: 600; margin: 0; }

/* ---------- Listas ---------- */
.list-flush .list-row { border-bottom: 1px solid var(--borda); }
.list-flush .list-row:last-child { border-bottom: 0; }
.list-row { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; }
.row-title { display: block; font-weight: 500; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { display: block; font-size: .78rem; color: var(--texto-suave); }
.min-w-0 { min-width: 0; }

.cat-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    color: #fff;
    font-size: .85rem;
    flex-shrink: 0;
}
.cat-dot-lg { width: 46px; height: 46px; border-radius: 14px; font-size: 1.1rem; }
.cat-dot-sm { width: 24px; height: 24px; border-radius: 7px; font-size: .65rem; }

.empty-state {
    text-align: center;
    color: var(--texto-suave);
    padding: 1rem;
    margin: 0;
}
.empty-state i { display: block; font-size: 1.6rem; margin-bottom: .5rem; opacity: .6; }

/* ---------- Tabelas ---------- */
.table-app { --bs-table-bg: transparent; }
.table-app thead th {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--texto-suave);
    border-bottom: 1px solid var(--borda);
    padding: .8rem 1rem;
    white-space: nowrap;
}
.table-app tbody td, .table-app tfoot td { padding: .7rem 1rem; border-color: var(--borda); }
.row-muted { opacity: .55; }

.badge-cat {
    display: inline-flex;
    align-items: center;
    font-size: .76rem;
    font-weight: 500;
    padding: .25rem .6rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--cat-cor, var(--brand)) 14%, transparent);
    color: var(--cat-cor, var(--brand));
    white-space: nowrap;
}

.badge-status {
    display: inline-block;
    font-size: .74rem;
    font-weight: 600;
    padding: .28rem .7rem;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
}
.badge-status.pago { background: rgba(34, 197, 94, .15); color: #16a34a; }
.badge-status.pendente { background: rgba(245, 158, 11, .16); color: #d97706; }

/* ---------- Botões ---------- */
.btn-brand {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-escuro);
    --bs-btn-hover-border-color: var(--brand-escuro);
    --bs-btn-active-bg: var(--brand-escuro);
    --bs-btn-active-border-color: var(--brand-escuro);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    font-weight: 600;
    border-radius: 10px;
}
.btn-ghost {
    border: 1px solid var(--borda);
    background: transparent;
    color: var(--texto);
    border-radius: 9px;
    font-weight: 500;
}
.btn-ghost:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); border-color: var(--borda); color: var(--brand); }
.link-brand { color: var(--brand); text-decoration: none; font-weight: 500; }
.link-brand:hover { text-decoration: underline; color: var(--brand-escuro); }

.tipo-switch { display: flex; gap: .5rem; }
.btn-tipo { flex: 1; border-radius: 12px; border: 1px solid var(--borda); font-weight: 600; padding: .6rem; color: var(--texto-suave); }
.btn-check:checked + .btn-tipo-despesa { background: rgba(244,63,94,.12); border-color: #f43f5e; color: #e11d48; }
.btn-check:checked + .btn-tipo-receita { background: rgba(34,197,94,.12); border-color: #22c55e; color: #16a34a; }

/* ---------- Navegação de mês ---------- */
.month-nav {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: 12px;
    padding: .2rem;
}
.month-nav .btn-icon { width: 32px; height: 32px; border: 0; }
.month-label {
    font-weight: 600;
    font-size: .9rem;
    min-width: 110px;
    text-align: center;
    text-transform: capitalize;
}

/* ---------- Orçamento / progresso ---------- */
.budget-row { padding: .7rem 0; border-bottom: 1px solid var(--borda); }
.budget-row:last-of-type { border-bottom: 0; }
.progress { height: 8px; border-radius: 6px; background: color-mix(in srgb, var(--texto) 8%, transparent); }
.progress-bar { border-radius: 6px; transition: width .5s ease; }

/* ---------- Cartão de crédito ---------- */
.card-cc {
    border-radius: 20px;
    padding: 1.4rem;
    color: #fff;
    background:
        radial-gradient(400px 160px at 100% 0%, rgba(255,255,255,.14), transparent 60%),
        linear-gradient(135deg, #1e293b, #0f172a);
    box-shadow: var(--sombra);
    height: 100%;
    display: flex;
    flex-direction: column;
}
.card-cc-nome { display: block; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.1rem; }
.card-cc-sub { display: block; font-size: .78rem; opacity: .7; }
.card-cc-valor { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.progress-cc { background: rgba(255,255,255,.15); }

/* ---------- Gráficos ---------- */
.chart-wrap { position: relative; height: 230px; }
.chart-wrap-lg { height: 320px; }

/* ---------- FAB mobile ---------- */
.fab {
    position: fixed;
    right: 1.1rem;
    bottom: calc(1.1rem + env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--brand), var(--brand-claro));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 8px 24px rgba(15,118,110,.4);
    z-index: 1030;
    text-decoration: none;
}
.fab:hover, .fab:focus { color: #fff; }

/* ---------- Login / auth ---------- */
.auth-body { background: var(--fundo); }
.auth-split { display: flex; min-height: 100vh; }
.auth-hero {
    flex: 1.1;
    padding: 3.5rem;
    align-items: center;
    color: #fff;
    background:
        radial-gradient(800px 400px at -10% 110%, rgba(255,255,255,.1), transparent 60%),
        linear-gradient(150deg, #0d5f58, var(--brand) 50%, #0d9488);
}
.auth-hero-title { font-family: 'Space Grotesk', sans-serif; font-size: 2.4rem; font-weight: 500; margin-top: 1.25rem; }
.auth-hero-title strong { font-weight: 700; }
.auth-hero-sub { font-size: 1.05rem; opacity: .88; max-width: 440px; margin-top: .5rem; }
.auth-hero-points { margin-top: 2rem; display: grid; gap: .7rem; font-size: .95rem; }
.auth-hero-points i { color: #99f6e4; margin-right: .5rem; }
.auth-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card {
    width: 100%;
    max-width: 430px;
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: 22px;
    padding: 2.25rem;
    box-shadow: var(--sombra);
}
.auth-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
@media (max-width: 575.98px) { .auth-card { padding: 1.6rem 1.25rem; } }

/* ---------- Formulários ---------- */
.form-control, .form-select, .input-group-text {
    border-radius: 10px;
    border-color: var(--borda);
    background-color: var(--superficie);
    color: var(--texto);
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .15);
    background-color: var(--superficie);
    color: var(--texto);
}
.input-group .form-control { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group-text { color: var(--texto-suave); }

.modal-content { background: var(--superficie); border-radius: 18px; border: 1px solid var(--borda); }
.dropdown-menu { background: var(--superficie); border: 1px solid var(--borda); border-radius: 12px; box-shadow: var(--sombra); }
.dropdown-item { color: var(--texto); }
.dropdown-item:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }

/* ---------- Impressão ---------- */
@media print {
    .sidebar, .topbar, .fab, .no-print, .month-nav, form select, button { display: none !important; }
    .main-area { margin-left: 0; }
    .panel, .stat-card { box-shadow: none; break-inside: avoid; }
    body { background: #fff; }
}

/* ---------- Acessibilidade ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ===== Assistente de primeiros passos ===== */
.onboarding-passo {
    padding: .85rem 1rem;
    border: 1px solid var(--borda, #e3ebe9);
    border-radius: 12px;
    color: inherit;
    transition: background .15s, border-color .15s, transform .1s;
}
.onboarding-passo:hover {
    background: rgba(15, 118, 110, .05);
    border-color: var(--brand, #0f766e);
    transform: translateX(2px);
}
.onboarding-passo .passo-check {
    flex: 0 0 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.1rem;
}
.onboarding-passo .passo-num {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(15, 118, 110, .12);
    color: var(--brand, #0f766e);
    font-weight: 700;
    font-size: .95rem;
}
.onboarding-passo .passo-check .fa-circle-check { color: #16a34a; }
.onboarding-passo.concluido { opacity: .6; }
.onboarding-passo.concluido strong { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }

/* Linha de importação que parece já existir no app */
.linha-duplicata { background: rgba(252, 211, 77, .1); }
.linha-duplicata td { opacity: .85; }
