/* ===== DASHBOARD CSS ===== */

body {
    font-family: 'Inter', 'Roboto', sans-serif;
    max-width: 100%;
    overflow-x: hidden;
}

html {
    max-width: 100%;
    overflow-x: hidden;
}

/* Header */
/* ===== FILTROS DE PERÍODO ===== */
.period-selector {
    max-width: 1200px;
    margin: 20px auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    background: white;
    border-radius: 12px;
    border: 1px solid #F1F5F9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    font-family: 'Inter', 'Roboto', sans-serif;
}

/* Versão embutida no card de Histórico Financeiro: sem a margem de
   página inteira, com um fundo levemente destacado do card branco. */
.period-selector-hist {
    max-width: none;
    margin: 0 0 18px;
    background: #FBFCFD;
}

.period-tabs,
.period-tabs-h {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
}

.period-tab,
.period-tab-h {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-tab:hover,
.period-tab-h:hover {
    color: #152C47;
}

.period-tab.active,
.period-tab-h.active {
    background: white;
    color: #152C47;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.period-controls {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.period-input,
.period-input-h {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
}

.period-input input[type="date"],
.period-input input[type="month"],
.period-input input[type="number"],
.period-input-h input[type="date"],
.period-input-h input[type="month"],
.period-input-h input[type="number"] {
    padding: 6px 12px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Inter', 'Roboto', sans-serif;
    color: #1E293B;
    background: #F8FAFC;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.period-input input[type="date"]:focus,
.period-input input[type="month"]:focus,
.period-input input[type="number"]:focus,
.period-input-h input[type="date"]:focus,
.period-input-h input[type="month"]:focus,
.period-input-h input[type="number"]:focus {
    border-color: #152C47;
    background: white;
    box-shadow: 0 0 0 3px rgba(26, 95, 30, 0.1);
}

.period-input input[type="date"],
.period-input-h input[type="date"] {
    width: 140px;
}

.period-input input[type="month"],
.period-input-h input[type="month"] {
    width: 150px;
}

.period-input input[type="date"]::-webkit-calendar-picker-indicator,
.period-input input[type="month"]::-webkit-calendar-picker-indicator,
.period-input-h input[type="date"]::-webkit-calendar-picker-indicator,
.period-input-h input[type="month"]::-webkit-calendar-picker-indicator {
    opacity: 0.45;
    filter: invert(38%) sepia(9%) saturate(500%) hue-rotate(178deg);
    transition: opacity 0.2s;
}

.period-input input[type="date"]:hover::-webkit-calendar-picker-indicator,
.period-input input[type="month"]:hover::-webkit-calendar-picker-indicator,
.period-input-h input[type="date"]:hover::-webkit-calendar-picker-indicator,
.period-input-h input[type="month"]:hover::-webkit-calendar-picker-indicator {
    opacity: 0.75;
}

/* Selo de status do período: neutro por padrão, e um discreto ponto
   verde (não emoji) quando há um período confirmado — mesma linguagem
   visual dos indicadores de atividade do gráfico. A classe .periodo-status
   é um alias reutilizado pelo filtro dedicado do histórico financeiro. */
#periodoStatus,
.periodo-status {
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #64748B;
}

#periodoStatus:hover,
.periodo-status:hover {
    background: #F1F5F9;
}

#periodoStatus.periodo-status-ativo,
.periodo-status.periodo-status-ativo {
    background: #F0FDF4;
    border-color: #BBF7D0;
    color: #152C47;
    font-weight: 600;
}

#periodoStatus.periodo-status-ativo::before,
.periodo-status.periodo-status-ativo::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #152C47;
    flex-shrink: 0;
}

.btn-clear-periodo {
    border: none;
    background: transparent;
    color: #94A3B8;
    font-size: 12px;
    font-family: 'Inter', 'Roboto', sans-serif;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s;
}

.btn-clear-periodo:hover {
    color: #C0392B;
}

/* ===== DROPDOWN PERÍODO ===== */
.period-dropdown,
.period-dropdown-h {
    position: relative;
    display: inline-block;
}

.period-dropdown-btn,
.period-dropdown-btn-h {
    padding: 6px 14px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.period-dropdown-btn:hover,
.period-dropdown-btn-h:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.period-dropdown-btn.active,
.period-dropdown-btn-h.active {
    background: #152C47;
    border-color: #152C47;
    color: white;
}

.period-dropdown-menu,
.period-dropdown-menu-h {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 170px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    display: none;
    overflow: hidden;
    z-index: 1000;
    padding: 6px 0;
}

.period-dropdown-menu.show,
.period-dropdown-menu-h.show {
    display: block;
}

.period-dropdown-item {
    padding: 8px 16px;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.15s ease;
}

.period-dropdown-item:hover {
    background: #f1f5f9;
}


/* Cards */
.cards-grid {
    max-width: 1200px;
    margin: 20px auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.card {
    background: white;
    border: 1px solid #F1F5F9;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    border-color: #E2E8F0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: 'Inter', 'Roboto', sans-serif;
}

.card-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.card-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.card-value {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: #0F172A;
}

.card-unit {
    font-size: 14px;
    font-weight: 500;
    color: #94A3B8;
    letter-spacing: normal;
}

.card-green .card-dot { background: #1F8A4C; }
.card-green .card-value { color: #1F8A4C; }

.card-red .card-dot { background: #C0392B; }
.card-red .card-value { color: #C0392B; }

.card-blue .card-dot { background: #1565C0; }
.card-blue .card-value { color: #0F172A; }

.card-purple .card-dot { background: #64748B; }
.card-purple .card-value { color: #0F172A; }

/* Chart */
.chart-container {
    max-width: 1200px;
    margin: 20px auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid #F1F5F9;
    transition: all 0.2s ease;
    min-height: 320px;
    padding: 24px;
    box-sizing: border-box;
    font-family: 'Inter', 'Roboto', sans-serif;
}

.chart-container:hover {
    border-color: #E2E8F0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.chart-container h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1E293B;
    letter-spacing: -0.01em;
}

.chart-container canvas {
    max-height: 280px;
    width: 100% !important;
}

.chart-empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 28px 0 20px;
    gap: 4px;
}

.chart-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #F8FAFC;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    margin-bottom: 10px;
}

.chart-empty-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #334155;
    margin: 0;
}

.chart-empty-sub {
    font-size: 13px;
    color: #94A3B8;
    max-width: 380px;
    line-height: 1.55;
    margin: 4px 0 16px;
}

.chart-empty-cta {
    display: inline-block;
    padding: 10px 20px;
    background: #152C47;
    color: white;
    font-size: 13px;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.chart-empty-cta:hover {
    opacity: 0.9;
}

/* ===== CABEÇALHO DO GRÁFICO: título + estatísticas de atividade ===== */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #F1F5F9;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: #1E293B;
    margin: 0;
    letter-spacing: -0.01em;
}

.chart-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #475569;
}

.chart-stat-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #F8FAFC;
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
    white-space: nowrap;
}

.chart-stat-chip.chart-stat-percentual {
    font-weight: 600;
}

.chart-donut-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #F8FAFC;
    padding: 4px 12px 4px 8px;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
}

.chart-donut-ring {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background .4s ease;
}

.chart-donut-label {
    position: absolute;
    inset: 5px;
    background: #F8FAFC;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #152C47;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.chart-activity-legend {
    display: flex;
    flex-direction: column;
    gap: 3px;
    line-height: 1.2;
}

.chart-activity-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #334155;
    white-space: nowrap;
}

.chart-activity-row.chart-activity-row-off {
    color: #94A3B8;
}

.chart-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    background: #152C47;
}

.chart-activity-dot.chart-activity-dot-off {
    background: #CBD5E1;
}

.chart-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    user-select: none;
    padding: 6px 14px;
    border-radius: 20px;
    background: #F1F5F9;
    border: 1.5px solid #E2E8F0;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.chart-toggle:hover {
    border-color: #94A3B8;
}

.chart-toggle.ativo {
    background: #E8F5E9;
    border-color: #152C47;
    color: #152C47;
}

.chart-toggle.ativo:hover {
    border-color: #152C47;
}

.chart-toggle-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.chart-toggle-track {
    position: relative;
    width: 34px;
    height: 19px;
    border-radius: 20px;
    background: #CBD5E1;
    transition: background .2s ease;
    flex-shrink: 0;
}

.chart-toggle.ativo .chart-toggle-track {
    background: #152C47;
}

.chart-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
    transition: left .2s ease;
}

.chart-toggle.ativo .chart-toggle-thumb {
    left: 17px;
}

.btn-goal {
    padding: 8px 20px;
    background: #152C47;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-goal:hover {
    background: #24476E;
}

/* ===== SALDOS: BANCOS E CASAS ===== */
.balances-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 28px 28px 24px;
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 12px 32px -16px rgba(15,23,42,0.08);
    font-family: 'Inter', 'Roboto', sans-serif;
}

.balances-top {
    margin-bottom: 20px;
}

.balances-total-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.balances-total-value {
    display: block;
    font-size: 34px;
    font-weight: 800;
    color: #0F172A;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

.capital-bar {
    display: flex;
    width: 100%;
    max-width: 340px;
    height: 7px;
    border-radius: 20px;
    overflow: hidden;
    background: #F1F5F9;
    margin-top: 12px;
}

.capital-bar-segment {
    height: 100%;
    transition: width 0.4s ease;
    cursor: default;
}

.capital-bar-segment:first-child { border-radius: 20px 0 0 20px; }
.capital-bar-segment:last-child { border-radius: 0 20px 20px 0; }
.capital-bar-segment:only-child { border-radius: 20px; }

.capital-bar-legend {
    display: flex;
    flex-wrap: wrap;
    row-gap: 5px;
    column-gap: 14px;
    margin-top: 9px;
}

.capital-bar-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #94A3B8;
    cursor: default;
    white-space: nowrap;
}

.capital-bar-legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.capital-bar-legend-pct {
    color: #64748B;
    font-weight: 700;
}


/* ===== AÇÕES RÁPIDAS =====
   Ícone em círculo + rótulo curto, todos do mesmo tamanho — mesmo
   padrão de "ações rápidas" de qualquer app bancário (Nubank, C6,
   Itaú): a clareza vem do ícone reconhecível e da palavra única, não
   de um parágrafo explicando. Isso também elimina de vez qualquer
   desalinhamento entre os botões, já que não existe mais texto de
   tamanho variável ditando a altura de cada um. */
.balances-actions {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.btn-acao-isolada {
    margin-left: 28px;
}

.btn-acao-rapida {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    width: 68px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: 'Inter', 'Roboto', sans-serif;
}

.btn-acao-icone {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #F1F5F9;
    color: #152C47;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn-acao-rapida:hover .btn-acao-icone {
    background: #E2E8F0;
}

.btn-acao-rapida:active .btn-acao-icone {
    transform: scale(0.94);
}

.btn-acao-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
    text-align: center;
    line-height: 1.2;
}

.btn-acao-primaria .btn-acao-icone {
    background: #152C47;
    color: white;
}

.btn-acao-primaria:hover .btn-acao-icone {
    background: #0B1B2E;
}

.btn-acao-primaria .btn-acao-label {
    color: #152C47;
    font-weight: 700;
}


/* ===== GRID: SALDOS + META ===== */
.finance-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: 32px;
}

