/* MyFinance — UI compartilhada (painel inferior, formulários, metas, categorias).
 * Tudo fica dentro de .ui-sheet / .ui-overlay para não colidir com o CSS de cada página. */

.ui-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.65); animation: ui-fade .2s; }
.ui-overlay[hidden], .ui-sheet[hidden] { display: none; }
@keyframes ui-fade { from { opacity: 0; } }

.ui-sheet {
  --u-bg: #0d0d0f;
  --u-field: #000;
  --u-line: #1f1f23;
  --u-3: #1c1c1f;
  --u-text: #ececee;
  --u-text-2: #b4b4ba;
  --u-muted: #7d7d84;
  --u-gold: #d8b77f;
  --u-gold-strong: #e6c48a;
  --u-gold-bg: rgba(216, 183, 127, .14);
  --u-green: #7fcf9a;
  --u-red: #e08a8a;

  position: fixed; left: 50%; bottom: 0; z-index: 80;
  transform: translateX(-50%);
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  background: var(--u-bg); color: var(--u-text);
  border-radius: 24px 24px 0 0; border-top: 1px solid rgba(255,255,255,.06);
  padding: 10px 20px max(24px, env(safe-area-inset-bottom));
  animation: ui-sobe .25s cubic-bezier(.2,.8,.2,1);
  text-align: left;
}
@keyframes ui-sobe { from { transform: translate(-50%, 100%); } }

.ui-sheet button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.ui-sheet svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ui-handle { width: 40px; height: 5px; border-radius: 3px; background: #333; margin: 0 auto 14px; }
.ui-sheet h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 16px; }
.ui-sheet p.ajuda { color: var(--u-text-2); font-size: 15px; line-height: 1.5; margin-bottom: 12px; }
.ui-sheet p.ajuda b { color: var(--u-gold); }
.ui-sheet .vazio { color: var(--u-muted); font-size: 14px; padding: 14px 0; list-style: none; }

/* campos */
.ui-sheet .campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ui-sheet .campo[hidden] { display: none; }
.ui-sheet .campo label { font-size: 13px; color: var(--u-text-2); text-transform: uppercase; letter-spacing: .03em; }
.ui-sheet .campo-topo { display: flex; justify-content: space-between; align-items: baseline; }
.ui-sheet .campo-topo .link { font-size: 13px; }
.ui-sheet input:not([type="checkbox"]), .ui-sheet select {
  background: var(--u-field); border: 1px solid #2a2a2f; border-radius: 12px;
  color: var(--u-text); padding: 13px 14px; font: inherit; font-size: 17px; outline: none; width: 100%;
  color-scheme: dark;
}
.ui-sheet input:focus, .ui-sheet select:focus { border-color: var(--u-gold); }

/* campos de data: no iOS o input nativo tem largura mínima própria e estoura a caixa */
.ui-sheet input[type="date"] {
  -webkit-appearance: none; appearance: none;
  display: block; box-sizing: border-box;
  min-width: 0; max-width: 100%;
  height: 50px; line-height: 22px;
  text-align: left;
}
.ui-sheet input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.ui-sheet input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.8); cursor: pointer; }
.ui-sheet .campo { min-width: 0; }
.ui-sheet .campo .check { display: flex; align-items: center; gap: 10px; text-transform: none; font-size: 15px; color: var(--u-text); cursor: pointer; }
.ui-sheet input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--u-gold); }
.ui-sheet .campo-meta { padding: 12px; border-radius: 14px; background: var(--u-gold-bg); border: 1px solid rgba(216,183,127,.3); }
.ui-sheet .campo-meta label { color: var(--u-gold); }
.ui-sheet .dica { font-size: 13px; line-height: 1.45; color: var(--u-text-2); }
.ui-sheet .link { color: var(--u-gold); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.ui-sheet .segmento { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--u-field); padding: 5px; border-radius: 14px; margin-bottom: 16px; }
.ui-sheet .segmento button { padding: 10px 4px; border-radius: 10px; color: var(--u-text-2); font-weight: 600; font-size: 15px; }
.ui-sheet .segmento button.ativo { background: var(--u-3); color: var(--u-gold); }
/* quantidade de botões variável: colunas iguais automáticas */
.ui-sheet .segmento { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.ui-sheet .segmento button { font-size: 14px; }
.ui-sheet .segmento .seg-nova { color: var(--u-gold); border: 1px dashed rgba(216,183,127,.5); font-size: 12px; line-height: 1.15; }
.ui-sheet .dica-fixo { margin: -4px 0 14px; padding: 10px 12px; border-radius: 12px; background: rgba(224,138,138,.08); border: 1px solid rgba(224,138,138,.25); }
.ui-sheet .dica-fixo[hidden] { display: none; }
.ui-sheet .dica-fixo b { color: var(--u-text); }

/* fixos do mês */
.ui-sheet .fx-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ui-sheet .fx-nav span { font-weight: 600; font-size: 16px; }
.ui-sheet .fx-nav button { width: 38px; height: 38px; border-radius: 12px; background: var(--u-3); display: grid; place-items: center; color: var(--u-text-2); }
.ui-sheet .fx-resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ui-sheet .fx-resumo:empty { display: none; }
.ui-sheet .fx-resumo div { background: var(--u-field); border: 1px solid var(--u-line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ui-sheet .fx-resumo span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--u-muted); }
.ui-sheet .fx-resumo strong { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-sheet .fx-resumo .ok { color: var(--u-green); }
.ui-sheet .fx-resumo .falta { color: var(--u-red); }
.ui-sheet .fx-lista { list-style: none; margin-bottom: 12px; }
.ui-sheet .fx { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--u-line); }
.ui-sheet .fx-check { display: grid; place-items: center; cursor: pointer; }
.ui-sheet .fx-check input { width: 22px; height: 22px; accent-color: var(--u-green); }
.ui-sheet .fx-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.ui-sheet .fx-desc { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-sheet .fx-meta { font-size: 13px; color: var(--u-muted); }
.ui-sheet .fx-val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--u-text-2); white-space: nowrap; }
.ui-sheet .fx.pago .fx-desc, .ui-sheet .fx.pago .fx-val { color: var(--u-muted); text-decoration: line-through; }
.ui-sheet .fx-st.ok { color: var(--u-green); }
.ui-sheet .fx-st.atraso { color: var(--u-red); font-weight: 700; }
.ui-sheet .segmento .seg-nova:hover { background: var(--u-gold-bg); }

