:root {
  --bg: #0b0c10;
  --bg-elev: #14161c;
  --card: #15171d;
  --card-2: #1c1f27;
  --line: rgba(255,255,255,.07);
  --text: #f3f4f7;
  --muted: #8d93a1;
  --faint: #5c6270;
  --accent: #34e0a1;
  --accent-ink: #062b1e;
  --blue: #6ea8ff;
  --amber: #ffbf5c;
  --red: #ff6b74;
  --violet: #b18cff;
  --radius: 20px;
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* Tab bar colour. html/body use it too, so any strip iOS leaves outside the layout viewport
     matches the bar. Must stay in sync with theme-color in index.html / manifest.json. */
  --bar-bg: var(--bg-elev);
  --safe-t: env(safe-area-inset-top, 0px);
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px rgba(0,0,0,.25);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f4f7; --bg-elev: #ffffff; --card: #ffffff; --card-2: #f1f2f6;
    --line: rgba(10,20,40,.08); --text: #0d1017; --muted: #646b7a; --faint: #9aa0ad;
    --accent: #0fb57a; --accent-ink: #ffffff; --blue: #2f6fe4; --amber: #c98208; --red: #e0424e; --violet: #7a4ee0;
    --shadow: 0 1px 2px rgba(10,20,40,.05), 0 8px 24px rgba(10,20,40,.06);
    color-scheme: light;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background-color: var(--bar-bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
  font-feature-settings: "tnum" 1, "ss01" 1;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Lock screen ---------- */
.lock { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-t) + 24px) 24px calc(var(--safe-b) + 24px);
  background: radial-gradient(120% 70% at 70% 0%, rgba(52,224,161,.14), transparent 60%), var(--bg); z-index: 10; }
.lock-inner { width: 100%; max-width: 320px; text-align: center; }
.lock-logo { border-radius: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.lock-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 14px 0 4px; }
.lock-sub { color: var(--muted); margin: 0 0 22px; min-height: 20px; }
.lock-sub.err { color: var(--red); }
.dots { display: flex; justify-content: center; gap: 16px; margin-bottom: 34px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--muted); transition: background .12s, border-color .12s; }
.dots i.on { background: var(--text); border-color: var(--text); }
.dots.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-10px); } 40%,80% { transform: translateX(10px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 24px; justify-content: center; }
.keypad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--card-2);
  font-size: 30px; font-weight: 400; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; cursor: pointer; }
.keypad button small { font-size: 9px; letter-spacing: .18em; color: var(--muted); margin-top: 3px; font-weight: 600; }
.keypad button:active { background: var(--line); transform: scale(.96); }
.keypad .key-del { background: transparent; font-size: 24px; }
.keypad.busy { opacity: .4; pointer-events: none; }

