/* Mobile-first: o layout base é o do celular; a media query só amplia em telas grandes. */

:root {
    --rosa-forte: #d6006f;
    --rosa: #ff3d81;
    --rosa-claro: #ffb6d1;
    --rosa-borda: #ffd0e4;
    --rosa-fundo: #fff0f6;
    --texto: #7a1f3d;
    --texto-suave: #b45b83;
    --branco: #fff;
    --sombra: 0 8px 20px rgba(255, 64, 129, 0.18);
    --raio: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 16px 12px 48px;
    min-height: 100vh;
    background: linear-gradient(180deg, #ffd6e8 0%, #ffb6d1 100%);
    background-attachment: fixed;
    font-family: 'Baloo 2', 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--texto);
    font-size: 15px;
    line-height: 1.4;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.negativo {
    color: #c0202a;
}

/* --------------------------------------------------------------- topo --- */

.topo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    max-width: 640px;
    margin: 0 auto 14px;
    background: var(--branco);
    border: 2px solid var(--rosa-claro);
    border-radius: var(--raio);
    padding: 12px 14px;
    box-shadow: var(--sombra);
}

.topo__mascote {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    filter: drop-shadow(0 3px 4px rgba(255, 61, 129, 0.35));
}

.topo h1 {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 17px;
    line-height: 1.2;
    color: var(--rosa-forte);
}

.topo__conta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.topo__usuario {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 800;
    color: var(--texto-suave);
}

.btn-sair,
.btn-conta {
    border: 2px solid var(--rosa-claro);
    border-radius: 999px;
    background: var(--rosa-fundo);
    color: var(--rosa-forte);
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 12px;
    cursor: pointer;
}

.btn-sair:active,
.btn-conta:active {
    background: var(--rosa-claro);
}

.btn-conta {
    text-decoration: none;
    white-space: nowrap;
}

.conteudo {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.topo--login,
.conteudo--login {
    max-width: 420px;
}

/* -------------------------------------------------------------- login --- */

.criar-conta,
.trocar-senha {
    background: var(--branco);
    border: 2px solid var(--rosa-borda);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    overflow: hidden;
}

.criar-conta__resumo,
.trocar-senha__resumo {
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    font-weight: 800;
    color: var(--rosa-forte);
    text-align: center;
}

.criar-conta__resumo::-webkit-details-marker,
.trocar-senha__resumo::-webkit-details-marker {
    display: none;
}

.criar-conta__form,
.trocar-senha__form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 16px 16px;
}

.senha-nota {
    margin: 0;
    font-size: 12px;
    color: var(--texto-suave);
}

.olho {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    margin: -5px -8px -5px 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #d6558c;
    cursor: pointer;
}

.olho:active {
    background: var(--rosa-fundo);
}

.olho svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Com a senha à mostra o olho aparece cortado: o próximo clique esconde. */
.olho[aria-pressed="true"] {
    color: var(--rosa-forte);
}

.olho__corte {
    opacity: 0;
}

.olho[aria-pressed="true"] .olho__corte {
    opacity: 1;
}

.senha-regras {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* O display acima venceria o atributo hidden, que é só do user-agent. */
.senha-regras[hidden] {
    display: none;
}

.senha-regra {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--rosa-fundo);
    font-size: 12px;
    font-weight: 700;
    color: var(--texto-suave);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.senha-regra--ok {
    background: #e8fbf0;
    color: #1d6b40;
}

.senha-regra__marca {
    font-weight: 800;
}

/* -------------------------------------------------------------- flash --- */

.flash {
    margin: 0;
    padding: 12px 14px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 14px;
    border: 2px solid;
}

.flash--ok {
    background: #e8fbf0;
    border-color: #8fdcae;
    color: #1d6b40;
}

.flash--erro {
    background: #ffecec;
    border-color: #f5a9a9;
    color: #a3242d;
}

/* ----------------------------------------------------------- navegação -- */

.mes {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--branco);
    border: 2px solid var(--rosa-borda);
    border-radius: 999px;
    padding: 6px;
    box-shadow: var(--sombra);
}

