:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --ink: #141a33;
  --muted: #868b9e;
  --hair: #ececf2;
  --violet: #6a00ff;
  --violet-soft: #efe8ff;
  --hero-a: #7a4be0;
  --hero-b: #3a14b4;
  --hero-c: #23097a;
  --peach: #ffb38a;
  --sunset: #ff8a65;
  --up: #12b886;
  --down: #f0756b;
  --line: #3fe0a9;
  --pink: #ff4fa3;
  --gold: #f5c451;
  --nav: #111a35;
  --radius: 22px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; padding-bottom: 120px; }
@media (min-width: 520px) {
  body { background: #1b0b4a; }
  body::before { content: ""; position: fixed; inset: -40px; background: radial-gradient(900px 600px at 50% 0%, #7a4be0, #1b0b4a 70%) center / cover; filter: blur(42px) saturate(1.2); opacity: .75; z-index: -1; }
  .app { box-shadow: 0 30px 90px -20px rgba(0, 0, 0, .55); margin-top: 24px; margin-bottom: 24px; border-radius: 34px; overflow: hidden; min-height: calc(100vh - 48px); }
  .hero { border-radius: 34px 34px 0 0; }
}

/* ---------- hero ---------- */
.hero {
  color: #fff;
  background:
    radial-gradient(420px 240px at 92% -60px, rgba(255, 179, 138, .55), transparent 70%),
    radial-gradient(500px 260px at 20% -80px, rgba(255, 79, 163, .35), transparent 70%),
    linear-gradient(180deg, var(--hero-a) 0%, var(--hero-b) 38%, var(--hero-c) 100%);
  padding: calc(16px + env(safe-area-inset-top)) 0 18px;
  overflow: hidden;
}
.topbar { display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.ring { flex: none; width: 54px; height: 54px; border-radius: 50%; padding: 2.5px; background: conic-gradient(from 200deg, var(--peach), var(--pink), #a66bff, var(--peach)); }
.avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2.5px solid var(--hero-a); background: linear-gradient(135deg, var(--pink), var(--violet)); display: grid; place-items: center; font-weight: 700; }
.hello { flex: 1; line-height: 1.15; }
.hello small { display: block; opacity: .75; font-size: 13px; }
.hello b { font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.14); color: #fff; text-decoration: none; }
.pills { display: flex; gap: 6px; padding: 16px 20px 4px; overflow-x: auto; scrollbar-width: none; }
.pills a { flex: none; padding: 7px 16px; border-radius: 999px; font-size: 15px; text-decoration: none; color: rgba(255,255,255,.88); }
.pills a.on { background: #fff; color: var(--ink); }

.total { padding: 18px 20px 0; }
.total .label { font-size: 15px; opacity: .92; }
.total .label em { font-style: normal; color: #b9a2ff; }
.banner { margin: 10px 20px 0; padding: 9px 14px; border-radius: 14px; background: rgba(255,255,255,.14); font-size: 13.5px; line-height: 1.4; }
.big { font-size: clamp(38px, 13vw, 52px); font-weight: 500; letter-spacing: -.035em; margin: 4px 0 2px; line-height: 1.05; }
.big small { font-size: .5em; letter-spacing: -.01em; }
.chg { display: flex; align-items: center; gap: 6px; font-size: 16px; flex-wrap: wrap; }
.chg .dot { opacity: .8; }
.chg.up .v { color: #54f0b8; }
.chg.down .v { color: #ff9a90; }
.split { margin-top: 16px; }
.split-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.15); gap: 3px; }
.split-bar i { display: block; height: 100%; border-radius: 999px; min-width: 0; }
.split-bar .inv { background: var(--line); }
.split-bar .cash { background: linear-gradient(90deg, var(--gold), var(--peach)); }
.split-legend { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; opacity: .95; }
.split-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.split-legend .dot.inv { background: var(--line); }
.split-legend .dot.cash { background: var(--gold); }
.split-legend strong { font-weight: 600; }
.mood { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 14px; }
.milestone { margin-left: 6px; opacity: .85; font-size: 13px; }

.chart-head { display: flex; justify-content: space-between; align-items: baseline; padding: 26px 20px 4px; }
.chart-head .label { font-size: 16px; }
.chart-head .period { font-size: 13px; opacity: .85; }
.chart { position: relative; height: 210px; touch-action: pan-y; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .tip { position: absolute; top: 0; transform: translateX(-50%); background: rgba(255,255,255,.95); color: var(--ink); padding: 4px 9px; border-radius: 9px; font-size: 12px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; }
.chart .tip b { display: block; font-size: 13px; }
.chart .empty { position: absolute; inset: 0; display: grid; place-items: center; opacity: .7; font-size: 14px; text-align: center; padding: 0 30px; }
.ranges { display: flex; justify-content: space-between; padding: 10px 14px 4px; }
.ranges button { flex: 1; border: 0; background: transparent; color: #fff; font: inherit; font-size: 15px; padding: 9px 0; border-radius: 12px; cursor: pointer; }
.ranges button.on { background: rgba(255,255,255,.12); font-weight: 600; }

/* ---------- body ---------- */
.chips { display: flex; gap: 10px; padding: 22px 20px 6px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; display: inline-flex; gap: 8px; align-items: center; border: 1.5px solid var(--violet); color: var(--violet); border-radius: 16px; padding: 13px 18px; font-size: 16px; text-decoration: none; background: transparent; }

.promo { margin: 18px 20px 0; border-radius: var(--radius); aspect-ratio: 3 / 4; max-height: 520px; width: calc(100% - 40px); position: relative; overflow: hidden; color: #fff; background: linear-gradient(160deg, #ffb38a, #ff6fa8 45%, #7a4be0); box-shadow: 0 18px 40px -18px rgba(90, 30, 160, .55); }
.promo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.promo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(40,10,90,.42) 0%, rgba(40,10,90,0) 36%, rgba(40,10,90,0) 72%, rgba(30,6,70,.7) 100%); }
.promo .copy { position: absolute; left: 22px; right: 22px; top: 22px; z-index: 1; }
.promo h2 { margin: 0; font-size: clamp(32px, 10vw, 42px); line-height: 1.02; font-weight: 600; letter-spacing: -.03em; text-shadow: 0 2px 18px rgba(40,10,90,.35); }
.promo h2 span { font-family: "Playfair Display", Georgia, serif; font-style: italic; font-weight: 600; letter-spacing: -.01em; }
.promo .foot-copy { position: absolute; left: 18px; right: 18px; bottom: 18px; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.promo .tag { background: rgba(255,255,255,.92); color: var(--violet); padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.promo p { margin: 0; font-size: 15px; opacity: .95; }
.promo .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; opacity: .9; }

.cashcard { border-radius: var(--radius); padding: 22px 20px; color: #3b1d00; background: radial-gradient(260px 160px at 100% 0%, rgba(255,255,255,.55), transparent 70%), linear-gradient(135deg, #ffe08a 0%, #ffb38a 55%, #ff8fb3 100%); box-shadow: 0 18px 40px -20px rgba(255, 120, 80, .7); }
.cashcard .k { font-size: 14px; opacity: .8; }
.cashbig { font-size: clamp(34px, 11vw, 44px); font-weight: 600; letter-spacing: -.03em; margin: 4px 0 10px; }
.cashcard .interest { font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cashcard .interest b { font-variant-numeric: tabular-nums; font-weight: 700; }
.live { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: rgba(255,255,255,.55); padding: 3px 8px; border-radius: 999px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #12b886; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.cash-sub { font-size: 13px; opacity: .8; margin-top: 8px; }

.section { padding: 34px 20px 0; scroll-margin-top: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 32px; font-weight: 500; letter-spacing: -.03em; }
.section-head a, .section-head span { color: var(--violet); font-size: 16px; text-decoration: none; }
.kind { color: var(--muted); font-size: 14px; letter-spacing: .04em; text-transform: uppercase; margin: 22px 0 12px; }

.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 16px 14px; border-top: 1px solid var(--hair); }
.row:first-child { border-top: 0; }
.logo { --logo: #888; width: 46px; height: 46px; border-radius: 50%; flex: none; position: relative; background: var(--logo); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; overflow: hidden; }
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 6px; }
.logo.cash { background: linear-gradient(135deg, var(--gold), #f59f00); font-size: 20px; }
.row .main { flex: 1; min-width: 0; }
.row .name { font-size: 16px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .sub { color: var(--muted); font-size: 14px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .right { text-align: right; flex: none; }
.row .val { font-size: 17px; font-weight: 600; }
.pl { font-size: 13px; margin-top: 3px; display: inline-flex; gap: 3px; align-items: center; }
.pl.up { color: var(--up); }
.pl.down { color: var(--down); }
.pl.flat { color: var(--muted); }
.arr { width: 12px; height: 12px; }

.treats .list { padding: 6px 0; }
.treat { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.treat .emo { width: 46px; height: 46px; border-radius: 14px; background: var(--violet-soft); display: grid; place-items: center; font-size: 24px; flex: none; }
.treat .main { flex: 1; }
.treat .count { font-weight: 600; font-size: 17px; }
.bar { height: 6px; border-radius: 999px; background: #f0eef7; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--violet)); }
.note { color: var(--muted); font-size: 14px; padding: 14px 4px 0; line-height: 1.45; }

.foot { color: var(--muted); font-size: 13px; text-align: center; padding: 34px 28px 0; line-height: 1.6; }
.row .val.pl { font-size: 15px; font-weight: 600; }

/* ---------- nav ---------- */
.app { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); width: min(448px, calc(100% - 32px)); display: flex; align-items: center; gap: 12px; z-index: 10; }
.nav .bar-wrap { flex: 1; height: 66px; border-radius: 999px; background: var(--nav); display: flex; justify-content: space-around; align-items: center; box-shadow: 0 10px 30px -8px rgba(17,26,53,.5); }
.nav .bar-wrap a { color: #c9cde0; display: grid; place-items: center; width: 52px; height: 52px; position: relative; }
.nav .bar-wrap a.on { color: #fff; }
.nav .bar-wrap a.on::after { content: ""; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.fab { width: 66px; height: 66px; border-radius: 50%; background: var(--violet); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 30px -6px rgba(106,0,255,.6); flex: none; }

/* ---------- money rain ---------- */
.rain { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.rain span { position: absolute; top: -40px; font-size: 26px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(260deg); opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .rain { display: none; } html { scroll-behavior: auto; } }

/* ---------- admin + login ---------- */
.admin { max-width: 980px; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top)) 16px calc(60px + env(safe-area-inset-bottom)); }
body:has(.admin) { background: var(--bg); }
body:has(.admin)::before { display: none; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-top h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.admin-top .links { display: flex; gap: 10px; align-items: center; }
.btn { appearance: none; border: 0; border-radius: 12px; padding: 11px 16px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; background: var(--violet); color: #fff; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.btn.ghost { background: var(--violet-soft); color: var(--violet); }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn.danger { background: #fdecea; color: #c92a2a; }
.btn:disabled { opacity: .55; cursor: progress; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); margin-top: 18px; }
.card { background: var(--card); border-radius: 18px; padding: 18px; }
.card h2 { margin: 0 0 12px; font-size: 18px; letter-spacing: -.01em; }
.card h2 small { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 45%), 1fr)); gap: 10px; margin-top: 16px; }
@media (max-width: 480px) { .stat .v { font-size: 18px; } .card { padding: 16px; } .admin-top h1 { font-size: 21px; } }
.stat { background: var(--card); border-radius: 16px; padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 22px; font-weight: 600; margin-top: 4px; letter-spacing: -.02em; }
.stat .v.up { color: var(--up); } .stat .v.down { color: var(--down); }
.recon { font-size: 14px; line-height: 1.9; }
.recon .eq { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.recon .ok { color: var(--up); font-weight: 600; }
.recon .bad { color: #c92a2a; font-weight: 600; }
form.f { display: grid; gap: 10px; }
.f .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.f input, .f select, .f textarea { font: inherit; font-size: 16px; color: var(--ink); border: 1.5px solid var(--hair); border-radius: 11px; padding: 10px 12px; background: #fbfbfe; width: 100%; min-width: 0; }
.f input:focus, .f select:focus { outline: none; border-color: var(--violet); background: #fff; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; }
.seg label { flex: 1; text-align: center; padding: 8px; border-radius: 9px; cursor: pointer; color: var(--ink); font-size: 14px; display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.quote { font-size: 13px; color: var(--muted); min-height: 18px; }
.quote.ok { color: var(--up); }
.quote.err { color: #c92a2a; }
.hint { font-size: 13px; color: var(--muted); }
.flash { margin-top: 16px; padding: 12px 16px; border-radius: 12px; font-size: 15px; }
.flash.ok { background: #e6fcf5; color: #087f5b; }
.flash.err { background: #fff0f0; color: #c92a2a; }
.flash.warn { background: #fff4e6; color: #a64b00; }
.pf-switch { margin-top: 16px; max-width: 420px; }
.pf-switch a { flex: 1; text-align: center; padding: 10px; border-radius: 9px; text-decoration: none; color: var(--ink); font-size: 15px; }
.pf-switch a.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.row.detail { padding-top: 0; border-top: 0; flex-wrap: wrap; }
.inline.wrap { flex-wrap: wrap; }
.photo-now { position: relative; }
.photo-now img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; display: block; }
.photo-now .av { position: absolute; left: 12px; bottom: 12px; width: 64px; height: 64px; aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff; }
#cropCanvas { width: 100%; border-radius: 12px; touch-action: none; cursor: crosshair; display: block; }
.crop-previews { display: flex; gap: 12px; align-items: flex-end; }
.crop-previews canvas { border-radius: 12px; }
.crop-previews canvas + canvas { border-radius: 50%; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 6px; border-bottom: 1px solid var(--hair); }
.t td { padding: 10px 6px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.t td.n, .t th.n { text-align: right; white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; }
details.edit summary { cursor: pointer; color: var(--violet); font-size: 13px; list-style: none; }
details.edit summary::-webkit-details-marker { display: none; }
details.edit[open] { background: var(--bg); border-radius: 12px; padding: 10px; }
details.edit form { margin-top: 10px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--violet-soft); color: var(--violet); }
.badge.error { background: #fff0f0; color: #c92a2a; }
.badge.ok { background: #e6fcf5; color: #087f5b; }
.badge.partial { background: #fff4e6; color: #d9480f; }
.inline { display: flex; gap: 6px; align-items: center; }
.inline input { width: 110px; }
.wide { grid-column: 1 / -1; }

body.login::before { display: none; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(180deg, var(--hero-a), var(--hero-c)); }
.login .card { width: min(380px, 100%); padding: 26px; }
.login h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.login p { margin: 0 0 18px; color: var(--muted); }

/* gold, wishlist, gift form */
.logo.metal { background: radial-gradient(circle at 30% 30%, #fff3b0, #f5c451 45%, #c98a00); font-size: 22px; }
.hero-short { padding-bottom: 22px; }
.wish-intro { margin: 14px 20px 0; font-size: 15px; line-height: 1.45; opacity: .92; }
.wish-form { margin-top: 0; }
.wish-note { font-size: 14px; color: #4a4f66; margin-top: 4px; white-space: pre-wrap; line-height: 1.4; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.f textarea { resize: vertical; }
.check { display: flex !important; gap: 10px; align-items: flex-start; color: var(--ink) !important; font-size: 14px !important; line-height: 1.35; }
.check input { width: auto !important; margin-top: 2px; }
.section-head a { color: var(--violet); font-size: 16px; text-decoration: none; }