/* botões */
.ui-sheet .botoes { display: flex; gap: 10px; margin-top: 6px; }
.ui-sheet .btn { flex: 1; padding: 14px; border-radius: 14px; font-weight: 600; font-size: 16px; text-align: center; }
.ui-sheet .btn-primario { background: var(--u-gold); color: #1a1408; }
.ui-sheet .btn-sec { background: var(--u-3); color: var(--u-text); }
.ui-sheet .btn-perigo { background: rgba(224,138,138,.12); color: var(--u-red); }
.ui-sheet .btn[disabled] { opacity: .5; cursor: wait; }
.ui-sheet .btn-add-dia {
  width: 100%; padding: 11px; border-radius: 12px;
  border: 1px dashed #3a3a40; color: var(--u-gold); font-weight: 600; font-size: 15px;
}
.ui-sheet .btn-add-dia:hover { background: var(--u-gold-bg); }

/* listas de resumo */
.ui-sheet .resumo-lista { list-style: none; margin-bottom: 16px; }
.ui-sheet .resumo-lista li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--u-line); font-variant-numeric: tabular-nums; }
.ui-sheet .resumo-lista li span:first-child { color: var(--u-text-2); }
.ui-sheet .resumo-lista .pos { color: var(--u-green); }
.ui-sheet .resumo-lista .neg { color: var(--u-red); }
.ui-sheet .resumo-lista .gold { color: var(--u-gold); font-weight: 600; }
.ui-sheet .resumo-sub { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--u-muted); margin: 6px 0 2px; }

/* metas */
.ui-sheet .metas-total {
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px; margin-bottom: 14px; border-radius: 16px;
  background: var(--u-gold-bg); border: 1px solid rgba(216,183,127,.35);
}
.ui-sheet .mt-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--u-gold); }
.ui-sheet .mt-valor { font-size: 30px; font-weight: 700; color: var(--u-gold-strong); font-variant-numeric: tabular-nums; }
.ui-sheet .mt-sub { font-size: 13px; color: var(--u-text-2); }
.ui-sheet .mt-lista { list-style: none; margin-top: 10px; border-top: 1px solid rgba(216,183,127,.2); }
.ui-sheet .mt-lista li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0 0; font-size: 14px; color: var(--u-text-2); font-variant-numeric: tabular-nums; }
.ui-sheet .mt-lista small { color: var(--u-muted); }
.ui-sheet .mt-lista li span:last-child { color: var(--u-gold); font-weight: 600; }
.ui-sheet .metas { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.ui-sheet .meta-card { background: var(--u-field); border: 1px solid var(--u-line); border-radius: 16px; padding: 14px; }
.ui-sheet .meta-card.ativa { border-color: rgba(216,183,127,.45); }
.ui-sheet .meta-topo { display: flex; align-items: center; gap: 8px; }
.ui-sheet .meta-nome { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-sheet .meta-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 7px; border-radius: 6px; background: var(--u-gold-bg); color: var(--u-gold); }
.ui-sheet .meta-badge.ok { background: rgba(127,207,154,.14); color: var(--u-green); }
.ui-sheet .meta-badge.venc { background: rgba(224,138,138,.14); color: var(--u-red); }
.ui-sheet .meta-acoes { display: flex; gap: 2px; }
.ui-sheet .meta-acoes button { color: var(--u-muted); padding: 4px; border-radius: 6px; }
.ui-sheet .meta-acoes button:hover { color: var(--u-text); background: var(--u-3); }
.ui-sheet .meta-barra { height: 6px; border-radius: 3px; background: var(--u-3); margin: 12px 0 8px; overflow: hidden; }
.ui-sheet .meta-barra > i { display: block; height: 100%; background: var(--u-gold); border-radius: 3px; }
.ui-sheet .meta-info { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--u-text-2); font-variant-numeric: tabular-nums; }
.ui-sheet .meta-info b { color: var(--u-gold); font-weight: 600; }

