:root {
  --gold: #c9a227;
  --gold-d: #a8820f;
  --gold-l: #fdf3d3;
  --bg: #f4f2f7;
  --card: #fff;
  --text: #111;
  --muted: #8a8a93;
  --green: #3fb36b;
  --red: #e2463f;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* Lock */
.lock { position: fixed; inset: 0; background: linear-gradient(180deg, #fff8e1, var(--bg)); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.lock-logo img { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 8px 24px rgba(201,162,39,.35); }
.lock-title { font-size: 22px; font-weight: 700; margin-top: 18px; }
.lock-sub { color: var(--muted); font-size: 14px; min-height: 20px; margin-top: 4px; text-align: center; }
.dots { display: flex; gap: 18px; margin: 26px 0 10px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--gold); }
.dots i.on { background: var(--gold); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.lock-err { color: var(--red); font-size: 14px; min-height: 20px; text-align: center; }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 26px; margin-top: 18px; }
.keypad button { width: 76px; height: 76px; border-radius: 50%; background: #fff; font-size: 28px; font-weight: 500; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.keypad button:active { background: var(--gold-l); }
.keypad button.ghost { background: none; box-shadow: none; font-size: 16px; color: var(--muted); }

/* Layout */
.app { min-height: 100vh; }
main { padding: calc(var(--safe-t) + 14px) 18px calc(110px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 26px 26px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.06); display: flex; padding: 10px 6px calc(10px + var(--safe-b)); z-index: 10; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #6f7280; font-size: 14px; }
.tabbar svg { width: 28px; height: 28px; fill: currentColor; }
.tabbar svg[fill="none"] { fill: none; }
.tabbar button.active { color: var(--gold); }

.header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.header img { width: 54px; height: 54px; border-radius: 16px; }
.header h1 { font-size: 22px; margin: 0; }
.header .sub { color: var(--muted); font-style: italic; font-size: 14px; }
.header .spacer { flex: 1; }
.page-title { font-size: 30px; font-weight: 800; margin: 6px 0 18px; }

.hero { background: linear-gradient(135deg, #fde9a9, #f6d071 60%, #eab54a); border-radius: 22px; padding: 22px 20px; box-shadow: 0 10px 26px rgba(232,181,74,.35); }
.hero .row { display: flex; justify-content: space-between; align-items: center; }
.hero .label { font-size: 16px; }
.hero .total { font-size: 36px; font-weight: 800; margin: 4px 0 16px; letter-spacing: -.5px; }
.hero .eye { width: 32px; height: 32px; }
.goal { background: rgba(255,255,255,.65); border-radius: 14px; padding: 14px 16px; }
.goal .row { font-weight: 600; font-size: 15px; }
.goal .row b { color: var(--gold-d); }
.bar { height: 6px; background: #e8e2d2; border-radius: 6px; margin: 10px 0 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--gold); border-radius: 6px; }
.goal .pct { color: var(--muted); font-size: 14px; font-weight: 600; }

.section-h { display: flex; justify-content: space-between; align-items: center; margin: 26px 0 14px; }
.section-h h2 { font-size: 22px; margin: 0; }
.pill { border: 1.5px solid var(--gold); background: var(--gold-l); color: var(--gold-d); border-radius: 20px; padding: 6px 16px; font-weight: 600; font-size: 15px; }
.pill.solid { background: var(--gold); color: #fff; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.cat { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; }
.cat .ic { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-size: 30px; flex-shrink: 0; }
.cat .info { flex: 1; min-width: 0; }
.cat .name { font-size: 18px; }
.cat .val { color: #555; font-size: 17px; margin-top: 2px; }
.cat .chev, .chev { color: #b0b0b8; font-size: 22px; }
.cat .pl { font-size: 13px; font-weight: 600; }
.up { color: var(--green); }
.down { color: var(--red); }

.back { display: flex; align-items: center; gap: 8px; font-size: 17px; color: var(--gold-d); margin-bottom: 10px; font-weight: 600; }
.item { display: flex; justify-content: space-between; gap: 10px; }
.item .t { font-weight: 600; }
.item .s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.item .r { text-align: right; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 50px 10px; }
.fab { position: fixed; right: 22px; bottom: calc(100px + var(--safe-b)); width: 58px; height: 58px; border-radius: 50%; background: var(--gold); color: #fff; font-size: 32px; box-shadow: 0 6px 18px rgba(201,162,39,.5); z-index: 9; }

/* Segmented */
.seg { display: flex; background: #fff; border-radius: 16px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 10px; border-radius: 12px; color: #777; font-weight: 600; font-size: 17px; }
.seg button.on { background: #f3edd9; color: var(--gold-d); box-shadow: inset 0 -3px 0 var(--gold); }

/* Market */
.search { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.search input { flex: 1; border: 1px solid #ddd; border-radius: 26px; padding: 12px 18px; background: #fff; outline: none; }
.search .add { width: 48px; height: 48px; border-radius: 50%; background: var(--gold); color: #fff; font-size: 28px; flex-shrink: 0; }
.mh { display: grid; grid-template-columns: 1fr 92px 92px 26px; color: var(--muted); padding: 0 16px 8px; font-size: 15px; }
.mrow { display: grid; grid-template-columns: 1fr 92px 92px 26px; align-items: center; width: 100%; text-align: left; }
.mrow .b { font-weight: 600; font-size: 16px; }
.chip { display: inline-block; background: #f0f0f2; color: #777; font-size: 12px; font-weight: 600; border-radius: 10px; padding: 2px 8px; margin-top: 4px; }
.mrow .buy { color: var(--green); font-weight: 700; font-size: 17px; }
.mrow .sell { color: var(--red); font-weight: 700; font-size: 17px; }
.star { font-size: 20px; color: #bbb; }
.star.on { color: var(--gold); }
.note-s { color: var(--muted); font-size: 13px; margin: -4px 4px 12px; }
.world-big { font-size: 28px; font-weight: 800; color: var(--gold); }
.tv { height: 420px; border-radius: 14px; overflow: hidden; margin: 0 -6px; }

/* Settings */
.list { background: #fff; border-radius: var(--radius); padding: 4px 16px; margin-bottom: 18px; }
.li { display: flex; align-items: center; gap: 14px; padding: 12px 0; width: 100%; text-align: left; border-bottom: 1px solid #eee; }
.li:last-child { border-bottom: 0; }
.li .ico { width: 42px; height: 42px; border-radius: 12px; border: 1.5px solid var(--gold); background: var(--gold-l); display: grid; place-items: center; font-size: 20px; }
.li .lbl { flex: 1; font-size: 17px; }
.li .v { color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: 14px; margin-top: 10px; }

/* Stats */
.donut { display: block; margin: 6px auto 18px; }
.legend .lg { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.legend .lg:last-child { border: 0; }
.legend .sw { width: 14px; height: 14px; border-radius: 4px; }
.legend .n { flex: 1; }
.legend .p { color: var(--muted); width: 56px; text-align: right; }

/* Sheet */
.sheet { position: fixed; inset: 0; z-index: 30; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.sheet-body { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow: auto; background: #f7f6fa; border-radius: 22px 22px 0 0; padding: 18px 18px calc(24px + var(--safe-b)); max-width: 640px; margin: 0 auto; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.sheet h3 { margin: 4px 0 16px; font-size: 20px; text-align: center; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14px; color: #666; margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #ddd; border-radius: 12px; padding: 12px 14px; background: #fff; outline: none; font-size: 16px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btns { display: flex; gap: 10px; margin-top: 16px; }
.btn { flex: 1; padding: 14px; border-radius: 14px; background: var(--gold); color: #fff; font-weight: 700; font-size: 16px; }
.btn.sec { background: #e9e7ee; color: #333; }
.btn.danger { background: #fde8e7; color: var(--red); }

.toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: rgba(30,30,30,.92); color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }
