:root {
  --bg: #f2f5f4; --card: #ffffff; --card-2: #f6f8f7; --text: #0f1a19; --muted: #66716f; --faint: #98a2a0;
  --line: #e4e9e8; --brand: #0b5d55; --brand-ink: #ffffff; --brand-soft: rgba(255,255,255,.14);
  --pos: #12805c; --neg: #c2410c; --focus: #0f766e;
  --t-green-bg: #dff3e9; --t-green: #0e6b48; --t-teal-bg: #d9f1ee; --t-teal: #0b5d55;
  --t-blue-bg: #e1ecfb; --t-blue: #1d4f91; --t-amber-bg: #fbefd6; --t-amber: #8a5300;
  --t-coral-bg: #fbe6de; --t-coral: #9a3412; --t-purple-bg: #ebe8fb; --t-purple: #4c3fa3;
  --t-pink-bg: #fae4ec; --t-pink: #962f57; --t-gray-bg: #eceeed; --t-gray: #4b5553;
  --shadow: 0 1px 2px rgba(15,26,25,.05), 0 6px 18px rgba(15,26,25,.06);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1110; --card: #141c1b; --card-2: #1a2423; --text: #e7eeec; --muted: #94a19f; --faint: #6c7876;
    --line: #23302e; --brand: #0d3f3a; --brand-soft: rgba(255,255,255,.08);
    --pos: #4ade9c; --neg: #fb8b5b; --focus: #2dd4bf;
    --t-green-bg: #12352a; --t-green: #7fe0b3; --t-teal-bg: #0f3532; --t-teal: #6fdccd;
    --t-blue-bg: #172b47; --t-blue: #9cc3f5; --t-amber-bg: #3a2a0c; --t-amber: #f4c46b;
    --t-coral-bg: #3d1c12; --t-coral: #f8a98a; --t-purple-bg: #251f4a; --t-purple: #b9b0f5;
    --t-pink-bg: #3a1726; --t-pink: #f2a5c2; --t-gray-bg: #222c2b; --t-gray: #b4bfbd;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif; }
body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
.ic { flex: none; display: block; }
.app { max-width: 560px; margin: 0 auto; }
.num, .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.muted { color: var(--muted); font-size: 13px; }
.hide .amt { filter: blur(7px); }

/* hero */
.hero { background: var(--brand); color: var(--brand-ink); padding: calc(14px + env(safe-area-inset-top)) 20px 58px;
  border-radius: 0 0 28px 28px; }
.hero .bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.hero .hello { font-size: 15px; opacity: .85; }
.hero .label { font-size: 13px; opacity: .8; }
.hero .total { font-size: 36px; font-weight: 700; letter-spacing: -1px; margin: 2px 0 4px; }
.hero .sub { font-size: 13px; opacity: .8; }
.hero .pills { display: flex; gap: 8px; overflow-x: auto; margin: 14px -20px 0; padding: 0 20px; scrollbar-width: none; }
.hero .pills::-webkit-scrollbar { display: none; }
.hero .pill { background: var(--brand-soft); border-radius: 12px; padding: 7px 11px; font-size: 12px; white-space: nowrap; }
.hero .pill b { display: block; font-size: 14px; font-weight: 600; }
.iconbtn { background: var(--brand-soft); color: inherit; border: 0; width: 38px; height: 38px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.page-head { padding: calc(16px + env(safe-area-inset-top)) 20px 6px; display: flex; align-items: center; justify-content: space-between; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.5px; }
.page-head .iconbtn { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* layout */
.wrap { padding: 0 16px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: -40px 16px 0; position: relative; }
.tile { background: var(--card); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); }
.tile .ib { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 16px; font-weight: 650; margin-top: 1px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 4px 10px; }
.sec h2 { margin: 0; font-size: 17px; letter-spacing: -.2px; }
.sec button { border: 0; background: none; color: var(--focus); font: inherit; font-size: 14px; cursor: pointer; padding: 0; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 16px; }
.card.pad { padding: 16px; }
.scroller { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.due { min-width: 240px; flex: 1; scroll-snap-align: start; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.due .top { display: flex; gap: 12px; align-items: center; }
.due .amount { font-size: 20px; font-weight: 650; margin: 10px 0 6px; }

/* list rows */
.item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer; }
.item:first-child { border-top: 0; }
.item .mid { flex: 1; min-width: 0; }
.item .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .r { text-align: right; font-weight: 600; }
.item .r .s { font-weight: 400; }
.av { width: 40px; height: 40px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none;
  font-size: 13px; font-weight: 650; letter-spacing: .3px; }
.av.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 17px; }
.av.sm { width: 30px; height: 30px; border-radius: 10px; }
.green { background: var(--t-green-bg); color: var(--t-green); } .teal { background: var(--t-teal-bg); color: var(--t-teal); }
.blue { background: var(--t-blue-bg); color: var(--t-blue); } .amber { background: var(--t-amber-bg); color: var(--t-amber); }
.coral { background: var(--t-coral-bg); color: var(--t-coral); } .purple { background: var(--t-purple-bg); color: var(--t-purple); }
.pink { background: var(--t-pink-bg); color: var(--t-pink); } .gray { background: var(--t-gray-bg); color: var(--t-gray); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }

/* progress and bars */
.prog { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; margin-top: 10px; }
.prog i { display: block; height: 100%; border-radius: 3px; background: var(--pos); }
.stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; margin: 4px 0 12px; }
.stack i { display: block; height: 100%; }
.stack i.green { background: var(--t-green); } .stack i.teal { background: var(--t-teal); } .stack i.blue { background: var(--t-blue); }
.stack i.amber { background: var(--t-amber); } .stack i.coral { background: var(--t-coral); } .stack i.purple { background: var(--t-purple); }
.stack i.pink { background: var(--t-pink); } .stack i.gray { background: var(--t-gray); }
.catbar { height: 4px; border-radius: 2px; margin-top: 6px; background: currentColor; opacity: .55; }

/* month chips, segmented */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 16px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 0; background: var(--card); color: var(--text); box-shadow: var(--shadow); border-radius: 999px;
  padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.chips button.on { background: var(--brand); color: #fff; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card-2); border-radius: 12px; padding: 3px; margin: 14px 0 10px; }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 8px 4px; border-radius: 10px; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); text-align: left; gap: 6px; }
.summary .k { font-size: 12px; color: var(--muted); }
.summary .v { font-size: 18px; font-weight: 650; }
.chart { display: flex; align-items: flex-end; gap: 5px; height: 96px; margin-top: 16px; }
.chart .m { flex: 1; display: flex; gap: 2px; align-items: flex-end; height: 100%; cursor: pointer; border-radius: 6px; padding: 0 1px; }
.chart .m.on { background: var(--card-2); }
.chart .m i { flex: 1; border-radius: 3px 3px 1px 1px; background: var(--t-green); opacity: .8; min-height: 2px; }
.chart .m i.o { background: var(--t-coral); }
.chart-l { display: flex; gap: 5px; margin-top: 4px; }
.chart-l span { flex: 1; text-align: center; font-size: 10.5px; color: var(--faint); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* grids */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.goods { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 14px; cursor: pointer; }
.goods .n { font-weight: 600; margin: 10px 0 2px; line-height: 1.25; }
.goods .p { font-weight: 650; }

/* nudge, banners */
.nudge { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; cursor: pointer; }
.banner { display: flex; gap: 10px; align-items: flex-start; background: var(--t-amber-bg); color: var(--t-amber); border-radius: 14px;
  padding: 12px 14px; font-size: 14px; margin: 16px 16px 0; }

/* forms and buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border: 0; cursor: pointer;
  border-radius: 14px; padding: 12px 16px; background: var(--card-2); color: var(--text); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.block { width: 100%; }
.btn.ghost { background: none; color: var(--focus); padding: 8px; }
input, select { font: inherit; width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text); margin: 6px 0 12px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
label.f { font-size: 13px; color: var(--muted); font-weight: 500; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.quick button { border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 13px;
  padding: 6px 10px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }

/* bottom nav */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
.tabs .in { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 560px; }
.tabs button { border: 0; background: none; color: var(--faint); font: inherit; font-size: 11px; font-weight: 500; padding: 4px 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; position: relative; }
.tabs button .pillbg { padding: 4px 16px; border-radius: 999px; }
.tabs button.on { color: var(--text); }
.tabs button.on .pillbg { background: var(--t-teal-bg); color: var(--t-teal); }
.tabs b { position: absolute; top: 0; left: calc(50% + 8px); background: var(--neg); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 5px; }
.tabs b:empty { display: none; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(5,12,11,.45); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out; }
.sheet[hidden] { display: none; }
.sheet-body { background: var(--card); width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; border-radius: 26px 26px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet-head { text-align: center; margin-bottom: 14px; }
.sheet-head .av { margin: 0 auto 10px; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.sheet-head .big { font-size: 30px; font-weight: 700; letter-spacing: -.6px; margin: 6px 0 2px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; overflow-wrap: anywhere; }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions .btn { flex: 1; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.empty { text-align: center; color: var(--muted); padding: 22px 8px; font-size: 14px; }
.foot { text-align: center; color: var(--faint); font-size: 12px; margin: 24px 0 8px; display: flex; gap: 6px; align-items: center; justify-content: center; }

/* lock screen */
.hero.lock { text-align: center; padding-top: calc(70px + env(safe-area-inset-top)); padding-bottom: 46px; }
.lockmark { width: 76px; height: 76px; border-radius: 24px; background: var(--brand-soft); display: flex; align-items: center;
  justify-content: center; margin: 0 auto 18px; }
.btn:disabled { opacity: .6; cursor: default; }

.tabs:empty { display: none; }