/* categorias */
.ui-sheet .abas { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--u-field); padding: 5px; border-radius: 14px; margin-bottom: 14px; }
.ui-sheet .abas button { padding: 11px; border-radius: 10px; font-weight: 700; color: var(--u-text-2); }
.ui-sheet .abas button.ativo { background: var(--u-3); color: var(--u-gold); }
.ui-sheet .abas button[data-aba="entrada"].ativo { color: var(--u-green); }
.ui-sheet .abas button[data-aba="saida"].ativo { color: var(--u-red); }
.ui-sheet .cat-nova { display: flex; gap: 8px; margin-bottom: 10px; }
.ui-sheet .cat-nova input { flex: 1; min-width: 0; }
.ui-sheet .cat-nova .btn { flex: 0 0 auto; padding: 0 16px; }
.ui-sheet .cats { list-style: none; max-height: 46vh; overflow-y: auto; }
.ui-sheet .cat { display: flex; align-items: center; gap: 6px; padding: 10px 2px; border-bottom: 1px solid var(--u-line); }
.ui-sheet .cat-nome { flex: 1; min-width: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-sheet .cat-uso { font-size: 12px; color: var(--u-muted); background: var(--u-3); border-radius: 10px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.ui-sheet .cat > button { color: var(--u-muted); padding: 6px; border-radius: 8px; }
.ui-sheet .cat > button:hover { color: var(--u-text); background: var(--u-3); }
.ui-sheet .cat.editando input { flex: 1; min-width: 0; padding: 9px 12px; font-size: 16px; }
.ui-sheet .cat.editando .cat-ok { color: var(--u-gold); font-weight: 700; padding: 8px 10px; }

/* origem do aporte (dinheiro novo / do saldo) */
.ui-sheet .origem { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--u-field); padding: 4px; border-radius: 12px; }
.ui-sheet .origem button { padding: 10px 6px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--u-text-2); }
.ui-sheet .origem button.ativo { background: var(--u-3); color: var(--u-gold); }
.ui-sheet .dica b { color: var(--u-text); }

/* cartões */
.ui-sheet .cc { background: var(--u-field); border: 1px solid var(--u-line); border-radius: 16px; padding: 14px; }
.ui-sheet .cc-disp { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.ui-sheet .cc-disp span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--u-muted); }
.ui-sheet .cc-disp strong { font-size: 22px; }
.ui-sheet .cc-disp strong.neg { color: var(--u-red); }
.ui-sheet .cc-disp small { color: var(--u-muted); font-size: 13px; }
.ui-sheet .cc-barra { margin: 8px 0 10px; }
.ui-sheet .cc-barra > i { background: var(--u-text-2); }
.ui-sheet .cc-fatura { width: 100%; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--u-3); font-size: 14px; color: var(--u-text-2); text-align: left; }
.ui-sheet .cc-fatura b { color: var(--u-text); font-variant-numeric: tabular-nums; }

/* saúde financeira */
.ui-sheet .sd-topo { text-align: center; margin-bottom: 18px; }
.ui-sheet .sd-nota { display: block; font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.ui-sheet .sd-nivel { display: block; font-size: 17px; font-weight: 700; margin: 4px 0 14px; }
.ui-sheet .sd-escala { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, hsl(0,70%,55%), hsl(45,85%,55%) 50%, hsl(130,60%,50%)); }
.ui-sheet .sd-escala i { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid #000; transform: translate(-50%, -50%); }
.ui-sheet .sd-legenda { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--u-muted); text-transform: uppercase; letter-spacing: .04em; }
.ui-sheet .sd-fatores { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.ui-sheet .sd-fatores li { background: var(--u-field); border: 1px solid var(--u-line); border-radius: 14px; padding: 12px 14px; }
.ui-sheet .sd-f-topo { display: flex; justify-content: space-between; font-weight: 600; }
.ui-sheet .sd-f-topo b { font-variant-numeric: tabular-nums; }
.ui-sheet .sd-f-topo small { color: var(--u-muted); font-weight: 500; }
.ui-sheet .sd-f-barra { height: 6px; border-radius: 3px; background: var(--u-3); margin: 8px 0; overflow: hidden; }
.ui-sheet .sd-f-barra i { display: block; height: 100%; border-radius: 3px; }
.ui-sheet .sd-fatores p { font-size: 14px; color: var(--u-text-2); }
.ui-sheet .sd-fatores p.sd-dica { font-size: 13px; color: var(--u-muted); margin-top: 2px; }