.finance-col-saldos,
.finance-col-meta {
    min-width: 0;
}

.finance-col-meta {
    padding-left: 32px;
    border-left: 1px solid #F1F5F9;
}

/* ===== WIDGET DE META =====
   Ênfase invertida: a META é o destaque principal,
   e o patrimônio atual aparece como dado secundário.
*/
.meta-widget {
    display: flex;
    flex-direction: column;
    gap: 18px;
    font-family: 'Inter', 'Roboto', sans-serif;
}

/* DESTAQUE PRINCIPAL: META */
.meta-target-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-target-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.meta-target-value {
    font-size: 28px;
    font-weight: 800;
    color: #0F172A;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.meta-target-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.meta-edit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    background: transparent;
    color: #94A3B8;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.meta-edit-toggle:hover {
    color: #152C47;
    background: #F0FDF4;
}

/* DADO SECUNDÁRIO: PATRIMÔNIO ATUAL */
.meta-current-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 12px;
    border-bottom: 1px solid #F1F5F9;
}

.meta-current-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.meta-current-value {
    font-size: 16px;
    font-weight: 500;
    color: #64748B;
    font-variant-numeric: tabular-nums;
}

.meta-progress-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-progress-bar {
    position: relative;
    width: 100%;
    height: 8px;
    background: #F1F5F9;
    border-radius: 6px;
    overflow: hidden;
}