.mes__seta {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--rosa-fundo);
    color: var(--rosa-forte);
    font-size: 24px;
    line-height: 1;
    text-decoration: none;
}

.mes__seta:active {
    background: var(--rosa-claro);
}

.mes__atual {
    font-weight: 800;
    color: var(--rosa-forte);
    font-size: 16px;
}

/* ------------------------------------------------------------- resumo --- */

.resumo,
.form-card,
.painel,
.simulador,
.lista {
    background: var(--branco);
    border: 2px solid var(--rosa-borda);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    padding: 16px;
}

.renda {
    margin-bottom: 12px;
    border: 2px solid var(--rosa-borda);
    border-radius: 14px;
    background: var(--rosa-fundo);
    overflow: hidden;
}

.renda__resumo {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 2px 10px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
}

.renda__resumo::-webkit-details-marker {
    display: none;
}

.renda__rotulo {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--texto-suave);
}

.renda__valor {
    grid-row: 2;
    font-size: 20px;
    font-weight: 800;
    color: var(--rosa-forte);
}

.renda__composicao {
    grid-row: 3;
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--texto-suave);
}

.renda__acao {
    grid-row: 1 / 3;
    grid-column: 2;
    align-self: center;
    border-radius: 999px;
    background: var(--branco);
    border: 2px solid var(--rosa-claro);
    color: var(--rosa-forte);
    font-size: 12px;
    font-weight: 800;
    padding: 6px 12px;
}

.renda[open] .renda__acao::after {
    content: ' ▴';
}

.renda:not([open]) .renda__acao::after {
    content: ' ▾';
}

.renda__aviso {
    margin: 0;
    padding: 0 12px 8px;
    font-size: 12px;
    color: var(--texto-suave);
}

.renda__form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 12px 12px;
}

.renda__form .field {
    background: var(--branco);
}

.resumo__totais,
.resumo__vale {
    margin: 0 0 6px;
    text-align: center;
    font-size: 14px;
    color: var(--texto-suave);
}

.resumo__totais strong,
.resumo__vale strong {
    color: var(--texto);
}

.resumo__vale {
    margin-bottom: 14px;
    font-size: 13px;
}

.cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card {
    border: 2px solid var(--cor);
    border-radius: 14px;
    padding: 10px 12px;
    background: var(--rosa-fundo);
}

.card__topo {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.card__rotulo {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--cor);
}

.card__restante {
    font-size: 17px;
    font-weight: 800;
    color: var(--texto);
}

.barra {
    height: 8px;
    margin: 8px 0 6px;
    border-radius: 999px;
    background: #ffe3ee;
    overflow: hidden;
}

.barra__preenchida {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--cor);
}

.barra__preenchida--estourou {
    background: repeating-linear-gradient(45deg, #c0202a, #c0202a 5px, #e0555d 5px, #e0555d 10px);
}

.card__detalhe {
    margin: 0;
    font-size: 12px;
    color: var(--texto-suave);
}

/* ---------------------------------------------------------- formulário -- */

.form-card {
    padding: 0;
    overflow: hidden;
    border-width: 3px;
    border-color: #ff8fbf;
}

.form-card__header {
    padding: 14px 16px;
    background: var(--rosa-fundo);
}

.form-card__header h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    color: #e0357e;
}

