:root {
  --ink: #1B1F2A;
  --ink-2: #2A2F3C;
  --ink-3: #3A4050;
  --bg: #F1F4EC;
  --card: #FFFFFF;
  --line: #E6EAE0;
  --muted: #6B7280;
  --lime: #8DC63F;
  --lime-d: #4E7F12;
  --lime-soft: #E7F3D6;
  --amber: #FFB37A;
  --amber-ink: #B4510C;
  --amber-soft: #FDF0E6;
  --radius: 22px;
  --c-quarterly: #7B2FBE; --c-monthly: #2E8B3A; --c-weekly: #EA7400; --c-social: #1E6FD9;
  --c-bachat: #D8156F; --c-apo: #0E8A8A; --c-voice: #4F46E5; --c-other: #64748B;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body { overscroll-behavior-y: contain; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input { font: inherit; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: calc(84px + var(--safe-bot)); }
.num { font-variant-numeric: tabular-nums; }

/* splash */
.splash { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.logo-tile { width: 56px; height: 56px; border-radius: 16px; background: var(--lime); color: var(--ink); display: grid; place-items: center; flex: none; }
.logo-tile.sm { width: 46px; height: 46px; border-radius: 14px; }

/* header */
.top { background: var(--ink); color: #fff; padding: calc(18px + var(--safe-top)) 18px 22px; border-radius: 0 0 28px 28px; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 21px; margin: 0; letter-spacing: -.01em; }
.brand p { margin: 2px 0 0; font-size: 13.5px; color: #B9BFCC; white-space: nowrap; }
.brand h1 { white-space: nowrap; }
.icon-btn.install-ic { background: var(--lime); color: var(--ink); }
.brand .grow { flex: 1; min-width: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--ink-3); display: grid; place-items: center; color: #fff; flex: none; }
.icon-btn.light { background: #fff; color: var(--ink); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.install-pill { background: var(--lime); color: var(--ink); font-weight: 700; font-size: 13px; padding: 9px 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; flex: none; }
.pills { display: flex; gap: 8px; margin-top: 16px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pills::-webkit-scrollbar { display: none; }
.pill { white-space: nowrap; padding: 10px 16px; border-radius: 999px; background: var(--ink-3); color: #fff; font-size: 14.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.pill.on { background: var(--lime); color: var(--ink); }
.pill.locked { opacity: .55; }
.pill svg { opacity: .8; }

/* layout */
main { padding: 16px 16px 8px; }
.section-h { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 4px 12px; }
.section-h h2 { font-size: 19px; margin: 0; letter-spacing: -.01em; }
.link { color: var(--lime-d); font-weight: 700; font-size: 14.5px; }
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 2px rgba(20,30,10,.04); }

/* hero */
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--lime-d); }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tag { font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: var(--lime-soft); color: var(--lime-d); white-space: nowrap; }
.hero h3 { font-size: 30px; margin: 10px 0 2px; letter-spacing: -.02em; line-height: 1.1; word-break: break-word; }
.price { color: var(--muted); font-size: 15px; }
.big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 14px 0 16px; }
.big b { font-size: 52px; letter-spacing: -.03em; line-height: 1; font-weight: 800; }
.big span { color: var(--muted); font-size: 14px; }
.target { display: flex; align-items: center; gap: 10px; background: var(--amber-soft); border-radius: 16px; padding: 12px 14px; }
.target .t-l { flex: 1; min-width: 0; }
.target small { display: block; color: var(--amber-ink); font-size: 12.5px; font-weight: 600; }
.target strong { font-size: 15px; display: block; overflow-wrap: anywhere; }
.chip-up { background: #fff; color: var(--amber-ink); font-weight: 700; font-size: 13.5px; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.chip-ok { background: var(--lime-soft); color: var(--lime-d); font-weight: 700; font-size: 13px; padding: 6px 11px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.chip-tgt { background: var(--amber-soft); color: var(--amber-ink); font-weight: 700; font-size: 12.5px; padding: 5px 10px; border-radius: 999px; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target.ok { background: var(--lime-soft); }
.target.ok small { color: var(--lime-d); }

/* dark hero */
.hero.dark { background: var(--ink); color: #fff; }
.hero.dark .price, .hero.dark .big span { color: #B9BFCC; }
.hero.dark .big b { color: var(--lime); }
.hero.dark .target { background: var(--ink-2); }
.hero.dark .target small { color: var(--amber); }
.hero.dark .chip-up { background: var(--amber); color: var(--ink); }
.hero.dark .target.ok { background: var(--ink-2); }
.hero.dark .target.ok small { color: var(--lime); }

/* category cards */
.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.ccard { scroll-snap-align: start; flex: 0 0 78%; max-width: 300px; text-align: left; background: var(--card); border-radius: var(--radius); padding: 18px; border-top: 5px solid var(--acc); display: flex; flex-direction: column; gap: 4px; }
.ccard .cat { color: var(--acc); font-size: 12.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.ccard .nm { font-size: 18px; font-weight: 700; margin-top: 6px; overflow-wrap: anywhere; }
.ccard .val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 6px; }
.ccard .mini { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 5px; font-size: 13px; }
.ccard .mini div { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.ccard .mini div span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard .mini b { color: var(--ink); font-weight: 600; }
.ccard.empty .nm { color: var(--muted); font-weight: 500; }

/* ranked list */
.list { background: var(--card); border-radius: var(--radius); padding: 6px 18px; }
.row { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.rank { width: 38px; height: 38px; border-radius: 50%; background: #EEF1EA; display: grid; place-items: center; font-weight: 700; flex: none; }
.rank.first { background: var(--lime); }
.row .mid { flex: 1; min-width: 0; }
.row .mid b { display: block; font-size: 16.5px; overflow-wrap: anywhere; }
.row .mid small { color: var(--muted); font-size: 13.5px; }
.row .right { text-align: right; display: grid; justify-items: end; gap: 5px; max-width: 48%; }
.row .right b { font-size: 17px; }
.bar { height: 8px; background: #EEF1EA; border-radius: 99px; margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--acc, var(--lime)); border-radius: 99px; }
.row.stack { display: block; }
.row.stack .line1 { display: flex; align-items: center; gap: 14px; }

/* subpage header */
.subhead { display: flex; align-items: center; gap: 10px; padding: calc(16px + var(--safe-top)) 16px 4px; }
.subhead .grow { flex: 1; min-width: 0; }
.subhead h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.subhead p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; padding: 10px 18px; border-radius: 999px; border: 1.5px solid #D9DED2; background: #fff; font-weight: 600; font-size: 15px; }
.chip.on { background: var(--acc, var(--lime)); border-color: var(--acc, var(--lime)); color: #fff; }
.chip.dark.on { background: var(--ink); border-color: var(--ink); }
.chip:disabled { opacity: .4; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #E6EBDF; border-radius: 16px; padding: 5px; }
.seg button { padding: 12px; border-radius: 12px; font-weight: 600; color: var(--muted); font-size: 15.5px; }
.seg button.on { background: var(--lime); color: var(--ink); }
.seg.white button.on { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.seg button:disabled { opacity: .45; }

.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 17px; border-radius: 999px; font-weight: 700; font-size: 17px; }
.btn.primary { background: var(--lime); color: var(--ink); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ghost { border: 1.5px solid #D9DED2; background: #fff; }
.btn:disabled { opacity: .6; }

/* bottom nav */
.nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 0 calc(8px + var(--safe-bot)); z-index: 10; }
.nav-inner { max-width: 560px; margin: 0 auto; display: contents; }
.nav button { display: grid; justify-items: center; gap: 3px; font-size: 12.5px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.nav button.on { color: var(--lime-d); }

/* sheet */
.scrim { position: fixed; inset: 0; background: rgba(15,18,25,.55); z-index: 30; animation: fade .2s ease; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; background: #fff; border-radius: 28px 28px 0 0; z-index: 31; max-height: 92vh; overflow-y: auto; padding: 10px 20px calc(20px + var(--safe-bot)); animation: up .25s cubic-bezier(.2,.8,.2,1); }
.grab { width: 44px; height: 5px; border-radius: 9px; background: #D9DED2; margin: 0 auto 12px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-h h2 { margin: 0; font-size: 26px; }
.close { width: 44px; height: 44px; border-radius: 50%; background: #F0F2EC; display: grid; place-items: center; }
.step { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 20px 0 10px; }
.wrapchips { display: flex; flex-wrap: wrap; gap: 8px; }
.wrapchips .chip { display: inline-flex; align-items: center; gap: 6px; }
.search { display: flex; align-items: center; gap: 10px; border: 2px solid var(--lime); border-radius: 18px; padding: 12px 14px; }
.search input { border: 0; outline: 0; flex: 1; font-size: 19px; min-width: 0; background: transparent; }
.crumb { color: var(--muted); font-size: 14px; margin: 8px 2px; }
.crumb b { color: var(--ink); }
.opts { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; margin-top: 8px; }
.opts button { display: flex; justify-content: space-between; width: 100%; text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 15px; gap: 8px; }
.opts button:last-child { border-bottom: 0; }
.opts button small { color: var(--muted); }
.opts button.on { background: var(--lime-soft); font-weight: 700; }
.recent { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: var(--muted); }
.recent button { background: var(--lime-soft); color: var(--lime-d); padding: 7px 13px; border-radius: 999px; font-weight: 700; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.8fr; gap: 12px; margin-top: 26px; }

/* login */
.login { min-height: 100vh; display: flex; flex-direction: column; }
.login .top { border-radius: 0 0 32px 32px; padding-bottom: 36px; position: static; }
.login .welcome { margin-top: 26px; }
.login .welcome h2 { font-size: 28px; margin: 0 0 6px; letter-spacing: -.02em; }
.login .welcome p { margin: 0; color: #B9BFCC; }
.login form { padding: 22px 18px; display: grid; gap: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); display: block; margin: 0 0 6px 4px; }
.field input { width: 100%; padding: 15px 16px; border-radius: 16px; border: 1.5px solid #D9DED2; background: #fff; font-size: 17px; outline: none; }
.field input:focus { border-color: var(--lime); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--lime-d); }
.err { background: #FDECEC; color: #B42318; padding: 12px 14px; border-radius: 14px; font-size: 14.5px; }
.install-card { margin: 0 18px 20px; background: #fff; border-radius: 20px; padding: 16px; display: flex; gap: 14px; align-items: center; }
.install-card p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.install-card .grow { flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 8px 20px 24px; margin-top: auto; }

/* profile */
.kv { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { text-align: right; overflow-wrap: anywhere; }
.stack-gap { display: grid; gap: 12px; margin-top: 16px; }
.empty-state { text-align: center; padding: 30px 20px; color: var(--muted); }
.empty-state b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.offline { background: #FFF4DB; color: #7A5300; font-size: 13px; text-align: center; padding: 6px; }
.ios-steps { display: grid; gap: 12px; margin: 10px 0 4px; font-size: 16px; }
.ios-steps div { display: flex; gap: 12px; align-items: center; }
.ios-steps i { font-style: normal; width: 30px; height: 30px; border-radius: 50%; background: var(--lime-soft); color: var(--lime-d); display: grid; place-items: center; font-weight: 800; flex: none; }

#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bot)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14.5px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
.spin { width: 18px; height: 18px; border: 2.5px solid rgba(0,0,0,.2); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 560px) { .ccard { flex-basis: 46%; } }