.meta-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #1F8A4C);
    border-radius: 6px;
    transition: width 0.8s ease;
}

.meta-progress-tick {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(255,255,255,0.7);
    transform: translateX(-1px);
    pointer-events: none;
    z-index: 1;
}

.meta-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    color: #64748B;
    font-variant-numeric: tabular-nums;
}

.meta-progress-row strong {
    color: #0F172A;
    font-weight: 700;
}

.meta-progress-row #goalProgress {
    font-size: 14px;
    font-weight: 700;
    color: #1F8A4C;
}

.meta-remaining {
    font-size: 13px;
    color: #64748B;
}

.meta-remaining strong {
    color: #0F172A;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.meta-widget-edit {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.meta-widget-edit input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 13px;
    color: #0F172A;
}

.meta-widget-edit input:focus {
    outline: none;
    border-color: #152C47;
}

.meta-widget-edit .btn-goal {
    padding: 9px 16px;
    border-radius: 10px;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.meta-empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 0 4px;
    gap: 4px;
}

.meta-empty-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #F1F5F9;
    color: #94A3B8;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.meta-empty-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #334155;
    margin: 0;
}

.meta-empty-sub {
    font-size: 12.5px;
    color: #94A3B8;
    line-height: 1.5;
    margin: 4px 0 12px;
}