.form-grid {
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.field {
    display: flex;
    flex-direction: column;
    border: 2px solid var(--rosa-borda);
    border-radius: 14px;
    padding: 8px 12px;
    background: #fffafc;
    transition: border-color 0.15s ease;
}

.field:focus-within {
    border-color: #ff5c9c;
}

.field label {
    font-size: 11px;
    font-weight: 800;
    color: #d6558c;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.field input,
.field select,
.field textarea {
    border: none;
    outline: none;
    font-size: 16px; /* 16px evita o zoom automático do iOS ao focar. */
    color: var(--texto);
    font-family: inherit;
    resize: vertical;
    padding: 0;
    background: transparent;
    width: 100%;
}

.field select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e0357e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 2px center;
    padding-right: 18px;
}

.field__input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.field__prefix {
    font-size: 15px;
    color: #d6558c;
    font-weight: 800;
    flex-shrink: 0;
}

.field__sufixo {
    font-size: 13px;
    color: #d6558c;
    font-weight: 800;
    flex-shrink: 0;
}

/* O campo divide a linha com o prefixo, o sufixo ou o botão de olho. */
.field__input-row input {
    min-width: 0;
}

.field textarea {
    min-height: 44px;
}

.form-card__nota {
    margin: 0;
    padding: 0 16px 12px;
    font-size: 12px;
    color: var(--texto-suave);
}

.form-card__footer {
    background: #ffe0ee;
    padding: 14px 16px;
}

.btn-submit {
    width: 100%;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff6fa5, var(--rosa));
    color: var(--branco);
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    padding: 14px 20px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(255, 61, 129, 0.4);
}

.btn-submit:active {
    filter: brightness(0.95);
}

.btn-submit--secundario {
    background: var(--branco);
    border: 2px solid var(--rosa);
    color: var(--rosa-forte);
    box-shadow: none;
    font-size: 14px;
    padding: 11px 18px;
}

/* ------------------------------------------------------------ gráficos -- */

.painel__titulo {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 800;
    color: var(--rosa-forte);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.painel__titulo + .grafico + .painel__titulo {
    margin-top: 22px;
}

.grafico__legenda {
    margin: 10px 0 0;
    min-height: 32px;
    font-size: 13px;
    color: var(--texto-suave);
    text-align: center;
}

.grafico__vazio {
    margin: 0;
    padding: 18px 8px;
    text-align: center;
    font-size: 14px;
    color: var(--texto-suave);
}

.rosca {
    display: block;
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
}

.rosca__fatia {
    cursor: pointer;
    transition: stroke-width 0.15s ease, opacity 0.15s ease;
}

.rosca__fatia--ativa {
    stroke-width: 20;
}

.rosca__centro-valor {
    font-size: 11px;
    font-weight: 800;
    fill: var(--rosa-forte);
}

.rosca__centro-rotulo {
    font-size: 5.5px;
    fill: var(--texto-suave);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.legenda {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legenda__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--rosa-fundo);
    font-size: 13px;
    cursor: pointer;
}

.legenda__item--ativo {
    background: var(--cor);
    color: var(--branco);
}

.legenda__item--ativo .legenda__bolinha {
    background: var(--branco);
}

.legenda__bolinha {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cor);
    flex-shrink: 0;
}

.legenda__rotulo {
    flex: 1;
    font-weight: 700;
}

.legenda__valor {
    font-weight: 800;
}

.grafico--barras {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.barras {
    display: block;
    width: 100%;
    min-width: 420px;
    height: auto;
}

.barras__eixo {
    stroke: var(--rosa-borda);
    stroke-width: 0.6;
}

.barras__coluna {
    cursor: pointer;
}

.barras__coluna--ativa .barras__fatia {
    stroke: var(--texto);
    stroke-width: 0.6;
}

.barras__coluna--ativa .barras__alvo {
    fill: rgba(255, 182, 209, 0.35);
}

.barras__rotulo {
    font-size: 6px;
    fill: var(--texto-suave);
}

/* ---------------------------------------------------------- simulador --- */

.simulador__intro,
.simulador__nota,
.simulador__aviso {
    margin: 0;
    font-size: 13px;
    color: var(--texto-suave);
}

.simulador__intro strong {
    color: var(--cor);
}

.simulador__nota {
    margin-bottom: 12px;
    font-size: 12px;
}

/* A .form-grid traz o respiro dos cartões de formulário; aqui a seção já o tem. */
.simulador__campos {
    padding: 12px 0;
}

/* Sem encolher o campo, o "% a.a." iria parar do outro lado da linha. */
.simulador__campos .field--taxa input {
    flex: 0 1 5em;
}

.simulador__resultado:not(:empty) {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 2px solid var(--rosa-borda);
}

.simulador__resumo {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.simulador__resumo li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--rosa-fundo);
}

