:root {
  --bg: #000; --surface: #121212; --surface2: #1c1c1e; --line: #2a2a2c;
  --text: #fff; --muted: #8e8e93; --muted2: #636366;
  --up: #5fd38d; --down: #f2826f; --warn: #ffd666; --accent: #fff;
  --radius: 22px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
.num, .balance, .h-price, .row .r, .kv .v, .change { font-variant-numeric: tabular-nums; }
#app { max-width: 560px; margin: 0 auto; }

.view { display: none; padding: calc(var(--sat) + 6px) 18px 0; min-height: 100vh; }
.view.active { display: block; }
.spacer { height: calc(110px + var(--sab)); }

/* top bar */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 52px; }
.topbar .title { font-size: 18px; font-weight: 600; margin: 0; text-align: center; }
.topbar > :last-child { justify-self: end; }
.pill-status { justify-self: start; display: inline-flex; gap: 6px; align-items: center; padding: 7px 11px; border-radius: 99px; background: var(--surface2); font-size: 12.5px; color: var(--muted); max-width: 44vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted2); flex: none; }
.pill-status.ok .dot { background: var(--up); } .pill-status.warn .dot { background: var(--warn); } .pill-status.bad .dot { background: var(--down); }
.mode-badge { font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 5px 9px; border-radius: 8px; background: var(--warn); color: #000; }
.mode-badge:empty { display: none; }
.demo-banner { margin: 4px 0 0; padding: 10px 12px; border-radius: 14px; background: rgba(255,214,102,.12); color: var(--warn); font-size: 13.5px; }
.demo-banner button { color: var(--text); text-decoration: underline; font-size: 13.5px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--surface2); font-size: 28px; line-height: 40px; }
.icon-btn.small { font-size: 20px; }
.topbar.sub { grid-template-columns: 52px 1fr 52px; }
.sub-title { text-align: center; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* hero */
.hero { text-align: center; padding: 26px 0 6px; }
.hero-label { color: var(--muted); font-size: 13.5px; min-height: 18px; }
.balance { font-size: clamp(34px, 11.5vw, 50px); font-weight: 700; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; }
.balance .cur { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.change { font-size: 16px; font-weight: 600; margin-top: 4px; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.chart-wrap { margin: 10px -18px 0; }
.chart { display: block; width: 100%; height: 250px; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ranges { display: flex; justify-content: space-between; gap: 2px; margin: 8px -6px 0; }
.ranges button { flex: 1; padding: 9px 0; border-radius: 99px; font-size: 14px; font-weight: 600; color: var(--muted); }
.ranges button.on { background: var(--surface2); color: var(--text); }
.note { color: var(--muted); font-size: 12.5px; margin: 10px 2px 0; line-height: 1.45; }
.note b { color: var(--warn); font-weight: 600; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-top: 18px; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { color: var(--muted); margin: 0 0 14px; font-size: 14.5px; }
.card:empty { display: none; }
.empty .btn { width: 100%; margin-top: 8px; }
.summary .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.summary .k { color: var(--muted); font-size: 12.5px; }
.summary .v { font-weight: 650; font-size: 16px; margin-top: 2px; white-space: nowrap; }
.summary .foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.link { color: var(--text); text-decoration: underline; text-underline-offset: 3px; font-size: 13.5px; }
.accounts { display: flex; gap: 10px; overflow-x: auto; margin: 14px -18px 0; padding: 0 18px 4px; scrollbar-width: none; }
.accounts::-webkit-scrollbar { display: none; }
.acct { flex: 0 0 auto; min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 13px 15px; }
.acct .n { color: var(--muted); font-size: 14px; } .acct .v { font-size: 19px; font-weight: 650; margin: 4px 0 10px; white-space: nowrap; } .acct .c { font-size: 13.5px; font-weight: 600; }

/* sections & lists */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 8px; }
.section-head h2 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
.seg { display: inline-flex; background: var(--surface2); border-radius: 12px; padding: 3px; }
.seg button { padding: 7px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.seg button.on { background: #3a3a3c; color: var(--text); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 6px -18px 4px; padding: 0 18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 9px 16px; border-radius: 99px; background: var(--surface2); font-weight: 600; font-size: 14.5px; color: var(--muted); }
.chips button.on { background: var(--text); color: #000; }
.list { }
.row { display: flex; align-items: center; gap: 14px; padding: 15px 0; width: 100%; text-align: left; border-bottom: 1px solid var(--line); min-height: 72px; }
.row:last-child { border-bottom: 0; }
.logo { flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-weight: 750; font-size: 13px; color: #fff; letter-spacing: -.02em; }
.row .l { flex: 1; min-width: 0; }
.row .t { font-weight: 650; font-size: 17.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { color: var(--muted); font-size: 14.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r { text-align: right; flex: none; max-width: 58%; }
.row .r .t { font-size: 16.5px; }
.row .r .s { font-weight: 600; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(255,214,102,.16); color: var(--warn); vertical-align: 2px; margin-left: 6px; letter-spacing: .03em; }
.list-foot { color: var(--muted); font-size: 12.5px; padding: 6px 0 0; }
.month { color: var(--muted); font-size: 13px; font-weight: 600; margin: 18px 0 0; text-transform: uppercase; letter-spacing: .05em; }

/* holding detail */
.h-head { padding: 14px 0 0; }
.h-name { color: var(--muted); font-size: 15px; }
.h-price { font-size: clamp(34px, 11vw, 46px); font-weight: 700; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; }
.h-price .unit { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 15.5px; }
.kv .k { color: var(--muted); } .kv .v { text-align: right; font-weight: 550; }
.kv.big { font-size: 18px; font-weight: 700; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.kv.big .k { color: var(--text); }
.kv.sub { font-size: 13.5px; padding: 3px 0 3px 12px; } .kv.sub .v { color: var(--muted); }
.card-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 650; margin-bottom: 6px; }
.explain { color: var(--muted); font-size: 12.5px; margin-top: 10px; line-height: 1.45; }

/* tab bar */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--sab)); display: flex; gap: 4px; padding: 6px; border-radius: 99px; background: rgba(40,40,42,.82); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); border: 1px solid rgba(255,255,255,.08); z-index: 20; }
.tabbar button { width: 62px; height: 50px; border-radius: 99px; display: grid; place-items: center; }
.tabbar svg { width: 25px; height: 25px; fill: var(--muted); stroke: var(--muted); }
.tabbar button.on { background: rgba(255,255,255,.12); }
.tabbar button.on svg { fill: var(--text); stroke: var(--text); }
.tabbar .add { background: var(--text); }
.tabbar .add svg { stroke: #000; fill: none; }

/* sheet */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch; background: #161618; border-radius: 26px 26px 0 0; padding: 8px 18px calc(24px + var(--sab)); z-index: 41; border-top: 1px solid var(--line); }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: #48484a; margin: 4px auto 12px; }
.sheet h2 { margin: 2px 0 14px; font-size: 22px; }
.sheet h3 { margin: 18px 0 6px; font-size: 16px; }
.sheet p, .sheet li { color: #c7c7cc; font-size: 14.5px; line-height: 1.5; }
.sheet ul { padding-left: 18px; }
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.type-grid button { padding: 11px 4px; border-radius: 13px; background: var(--surface2); font-size: 13.5px; font-weight: 600; color: var(--muted); }
.type-grid button.on { background: var(--text); color: #000; }
.field { display: block; margin: 0 0 12px; }
.field > span { display: block; color: var(--muted); font-size: 13px; margin: 0 0 5px 2px; }
.field input, .field select, .field textarea { width: 100%; padding: 13px 14px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface2); font-size: 17px; outline: none; -webkit-appearance: none; appearance: none; }
.field input:focus, .field select:focus { border-color: #5a5a5e; }
.field small { display: block; color: var(--muted2); font-size: 12px; margin: 5px 2px 0; line-height: 1.4; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; color: #c7c7cc; font-size: 14.5px; margin: 4px 0 14px; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: #fff; }
.preview { background: var(--surface2); border-radius: 13px; padding: 12px 14px; font-size: 14.5px; color: #c7c7cc; margin: 6px 0 14px; }
.errors { color: var(--down); font-size: 14px; margin: 0 0 10px; }
.btn { display: block; width: 100%; padding: 15px; border-radius: 15px; background: var(--surface2); font-weight: 650; font-size: 16.5px; text-align: center; margin-top: 8px; }
.btn.primary { background: var(--text); color: #000; }
.btn.danger { color: var(--down); }
.btn-row { display: flex; gap: 10px; } .btn-row .btn { flex: 1; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-table td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.stat-table td:last-child { text-align: right; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--sab)); background: #2c2c2e; padding: 11px 16px; border-radius: 14px; font-size: 14.5px; z-index: 60; max-width: 90vw; }
.welcome h1 { font-size: 30px; margin: 10px 0 8px; letter-spacing: -.02em; }
.welcome p { color: #c7c7cc; }
code { background: var(--surface2); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.h-name { display: flex; align-items: center; gap: 9px; }
.logo.mini { width: 28px; height: 28px; border-radius: 8px; font-size: 9px !important; }

/* v1.1 additions */
.scope-bar { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 8px; margin-top: 2px; }
.scope-name { text-align: center; font-weight: 650; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-name small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.fresh { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 5px 11px; border-radius: 99px; background: var(--surface2); color: var(--muted); font-size: 12.5px; }
.fresh:empty { display: none; }
.fresh::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--fresh-dot, var(--up)); }
.fresh.warn { --fresh-dot: var(--warn); } .fresh.bad { --fresh-dot: var(--down); } .fresh.off { --fresh-dot: var(--muted2); }
button.acct { text-align: left; color: inherit; }
button.acct:active { background: var(--surface2); }
.acct .chev { float: right; color: var(--muted2); font-size: 18px; line-height: 1; }
.donut-card { padding: 18px 16px 8px; }
.donut-stage { position: relative; width: min(100%, 340px); aspect-ratio: 1; margin: -4px auto 4px; }
.donut-wrap { position: absolute; left: 15%; top: 15%; width: 70%; aspect-ratio: 1; }
.donut-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.donut-wrap path { cursor: pointer; transition: opacity .15s; }
.donut-wrap path.dim { opacity: .28; }
.donut-center { position: absolute; inset: 22%; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center .k { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.donut-center .v { font-size: clamp(20px, 6.4vw, 26px); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.donut-center .c { font-size: 13px; font-weight: 600; margin-top: 2px; white-space: nowrap; }
.legend { display: grid; grid-template-columns: minmax(0, 1fr); }
.legend button { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 2px; border-top: 1px solid var(--line); text-align: left; font-size: 15px; }
.legend button.on { background: rgba(255,255,255,.04); }
.legend .sw { width: 12px; height: 12px; border-radius: 4px; }
.legend .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.legend .pc { font-weight: 650; font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.legend .vl { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13.5px; min-width: 84px; text-align: right; }
.conc-note { color: var(--muted); font-size: 12.5px; padding: 8px 2px 6px; }
.badge.auto { background: rgba(51,140,237,.18); color: #7fb6f3; }
.badge.soon { background: rgba(95,211,141,.16); color: var(--up); }
.upcoming-title { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 0 2px; }
.upcoming-title h2 { font-size: 20px; margin: 0; }
.upcoming-title small { color: var(--muted); font-size: 12.5px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 2px 0 12px; color: #c7c7cc; font-size: 15px; }
.switch-row input { width: 22px; height: 22px; accent-color: #fff; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; overflow-wrap: anywhere; background: var(--surface2); padding: 10px 12px; border-radius: 12px; color: #e5e5ea; }
#donutHead { flex-wrap: wrap; gap: 10px; }
#donutHead .seg button { padding: 7px 10px; }
[hidden] { display: none !important; }

.eye { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-left: 6px; border-radius: 50%; color: var(--muted); vertical-align: 6px; }
.eye svg { width: 22px; height: 22px; }
.eye:active { background: var(--surface2); }
body.private .balance #balance { letter-spacing: .02em; }

/* company logos */
.logo.has-img { position: relative; overflow: hidden; }
.logo.has-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; border-radius: inherit; }
.logo.mini.has-img img { padding: 0; }
/* donut tags */
.dtag { position: absolute; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px 4px 4px; border-radius: 99px;
  background: #202022; border: 1.5px solid var(--c); font-size: 13.5px; font-weight: 650; white-space: nowrap; box-shadow: 0 0 0 3px var(--surface); transition: opacity .15s; z-index: 2; }
.dtag.dim { opacity: .35; }
.dtag .logo.taglogo { width: 24px; height: 24px; border-radius: 50%; font-size: 8px !important; letter-spacing: -.03em; }
.dtag .logo.taglogo.other { display: grid; place-items: center; background: #3a3a3c; font-size: 10px !important; color: var(--text); }
.dtag .tagdot { width: 10px; height: 10px; border-radius: 50%; margin-left: 5px; }
.dtag .taglbl { font-weight: 600; color: #e5e5ea; max-width: 76px; overflow: hidden; text-overflow: ellipsis; }
.dtag .tagpct { font-variant-numeric: tabular-nums; }