.meta-empty-cta {
    border: none;
    background: #152C47;
    color: white;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    padding: 9px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.meta-empty-cta:hover {
    opacity: 0.9;
}

.meta-projecao {
    margin-top: 4px;
    padding: 16px;
    background: #F8FAFC;
    border: 1px solid #F1F5F9;
    border-radius: 14px;
}

.meta-projecao-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94A3B8;
    margin-bottom: 8px;
}

.meta-projecao p {
    font-size: 13.5px;
    line-height: 1.55;
    color: #475569;
}

.meta-projecao strong {
    color: #0F172A;
    font-weight: 700;
}

.meta-projecao .meta-projecao-destaque {
    color: #1F8A4C;
    font-weight: 700;
}

.meta-projecao.meta-projecao-atingida {
    background: #F0FDF4;
    border-color: #BBF7D0;
}

.meta-projecao.meta-projecao-atingida p {
    color: #1F8A4C;
    font-weight: 600;
}

/* ===== ABAS SEGMENTADAS ===== */
.balances-tabs {
    display: inline-flex;
    background: #F1F5F9;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 20px;
}

.balances-tab {
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #64748B;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 7px;
}

.balances-tab:hover {
    color: #1E293B;
}

.balances-tab.active {
    background: white;
    color: #0F172A;
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}

.balances-tab-count {
    font-size: 11px;
    font-weight: 700;
    color: #94A3B8;
    background: #E2E8F0;
    border-radius: 20px;
    padding: 1px 7px;
    min-width: 18px;
    text-align: center;
}

