/* Our Savings - all the looks live here */

:root {
  --pink-50: #fff5f8;
  --pink-100: #ffe6ee;
  --pink-200: #ffd3e2;
  --pink-300: #f9b8cd;
  --pink-400: #ef93b3;
  --pink-500: #e2739c;
  --pink-700: #b84a75;
  --ink: #6b3b4d;
  --ink-strong: #4d2635;
  --card: rgba(255, 255, 255, 0.75);
  --shadow-soft: 0 10px 30px -12px rgba(200, 90, 130, 0.35);
  --shadow-lift: 0 16px 40px -14px rgba(200, 90, 130, 0.45);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100dvh;
  font-family: "Quicksand", system-ui, sans-serif;
  color: var(--ink);
  font-size: clamp(15px, 1.6vw, 16px);
  background:
    radial-gradient(1000px 600px at 10% -10%, #ffe9f1 0%, transparent 60%),
    radial-gradient(900px 700px at 110% 10%, #ffdbe8 0%, transparent 55%),
    linear-gradient(180deg, #ffe4ee 0%, #ffd8e7 45%, #ffe9f1 100%);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
svg.ic { width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.16em; fill: currentColor; }

.sparkles { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.sparkle {
  position: absolute; opacity: .6; color: #fff;
  animation: twinkle 3.4s ease-in-out infinite;
}
.sparkle svg { width: 100%; height: 100%; display: block; fill: #fff; }
@keyframes twinkle { 0%,100% { opacity:.15; transform: scale(.7);} 50% { opacity:.8; transform: scale(1.15);} }

.wrap {
  position: relative; z-index: 1;
  width: 100%;
  max-width: 1100px; margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) clamp(12px, 4vw, 28px) calc(150px + env(safe-area-inset-bottom));
}

.bubble {
  position: relative; margin: 8px auto 24px; max-width: 620px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border: 0; width: 100%; display: block; font-family: inherit;
  border-radius: 22px; padding: 16px 18px 18px; text-align: center;
  font-weight: 600; font-size: clamp(14px, 3.6vw, 16px); line-height: 1.5; color: var(--ink-strong);
  box-shadow: var(--shadow-soft);
  transition: opacity .3s ease, transform .3s ease;
  -webkit-tap-highlight-color: transparent;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; width: 18px; height: 18px;
  background: rgba(255,255,255,.85); transform: translateX(-50%) rotate(45deg); border-radius: 4px;
}
.bubble.fade { opacity: 0; transform: translateY(-6px) scale(.99); }
.bubble .tap {
  display: block; margin-top: 8px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--pink-500); opacity: .75;
}

h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(15px, 5.2vw, 30px);
  color: var(--pink-700);
  text-align: center; margin: 0 0 18px; line-height: 1.6;
  text-shadow: 2px 2px 0 rgba(255,255,255,.7);
  overflow-wrap: anywhere;
}

.syncbar {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin: 0 auto 18px; padding: 10px 12px; max-width: 620px;
  background: rgba(255,255,255,.72); border-radius: 24px; box-shadow: var(--shadow-soft);
  font-size: 13px; font-weight: 700;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pink-300); flex: none; }
.dot.on { background: #5ec27a; }
.dot.busy { background: #f3c34a; }
.dot.off { background: #d98a9f; }
.syncbar .code { font-family: "Press Start 2P", monospace; font-size: 10px; color: var(--pink-700); }
.syncbar button { padding: 8px 14px; font-size: 12px; }

.who {
  display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap;
  margin: 0 auto 18px; font-size: 13px; font-weight: 700;
}
.who .seg { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.7); box-shadow: var(--shadow-soft); }
.who .seg button { padding: 8px 16px; font-size: 13px; box-shadow: none; background: transparent; }
.who .seg button.on { background: linear-gradient(135deg, var(--pink-400), var(--pink-500)); color: #fff; }

.top { display: grid; gap: 18px; margin-bottom: 20px; }
@media (min-width: 900px) { .top { grid-template-columns: minmax(280px, 380px) 1fr; align-items: start; } }

.ring-card {
  display: grid; place-items: center; gap: 14px;
  background: var(--card); backdrop-filter: blur(10px);
  border-radius: 30px; padding: clamp(18px, 4vw, 26px); 
  box-shadow: var(--shadow-soft);
}
.ring { position: relative; width: min(240px, 58vw); aspect-ratio: 1; }
.ring svg.dial { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .center {
  position: absolute; inset: 14%; border-radius: 50%;
  background: linear-gradient(160deg, #fff 0%, var(--pink-100) 100%);
  display: grid; place-items: center; box-shadow: inset 0 4px 14px rgba(226,115,156,.18);
}
.pix { image-rendering: pixelated; width: 62%; }
.total { text-align: center; }
.total .big { font-size: clamp(19px, 5.6vw, 30px); font-weight: 700; color: var(--pink-700); overflow-wrap: anywhere; }
.total .sub { font-size: 13px; opacity: .85; margin-top: 6px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 18px; }
button {
  font-family: inherit; font-weight: 700; cursor: pointer; border: 0;
  border-radius: 999px; padding: 11px 18px; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: rgba(255,255,255,.85); color: var(--pink-700);
  box-shadow: var(--shadow-soft); transition: transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
button:active { transform: translateY(1px) scale(.98); }
button.primary { background: linear-gradient(135deg, var(--pink-400), var(--pink-500)); color: #fff; }
button[disabled] { opacity: .55; cursor: default; }

.goals { display: grid; gap: 14px; }
@media (min-width: 620px) { .goals { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }

.goal {
  background: var(--card); backdrop-filter: blur(10px);
  border-radius: var(--radius); padding: 16px 16px 14px;
  box-shadow: var(--shadow-soft);
  animation: pop .3s ease both;
}
@keyframes pop { from { opacity:0; transform: translateY(8px);} to {opacity:1; transform:none;} }
.goal .row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; }
.heart { width: 22px; height: 22px; flex: none; image-rendering: pixelated; }
.goal .name { font-weight: 700; color: var(--ink-strong); font-size: 16px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal .amt { font-size: 12.5px; font-weight: 700; color: var(--pink-700); white-space: nowrap; }
.bar { margin-top: 12px; height: 12px; border-radius: 999px; background: var(--pink-100); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--pink-300), var(--pink-500)); transition: width .5s ease; }
.goal .acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.goal .acts button { flex: 1 1 110px; padding: 9px 10px; font-size: 13px; box-shadow: none; background: var(--pink-100); }
.goal .acts button.add { background: linear-gradient(135deg, var(--pink-300), var(--pink-400)); color: #fff; }
.pct { font-size: 12px; margin-top: 8px; opacity: .8; font-weight: 600; display: flex; align-items: center; gap: 6px; }

.empty { text-align: center; padding: 34px 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-soft); line-height: 1.6; }

.section-title {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  margin: 26px 0 12px; font-weight: 700; color: var(--ink-strong); font-size: 15px;
}
.section-title span.lbl { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.section-title button { padding: 7px 13px; font-size: 12px; }

.history { display: grid; gap: 10px; }
.hist {
  display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px;
  background: rgba(255,255,255,.7); border-radius: 18px; padding: 11px 13px;
  box-shadow: var(--shadow-soft);
}
.hist .av {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; flex: none;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
}
.hist .av.j2 { background: linear-gradient(135deg, #8fb8f0, #6f95e0); }
.hist .txt { min-width: 0; }
.hist .txt b { color: var(--ink-strong); }
.hist .txt .sm { display: block; font-size: 11.5px; opacity: .75; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist .val { font-weight: 700; color: var(--pink-700); white-space: nowrap; font-size: 14px; }
.hist .val.neg { color: #b1607f; }

.fab {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom));
  width: 60px; height: 60px; z-index: 5; padding: 0;
  border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  box-shadow: var(--shadow-lift);
}
.fab svg.ic { width: 26px; height: 26px; }

dialog {
  border: 0; border-radius: 26px; padding: 0; width: min(430px, 92vw);
  max-height: 88dvh; overflow: auto;
  background: #fffafc; color: var(--ink); box-shadow: var(--shadow-lift);
}
dialog::backdrop { background: rgba(180, 90, 120, .35); backdrop-filter: blur(3px); }
.sheet { padding: clamp(18px, 5vw, 24px); }
.sheet h2 { font-family: "Press Start 2P", monospace; font-size: clamp(11px, 3.4vw, 13px); color: var(--pink-700);
  margin: 0 0 14px; line-height: 1.7; display: flex; align-items: center; gap: 9px; }
.sheet p.hint { font-size: 13px; line-height: 1.6; margin: 0 0 8px; }
label { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 6px; }
input, select {
  width: 100%; font-family: inherit; font-size: 16px; font-weight: 600; color: var(--ink-strong);
  padding: 12px 14px; border-radius: 14px; border: 2px solid var(--pink-200);
  background: #fff; outline: none;
}
input:focus, select:focus { border-color: var(--pink-400); }
.err { color: #c9385f; font-size: 12.5px; font-weight: 700; margin-top: 10px; min-height: 16px; }
.sheet .acts { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.sheet .acts button { flex: 1 1 120px; }
.codebox {
  margin-top: 6px; padding: 14px; border-radius: 16px; background: var(--pink-100);
  font-family: "Press Start 2P", monospace; font-size: 10px; line-height: 1.9;
  color: var(--pink-700); word-break: break-all; text-align: center;
}
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: rgba(77,38,53,.93); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: .3s ease; z-index: 20;
  max-width: 88vw; text-align: center; display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
