/* Caixinhas (metas de compras futuras) */
.goals-view { display: block; }
.goals-view.hidden { display: none; }
.goals-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 4px 0 16px; }
.goals-head h2 { margin: 0; font-size: 17px; }
.goals-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; max-width: 560px; line-height: 1.5; }
.goals-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.goals-summary:empty { display: none; }
.goals-stat { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; display: grid; gap: 6px; }
.goals-stat span { color: var(--muted); font-size: 11px; font-weight: 600; }
.goals-stat strong { font-size: 20px; letter-spacing: -.01em; }
.goals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.goal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.goal-card:hover { transform: translateY(-2px); border-color: rgba(129,120,255,.38); box-shadow: 0 16px 36px rgba(0,0,0,.28); }
.goal-card.is-done { border-color: rgba(38,201,135,.45); }
.goal-cover { position: relative; aspect-ratio: 4 / 3; background: #12181b; overflow: hidden; }
.goal-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.goal-cover-fallback { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255,255,255,.85); background: radial-gradient(circle at 30% 20%, #3b2d9c, #17133f 70%); }
.goal-cover-fallback svg { width: 54px; height: 54px; }
.goal-badge { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 700; background: rgba(8,10,20,.72); backdrop-filter: blur(6px); color: #d8dcf5; border: 1px solid rgba(255,255,255,.12); }
.goal-badge svg { width: 12px; height: 12px; }
.goal-badge.done { background: rgba(38,201,135,.9); color: #04281a; border-color: transparent; }
.goal-body { padding: 16px 16px 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 11px; min-width: 0; }
.goal-name { margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-amounts { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.goal-amounts strong { font-size: 21px; letter-spacing: -.01em; }
.goal-amounts span { color: var(--muted); font-size: 12px; }
.goal-progress { height: 11px; border-radius: 999px; background: #0f1417; border: 1px solid rgba(255,255,255,.06); overflow: hidden; }
.goal-progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6a2bff, #b04dff 60%, #e84ec8); box-shadow: 0 0 12px rgba(150,80,255,.55); transition: width .7s cubic-bezier(.2,.8,.2,1); min-width: 0; }
.goal-card.is-done .goal-progress-fill { background: linear-gradient(90deg, #1fb57a, #3ee6a0); box-shadow: 0 0 12px rgba(38,201,135,.5); }
.goal-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; color: var(--muted); font-size: 11.5px; }
.goal-pct { color: #fff; font-weight: 800; font-size: 12.5px; }
.goal-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; align-items: center; margin-top: 2px; }
.goal-main-btn { grid-column: span 3; justify-content: center; padding-inline: 10px; gap: 6px; min-width: 0; }
.goal-main-btn svg { width: 14px; height: 14px; }
.goal-main-btn:disabled { opacity: .45; cursor: not-allowed; }
.goal-icon-btn { grid-column: span 2; width: 100%; height: 36px; display: grid; place-items: center; border-radius: 11px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.04); color: #c3c9d6; cursor: pointer; transition: background .15s, color .15s; }
.goal-icon-btn svg { width: 16px; height: 16px; }
.goal-icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.goal-icon-btn.danger:hover { background: rgba(255,105,125,.16); color: var(--red); }
.goals-empty { text-align: center; padding: 46px 20px; background: var(--panel); border: 1px dashed rgba(129,120,255,.35); border-radius: 22px; display: grid; justify-items: center; gap: 10px; }
.goals-empty .goal-cover-fallback { width: 78px; height: 78px; border-radius: 22px; }
.goals-empty h3 { margin: 6px 0 0; font-size: 17px; }
.goals-empty p { margin: 0; color: var(--muted); font-size: 12.5px; max-width: 420px; line-height: 1.55; }
/* Modais */
.goal-image-picker { display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center; }
.goal-image-preview { aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #12181b; border: 1px solid #ffffff12; display: grid; place-items: center; }
.goal-image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.goal-image-preview .goal-cover-fallback svg { width: 34px; height: 34px; }
.goal-image-preview span { display: none; }
.goal-image-actions { display: grid; gap: 8px; justify-items: start; }
.goal-image-actions .btn { padding: 9px 14px; }
.goal-image-hint { margin: 0; color: #87919c; font-size: 10.5px; line-height: 1.5; }
.visually-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.goal-history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 52vh; overflow: auto; }
.goal-entry { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 13px; background: #12181b; border: 1px solid #ffffff0d; }
.goal-entry-info { display: grid; gap: 3px; min-width: 0; }
.goal-entry-info strong { font-size: 13px; }
.goal-entry-info span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-entry-amount { font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.goal-entry.deposit .goal-entry-amount { color: var(--green); }
.goal-entry.withdrawal .goal-entry-amount { color: var(--red); }
.goal-history-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 22px 8px; }
@media (max-width: 760px) {
  .goals-summary { grid-template-columns: 1fr; }
  .goals-grid { grid-template-columns: minmax(0, 1fr); }
  .goal-image-picker { grid-template-columns: 104px 1fr; }
}
@media (prefers-reduced-motion: reduce) { .goal-progress-fill, .goal-card { transition: none; } }

/* Aba Caixinha: esconde filtros, resumo e tabela de lançamentos */
body.view-goals .filters, body.view-goals #statsGrid, body.view-goals #transactionsPanel, body.view-goals #overviewContent, body.view-goals #periodPill, body.view-goals #addTopBtn { display: none !important; }
@media (max-width: 880px) { .mobile-nav { grid-template-columns: repeat(5, 1fr) !important; } }