.balances-tab.active .balances-tab-count {
    background: #DCFCE7;
    color: #166534;
}

.balances-grupo {
    animation: fadeInGrupo 0.2s ease;
}

@keyframes fadeInGrupo {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== LISTA DE CONTAS ===== */
.acct-list {
    display: flex;
    flex-direction: column;
}

.acct-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 10px 14px 14px;
    border-bottom: 1px solid #F1F5F9;
    border-left: 3px solid transparent;
    font-family: 'Inter', 'Roboto', sans-serif;
    transition: border-color 0.15s ease, background 0.15s ease, padding-left 0.15s ease;
}

.acct-list .acct-row:last-child {
    border-bottom: none;
}

.acct-row:hover {
    background: #FAFBFC;
    border-left-color: #152C47;
    padding-left: 18px;
}

.acct-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.acct-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 2px rgba(15,23,42,0.06), 0 0 0 1px #F1F5F9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.acct-logo img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.acct-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.acct-name {
    font-size: 14px;
    font-weight: 600;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acct-share {
    font-size: 12px;
    color: #94A3B8;
    font-variant-numeric: tabular-nums;
}

.acct-value {
    font-size: 15px;
    font-weight: 700;
    color: #0F172A;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.acct-value.negativo { color: #C0392B; }

.acct-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.acct-delete {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #CBD5E1;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.acct-row:hover .acct-delete {
    opacity: 1;
}

.acct-delete:hover {
    background: #FEE2E2;
    color: #C0392B;
}

#transacaoRecorrenteWrap {
    display: flex;
    align-items: center;
}

.history-item-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.history-item-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.history-item:hover .history-item-actions {
    opacity: 1;
}

.history-item-action-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #CBD5E1;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.history-item-action-btn:hover {
    background: #F1F5F9;
    color: #152C47;
}

.history-item-action-btn.excluir:hover {
    background: #FEE2E2;
    color: #C0392B;
}

.orcamento-bar-track {
    height: 4px;
    background: #F1F5F9;
    border-radius: 4px;
    margin-top: 5px;
    overflow: hidden;
}