/* ---------- Layout ---------- */
.view { padding: calc(var(--safe-t) + 14px) 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); max-width: 640px; margin: 0 auto; }
.head { display: flex; align-items: flex-end; justify-content: space-between; margin: 6px 4px 16px; }
.head h1 { font-size: 32px; font-weight: 800; letter-spacing: -.03em; margin: 0; }
.head .sub { color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--card-2); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; fill: var(--text); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  padding: 6px 8px calc(var(--safe-b) + 6px); height: calc(var(--tabbar-h) + var(--safe-b));
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--line); z-index: 5; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--faint); font-size: 10.5px; font-weight: 600; padding-top: 4px; }
.tabbar svg { width: 25px; height: 25px; fill: currentColor; }
.tabbar a.active { color: var(--accent); }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); border: 0.5px solid var(--line); }
.card h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 10px; letter-spacing: .01em; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.section-title { font-size: 20px; font-weight: 750; letter-spacing: -.02em; margin: 22px 4px 10px; display: flex; align-items: baseline; justify-content: space-between; }
.section-title small { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.grid2 .card { margin: 0; }

.hero { background: radial-gradient(130% 120% at 100% 0%, rgba(52,224,161,.22), transparent 55%), linear-gradient(160deg, #1b2130, #12141a); color: #f3f4f7; border: 0.5px solid rgba(255,255,255,.08); }
@media (prefers-color-scheme: light) { .hero { background: radial-gradient(130% 120% at 100% 0%, rgba(52,224,161,.35), transparent 55%), linear-gradient(160deg, #1b2130, #232a3b); } }
.hero h2 { color: rgba(243,244,247,.65); }
.big { font-size: 38px; font-weight: 750; letter-spacing: -.035em; line-height: 1.05; }
.mid { font-size: 22px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.pos { color: var(--accent); } .neg { color: var(--red); } .warn { color: var(--amber); }
.usd { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .label { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 21px; font-weight: 720; letter-spacing: -.025em; }
.kpi .note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 4px 9px; border-radius: 999px; background: var(--card-2); color: var(--muted); white-space: nowrap; }
.chip.green { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.chip.amber { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.chip.red { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.chip.blue { background: color-mix(in srgb, var(--blue) 16%, transparent); color: var(--blue); }
.chip.violet { background: color-mix(in srgb, var(--violet) 16%, transparent); color: var(--violet); }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; margin-bottom: 12px; font-size: 13px;
  background: color-mix(in srgb, var(--amber) 12%, var(--card)); border: 0.5px solid color-mix(in srgb, var(--amber) 35%, transparent); }
.banner b { color: var(--amber); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 0.5px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 2px; }
.list .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 17px; background: var(--card-2); }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; font-size: 14.5px; }
.list .s { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.list .r { text-align: right; flex: none; }
.list .r .v { font-weight: 650; font-size: 14.5px; }

.rows { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 14px; }
.rows dt { color: var(--muted); white-space: nowrap; }
.rows dd { margin: 0; text-align: right; font-weight: 600; }

.seg { display: flex; background: var(--card-2); border-radius: 12px; padding: 3px; margin: 0 0 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.18); }

.progress { height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }

.empty { text-align: center; padding: 18px 8px 10px; }
.empty .em-ic { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 14px; background: var(--card-2); display: grid; place-items: center; font-size: 22px; }
.empty .em-t { font-weight: 650; font-size: 15px; }
.empty .em-s { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.empty code { font-size: 11.5px; background: var(--card-2); padding: 1px 5px; border-radius: 5px; }
.ghost { opacity: .35; }

.tier { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-top: 0.5px solid var(--line); font-size: 14px; }
.tier:first-of-type { border-top: 0; }
.tier .n { font-weight: 600; }
.tier .p { font-weight: 650; text-align: right; }
.tier .m { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart text { font: 600 10.5px -apple-system, BlinkMacSystemFont, sans-serif; fill: var(--muted); }
.foot { text-align: center; color: var(--faint); font-size: 11.5px; margin: 18px 0 4px; }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Sections ---------- */
.back { display: inline-block; color: var(--accent); text-decoration: none; font-weight: 600; font-size: 15px; margin: 2px 4px 0; }
.tile { border-radius: 12px; display: grid; place-items: center; flex: none; font-size: 19px;
  background: color-mix(in srgb, var(--c) 22%, var(--card-2)); box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--c) 45%, transparent); }
.sections li { padding: 0; }
.sections li a { display: flex; align-items: center; gap: 12px; padding: 11px 0; color: inherit; text-decoration: none; width: 100%; }
.sections li:first-child a { padding-top: 2px; }
.chev { color: var(--faint); font-size: 22px; flex: none; }
a.card { display: block; color: inherit; text-decoration: none; }
.proj { border-left: 3px solid var(--c); }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 0.5px solid var(--line); }
.mini .ml { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.mini .mv { font-size: 16px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.proj-strip { display: flex; align-items: center; gap: 10px; margin: -6px 4px 14px; font-size: 13px; color: var(--muted); }
.proj-strip span:nth-child(2) { flex: 1; }
.banner.blue { background: color-mix(in srgb, var(--blue) 12%, var(--card)); border-color: color-mix(in srgb, var(--blue) 35%, transparent); }
.banner.blue b { color: var(--blue); }
.kpi .note code, .list code { font-size: 11px; background: var(--card-2); padding: 1px 4px; border-radius: 4px; }

/* partner split table */
.split-row { display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(var(--n), minmax(0, 1fr)); gap: 8px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.split-row:last-of-type { border-bottom: 0; }
.split-row.head { padding-top: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.split-row .sl { font-size: 14px; color: var(--muted); }
.split-row .sl small { display: block; font-size: 11px; color: var(--faint); margin-top: 1px; }
.split-row .sv { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; }
.split-row.head .sv { font-size: 12px; font-weight: 600; }
.split-row .sv.you:not(.pos) { color: var(--text); }
.split-row.head .sv.you { color: var(--accent); }
.split-sep { padding: 12px 0 2px; }

/* ---------- App shell ----------
   The document scrolls normally (no fixed html/body height, no overflow hidden, no JS measuring).
   html/body are painted in the tab bar colour (--bar-bg); the dark page background lives on .app.
   So if an iOS home-screen app ends the layout viewport above the physical screen edge, whatever
   iOS shows below it is canvas = bar colour, and the bar visually runs to the bottom edge. */
html, body { min-height: 100%; height: auto; overflow: visible; }
.app { min-height: 100vh; min-height: 100dvh; background-color: var(--bg); }
.view { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 28px); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; margin: 0;
  height: auto; min-height: calc(var(--tabbar-h) + var(--safe-b)); padding: 0 8px env(safe-area-inset-bottom, 0px);
  align-items: stretch; background: var(--bar-bg); }
.tabbar a { justify-content: center; padding: 0; min-height: var(--tabbar-h); }
.locked .tabbar { display: none !important; }
/* While locked, the strip iOS leaves below the viewport matches the lock screen's flat bottom (--bg). */
html.locked, html:has(body.locked), body.locked { background-color: var(--bg); }
.diag { font-size: 10.5px; opacity: .7; margin-top: 4px; }

/* ---------- Host badge ----------
   The hosting platform injects a fixed "MADE IN HIGGSFIELD" tag at the bottom-right, over the tab bar.
   Only our own elements may render at the top level; anything else injected into <body>/<html> is hidden.
   (index.html also hides it via JS, which beats inline !important styles and shadow-DOM hosts.) */
body > :not(#lock):not(#app):not(script):not(noscript):not(style):not(link):not(template),
html > :not(head):not(body),
[id*="higgsfield" i], [class*="higgsfield" i], [id*="watermark" i], [class*="watermark" i],
[id*="made-in" i], [class*="made-in" i], [class*="madein" i], [id*="hf-badge" i], [class*="hf-badge" i],
a[href*="higgsfield" i]:not(.tabbar a), iframe[src*="higgsfield" i] {
  display: none !important; visibility: hidden !important; opacity: 0 !important; pointer-events: none !important;
  width: 0 !important; height: 0 !important; overflow: hidden !important; }
html, body { padding: 0 !important; margin: 0 !important; border: 0 !important; transform: none !important; }