.simulador__rotulo {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--texto-suave);
}

.simulador__valor {
    font-size: 16px;
    font-weight: 800;
    color: var(--cor);
}

.simulador__tabela td:nth-child(2) {
    width: 45%;
}

.simulador__cifra {
    display: block;
}

.simulador__tabela .barra {
    display: flex;
    height: 5px;
    margin: 5px 0 0;
}

.simulador__fatia {
    height: 100%;
    background: var(--cor);
}

/* A fatia dos juros é a mesma cor mais clara: separa sem virar outra legenda. */
.simulador__fatia--juros {
    opacity: 0.4;
}

.simulador__aviso {
    margin-top: 10px;
    font-size: 12px;
}

/* ------------------------------------------------------------- tabela --- */

.lista__topo {
    margin-bottom: 10px;
}

.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filtro {
    border: 2px solid var(--cor, var(--rosa-borda));
    background: var(--branco);
    color: var(--texto);
    border-radius: 999px;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.filtro--ativo {
    background: var(--cor, var(--rosa-forte));
    color: var(--branco);
}

.tabela {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tabela th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--texto-suave);
    padding: 6px 4px;
    border-bottom: 2px solid var(--rosa-borda);
}

.tabela td {
    padding: 8px 4px;
    border-bottom: 1px solid #ffe9f2;
    vertical-align: middle;
}

.tabela__dia {
    white-space: nowrap;
    font-weight: 700;
    color: var(--texto-suave);
}

.tabela__valor,
.tabela th.tabela__valor {
    text-align: right;
    white-space: nowrap;
    font-weight: 800;
}

.tabela th.tabela__valor {
    font-weight: inherit;
}

.tabela__descricao {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--texto-suave);
}

.tabela__acoes {
    width: 36px;
    text-align: right;
}

.tabela tfoot td {
    border-bottom: none;
    padding-top: 10px;
    font-weight: 800;
    color: var(--rosa-forte);
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--cor);
    color: var(--branco);
    font-size: 11px;
    font-weight: 800;
}

.tag--vale {
    --cor: #2f8f5b;
    margin-left: 4px;
}

.filtro--vale {
    --cor: #2f8f5b;
}

.btn-excluir {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--rosa-fundo);
    color: var(--rosa-forte);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.btn-excluir:active {
    background: var(--rosa-claro);
}

.vazio {
    margin: 0;
    padding: 18px 8px;
    text-align: center;
    color: var(--texto-suave);
}

/* ------------------------------------------------- ajustes para desktop -- */

@media (min-width: 640px) {
    body {
        padding: 32px 16px 64px;
    }

    .topo h1 {
        font-size: 22px;
    }

    .cards {
        flex-direction: row;
    }

    .card {
        flex: 1;
    }

    .renda__form {
        flex-direction: row;
        align-items: flex-end;
    }

    .renda__form .field {
        flex: 1;
    }

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

    .form-grid--uma-coluna {
        grid-template-columns: 1fr;
    }

    .simulador__campos {
        grid-template-columns: repeat(3, 1fr);
    }

    .simulador__resumo {
        flex-direction: row;
    }

    .simulador__resumo li {
        flex: 1;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .field--full {
        grid-column: 1 / -1;
    }

    .form-card__footer {
        display: flex;
        justify-content: flex-end;
    }

    .btn-submit {
        width: auto;
    }

    .legenda {
        flex-direction: row;
        justify-content: center;
    }

    .barras {
        min-width: 0;
    }
}