.orcamento-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.orcamento-bar-fill.orcamento-ok { background: #1F8A4C; }
.orcamento-bar-fill.orcamento-alerta { background: #F59E0B; }
.orcamento-bar-fill.orcamento-estourado { background: #C0392B; }

.orcamento-legenda {
    font-size: 11px;
    color: #94A3B8;
    margin-top: 3px;
}

.orcamento-legenda.orcamento-alerta { color: #B45309; }
.orcamento-legenda.orcamento-estourado { color: #C0392B; font-weight: 600; }

.bubble-avatar-fallback {
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 14px;
}

.inst-empty {
    background: #FBFCFD;
    border: 1px dashed #E2E8F0;
    border-radius: 14px;
    padding: 32px 20px;
    text-align: center;
    color: #94A3B8;
    font-size: 13px;
    font-family: 'Inter', 'Roboto', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.inst-empty-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #F1F5F9;
    color: #94A3B8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inst-empty button {
    padding: 8px 18px;
    border-radius: 9px;
    border: none;
    background: #152C47;
    color: white;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.inst-empty button:hover {
    background: #0B1B2E;
}

/* ===== CONTROLE SEGMENTADO (tipo de conta / tipo de transação) ===== */
.segmented-control {
    display: flex;
    background: #F1F5F9;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 8px;
}

.segmented-option {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 6px;
    border-radius: 8px;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    color: #64748B;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.segmented-option:hover {
    color: #1E293B;
}

.segmented-option.active {
    background: white;
    color: #0F172A;
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}

/* ===== FORMULÁRIOS NOS MODAIS ===== */
.tag-opcional {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94A3B8;
    background: #F1F5F9;
    border-radius: 20px;
    vertical-align: middle;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #475569;
    font-weight: 500;
    font-size: 13px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: white;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #152C47;
    box-shadow: 0 0 0 3px rgba(26, 95, 30, 0.1);
}

.btn-modal-cancelar {
    width: 100%;
    margin-top: 8px;
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #64748b;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-modal-cancelar:hover {
    background: #f8fafc;
    color: #1e293b;
}

/* ===== AUTOCOMPLETE ===== */
.autocomplete-wrap {
    position: relative;
}

.autocomplete-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    z-index: 50;
}

.autocomplete-suggestion-item {
    padding: 9px 14px;
    font-size: 14px;
    color: #1e293b;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.autocomplete-suggestion-item:last-child {
    border-bottom: none;
}

.autocomplete-suggestion-item:hover {
    background: #f1f5f9;
}

/* ===== HISTÓRICO FINANCEIRO ===== */
.history-container {
    max-width: 1200px;
    margin: 20px auto 40px;
    padding: 28px 28px 24px;
    background: white;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 12px 32px -16px rgba(15,23,42,0.08);
    font-family: 'Inter', 'Roboto', sans-serif;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 18px;
}

.history-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1E293B;
    margin: 0;
    letter-spacing: -0.01em;
}

.history-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.history-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #E2E8F0;
    background: white;
    color: #475569;
    padding: 7px 13px;
    border-radius: 20px;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.history-link-btn:hover {
    border-color: #152C47;
    color: #152C47;
    background: #F0FDF4;
}

.analise-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.analise-card-header .analise-card-label {
    margin-bottom: 0;
}

.history-view-tabs {
    display: inline-flex;
    background: #F1F5F9;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.history-view-tab {
    border: none;
    background: transparent;
    padding: 7px 14px;
    border-radius: 8px;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    color: #64748B;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.history-view-tab:hover { color: #1E293B; }

.history-view-tab.active {
    background: white;
    color: #0F172A;
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}

.history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.history-filter {
    border: 1px solid #E2E8F0;
    background: white;
    color: #64748B;
    padding: 6px 13px;
    border-radius: 20px;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.history-filter:hover {
    border-color: #CBD5E1;
    background: #F8FAFC;
}

.history-filter.active {
    background: white;
    border-color: #CBD5E1;
    color: #152C47;
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}

.history-list {
    display: flex;
    flex-direction: column;
    max-height: 460px;
    overflow-y: auto;
}

.history-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 20px 32px;
    gap: 4px;
}

.history-empty-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #F1F5F9;
    color: #94A3B8;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.history-empty-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #334155;
    margin: 0;
}

.history-empty-sub {
    font-size: 12.5px;
    color: #94A3B8;
    max-width: 320px;
    line-height: 1.5;
    margin: 4px 0 14px;
}

.history-empty-cta {
    border: none;
    background: #152C47;
    color: white;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    padding: 9px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.history-empty-cta:hover {
    opacity: 0.9;
}

.history-empty-state-compact {
    padding: 20px 8px;
}

.history-empty-state-compact .history-empty-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 4px;
}

.history-load-more {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 4px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    color: #152C47;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.history-load-more:hover {
    background: #F1F5F9;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 6px 12px 10px;
    border-bottom: 1px solid #F1F5F9;
    border-left: 3px solid transparent;
    transition: border-color 0.15s ease, background 0.15s ease, padding-left 0.15s ease;
}

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

.history-item:hover {
    background: #FAFBFC;
    border-left-color: #152C47;
    padding-left: 14px;
}

.history-item-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.history-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.history-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-sub {
    font-size: 12px;
    color: #94A3B8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-value {
    font-size: 14.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.history-item-value.positivo { color: #1F8A4C; }
.history-item-value.negativo { color: #C0392B; }
.history-item-value.neutro { color: #64748B; }

/* ===== ANÁLISE: RECEITAS X DESPESAS ===== */
.analise-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.analise-card-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}

.analise-chart-card canvas {
    max-height: 280px;
    width: 100% !important;
}

.analise-categorias-card .acct-list {
    max-height: 320px;
    overflow-y: auto;
}

/* ============================================================
   RESPONSIVO — MOBILE
   Desktop (acima de 768px) permanece exatamente como está: tudo
   abaixo só entra em telas menores.
   ============================================================ */

@media (max-width: 768px) {
    /* --- Espaçamento geral: menos padding lateral em telas menores --- */
    .cards-grid {
        grid-template-columns: 1fr 1fr;
        padding: 0 16px;
        gap: 12px;
    }

    .chart-container,
    .balances-container,
    .history-container {
        margin-left: 16px;
        margin-right: 16px;
        padding: 18px;
    }

    /* --- Filtro de período (dashboard e histórico) --- */
    .period-selector,
    .period-selector-hist {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-left: 16px;
        margin-right: 16px;
    }
    
    .period-tabs,
    .period-tabs-h {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .period-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .period-dropdown-menu,
    .period-dropdown-menu-h {
        left: 50%;
        transform: translateX(-50%);
        min-width: 200px;
    }

    /* --- Cabeçalho do gráfico: anel + estatísticas + toggle --- */
    .chart-stats {
        gap: 8px;
        width: 100%;
    }

    .chart-toggle {
        width: 100%;
        justify-content: center;
        order: 99;
    }

    /* --- Saldos: coluna única, meta abaixo --- */
    .finance-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .finance-col-meta {
        padding-left: 0;
        padding-top: 24px;
        border-left: none;
        border-top: 1px solid #F1F5F9;
    }
    
    .balances-top {
        flex-direction: column;
        align-items: stretch;
    }
    
    .balances-actions {
        align-self: stretch;
        justify-content: space-between;
        gap: 8px;
    }
    
    .btn-acao-rapida {
        width: auto;
        flex: 1 1 auto;
    }

    .btn-acao-isolada {
        margin-left: 0;
    }

    /* --- Abas com muitos itens (Bancos/Espécie/Investimentos/Casas,
       Transações/Análise): rolagem horizontal em vez de espremer ou
       quebrar linha — padrão comum em apps de banco no mobile. --- */
    .balances-tabs,
    .history-view-tabs {
        display: flex;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .balances-tabs::-webkit-scrollbar,
    .history-view-tabs::-webkit-scrollbar {
        display: none;
    }

    .balances-tab,
    .history-view-tab {
        flex-shrink: 0;
    }

    .history-filters {
        flex-wrap: nowrap;
        min-width: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 -18px 14px;
        padding: 0 18px;
    }

    .history-filters::-webkit-scrollbar {
        display: none;
    }

    .history-filter {
        flex-shrink: 0;
    }
    
    .history-header {
        flex-direction: column;
        align-items: stretch;
    }

    .history-header-actions {
        justify-content: space-between;
    }
    
    .history-view-tabs {
        justify-content: flex-start;
    }

    .analise-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* --- Modais: opções do segmentado um pouco mais compactas --- */
    .segmented-option {
        font-size: 11.5px;
        padding: 8px 4px;
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .card-value {
        font-size: 20px;
    }

    .balances-total-value {
        font-size: 26px;
    }

    .meta-target-value {
        font-size: 22px;
    }

    .capital-bar-legend-item {
        font-size: 11px;
    }

    .chart-stat-chip,
    .chart-donut-wrap {
        padding-left: 8px;
        padding-right: 8px;
    }

    .chart-activity-row {
        font-size: 11px;
    }

    .acct-row {
        padding: 12px 6px 12px 10px;
        gap: 10px;
    }

    .acct-logo {
        width: 34px;
        height: 34px;
    }

    .history-item {
        padding: 10px 4px 10px 8px;
        gap: 10px;
    }

    .history-item-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .segmented-option {
        font-size: 10.5px;
        padding: 7px 3px;
    }
}