/* Folio — warm paper, ink navy. Apple-store clarity, nothing shouty. */
:root {
  --paper: #F4F1EA;
  --card: #FDFCF8;
  --ink: #1C1F24;
  --ink-soft: #62666D;
  --ink-faint: #9A9DA3;
  --line: #E4DED1;
  --navy: #22344A;
  --navy-soft: #E8ECF1;
  --up: #2E7D4F;
  --up-bg: #E6F1E9;
  --down: #B3402E;
  --down-bg: #F7E9E4;
  --amber: #A86F14;
  --amber-bg: #F7EFDC;
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}
#app { max-width: 560px; margin: 0 auto; padding: 0 20px 64px; }

/* ---------- lock screen ---------- */
.lock-wrap {
  min-height: 92vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px 8px;
}
.lock-mark {
  width: 76px; height: 76px; border-radius: 22px; background: var(--navy);
  display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}
.lock-mark svg { display: block; }
.lock-title { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.lock-sub { color: var(--ink-soft); font-size: 15px; margin: 0 0 28px; max-width: 300px; }
.pin-dots { display: flex; gap: 12px; margin-bottom: 8px; min-height: 22px; }
.pin-dots .dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--ink-faint); transition: background .12s, border-color .12s;
}
.pin-dots .dot.filled { background: var(--navy); border-color: var(--navy); }
.pin-error {
  color: var(--down); font-size: 14px; min-height: 22px; margin: 0 0 10px;
  opacity: 0; transition: opacity .2s;
}
.pin-error.show { opacity: 1; }
.shake { animation: shake .35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-5px); }
}
.pin-pad { display: grid; grid-template-columns: repeat(3, 84px); gap: 14px; justify-content: center; margin-bottom: 18px; }
.pin-key {
  width: 84px; height: 84px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  font-size: 26px; font-weight: 500; color: var(--ink);
  cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.pin-key:active { background: var(--navy-soft); }
.pin-key.fn { font-size: 15px; color: var(--ink-soft); border-color: transparent; background: transparent; }
.unlock-btn {
  min-width: 200px; padding: 14px 28px; border-radius: 999px;
  border: none; background: var(--navy); color: #fff;
  font-size: 17px; font-weight: 600; cursor: pointer;
}
.unlock-btn:disabled { opacity: 0.35; }
.unlock-btn.busy { opacity: 0.7; }
.lock-hint { margin-top: 22px; font-size: 13px; color: var(--ink-faint); max-width: 300px; }

/* ---------- app chrome ---------- */
.topbar { padding: 28px 0 4px; display: flex; align-items: baseline; justify-content: space-between; }
.brand { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.asof { font-size: 13px; color: var(--ink-soft); }
.coverage-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--navy);
  background: var(--navy-soft); border-radius: 999px; padding: 5px 12px;
  margin: 10px 0 18px;
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 14px; }

/* scoreboard */
.seg { display: flex; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 18px; }
.seg button {
  flex: 1; border: none; background: transparent; border-radius: 999px;
  padding: 8px 0; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.seg button.on { background: var(--navy); color: #fff; }
.big-num { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.big-num .u { color: var(--up); } .big-num .d { color: var(--down); }
.vs-line { margin-top: 8px; font-size: 15px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.excess-pill {
  display: inline-block; margin-top: 10px; font-size: 13.5px; font-weight: 700;
  border-radius: 999px; padding: 5px 12px; font-variant-numeric: tabular-nums;
}
.excess-pill.up { background: var(--up-bg); color: var(--up); }
.excess-pill.down { background: var(--down-bg); color: var(--down); }
.excess-pill.flat { background: var(--navy-soft); color: var(--navy); }
.win-range { margin-top: 10px; font-size: 12.5px; color: var(--ink-faint); }

/* chart */
.chart-wrap { margin-top: 16px; }
.chart-note { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-faint); }
.chart-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; }
.chart-legend .sw { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

/* flags */
.flag { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.flag:last-child { border-bottom: none; padding-bottom: 2px; }
.flag:first-of-type { padding-top: 2px; }
.flag .pip { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; }
.flag .pip.watch { background: var(--amber); } .flag .pip.info { background: var(--navy); }
.flag p { margin: 0; font-size: 14.5px; }
.flag .sev { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); display: block; margin-bottom: 2px; }

/* sleeves */
.sleeve-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.sleeve-row:last-child { border-bottom: none; padding-bottom: 2px; }
.sleeve-row:first-of-type { padding-top: 2px; }
.sleeve-meta { flex: 1; min-width: 0; }
.sleeve-name { font-size: 15px; font-weight: 600; }
.sleeve-sub { font-size: 12.5px; color: var(--ink-soft); }
.sleeve-val { text-align: right; font-variant-numeric: tabular-nums; }
.sleeve-val .v { font-size: 15.5px; font-weight: 700; }
.sleeve-val .t { font-size: 12.5px; color: var(--ink-soft); }
.sleeve-bar { height: 5px; border-radius: 3px; background: var(--paper); margin-top: 6px; overflow: hidden; }
.sleeve-bar i { display: block; height: 100%; border-radius: 3px; background: var(--navy); }

.footnotes { margin-top: 20px; font-size: 12.5px; color: var(--ink-faint); line-height: 1.6; }
.footnotes p { margin: 0 0 8px; }

.error-box {
  margin: 25vh auto 0; max-width: 340px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px;
}
.error-box h1 { font-size: 19px; margin: 0 0 8px; }
.error-box p { color: var(--ink-soft); font-size: 14.5px; margin: 0 0 16px; }
.error-box button { padding: 12px 24px; border-radius: 999px; border: none; background: var(--navy); color: #fff; font-size: 15px; font-weight: 600; }

@media (prefers-color-scheme: dark) {
  /* Folio stays light by design — paper is the brand. */
}

/* ---------- tab bar ---------- */
#app { padding-bottom: 110px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; background: rgba(253,252,248,0.96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 1; border: none; background: none; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--ink-faint);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px 0; font-family: inherit;
}
.tabbar button .tdot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--line);
}
.tabbar button.on { color: var(--navy); }
.tabbar button.on .tdot { background: var(--navy); }

/* ---------- generic screen pieces ---------- */
button.tap {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit;
  background: none; border: none; padding-left: 0; padding-right: 0; cursor: pointer;
}
button.tap.sleeve-row { display: flex; }
.back-link {
  border: none; background: none; cursor: pointer; font: inherit;
  color: var(--navy); font-weight: 600; font-size: 14.5px;
  padding: 6px 0 12px; display: inline-block;
}
.page-head { padding: 6px 0 16px; }
.page-head h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.page-sub { color: var(--ink-soft); font-size: 14.5px; margin: 0; max-width: 420px; }
.chev { color: var(--ink-faint); font-size: 22px; line-height: 1; padding-left: 4px; }
.muted { color: var(--ink-faint); }
.body-p { font-size: 14.5px; margin: 0 0 10px; }
.body-p:last-child { margin-bottom: 2px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--ink-soft); }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* detail cards (sleeves, funds) */
.detail-card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px;
}
.detail-card .chev { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.dc-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.dc-name { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; }
.dc-sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.dc-val { font-size: 17px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dc-pct { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.dc-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.dc-bench { color: var(--ink-soft); text-align: right; }
.dc-note { font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; }
.dc-excess { margin-top: 8px; }
.detail-head { margin-bottom: 14px; }
.fund-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px;
}
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; border-radius: 999px; padding: 3px 10px;
  background: var(--navy-soft); color: var(--navy);
}
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--down-bg); color: var(--down); }
.badge.navy { background: var(--navy); color: #fff; }

/* holding / ticker rows */
.hrow, .trow {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.hrow:last-child, .trow:last-child { border-bottom: none; padding-bottom: 2px; }
.hrow:first-of-type, .trow:first-of-type { padding-top: 2px; }
.h-meta, .t-meta { flex: 1; min-width: 0; }
.h-ticker, .t-ticker { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.h-name { font-size: 12.5px; color: var(--ink-soft); }
.h-acct { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }
.h-extra { font-size: 12.5px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.h-extra .up { color: var(--up); font-weight: 600; }
.h-extra .down { color: var(--down); font-weight: 600; }
.h-val, .t-nums { text-align: right; font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 700; white-space: nowrap; }
.h-share, .t-excess { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.t-excess.up { color: var(--up); font-weight: 700; }
.t-excess.down { color: var(--down); font-weight: 700; }
.t-actual { font-size: 15px; }
button.trow, button.hrow.tap { position: relative; padding-right: 18px; }
button.hrow.tap { display: flex; }
button.trow .chev, button.hrow .chev { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }

/* verdict grids + account blocks */
.verdict-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; margin: 4px 0 6px; }
.v-lab { font-size: 12px; color: var(--ink-soft); margin-bottom: 3px; }
.v-num { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.v-num.sm { font-size: 17px; }
.v-num.dim { color: var(--ink-soft); }
.v-num.u { color: var(--up); } .v-num.d { color: var(--down); }
.v-num .up { color: var(--up); } .v-num .down { color: var(--down); }
.v-sub { font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }
.big-num .per { font-size: 20px; font-weight: 600; color: var(--ink-soft); }
.acct-block { padding: 12px 0; border-bottom: 1px solid var(--line); }
.acct-block:last-child { border-bottom: none; padding-bottom: 2px; }
.acct-block:first-of-type { padding-top: 2px; }
.acct-name { font-size: 15px; font-weight: 700; }
.acct-win { font-size: 12.5px; color: var(--ink-faint); margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.acct-nums { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.acct-nums .up { color: var(--up); } .acct-nums .down { color: var(--down); }
.chart-text { font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; }

/* concentration gauges */
.conc-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.conc-row:last-child { border-bottom: none; padding-bottom: 2px; }
.conc-row:first-of-type { padding-top: 2px; }
.conc-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.conc-pct { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.conc-meta { margin-top: 8px; font-size: 13px; }
.gauge { margin: 2px 0; }
.gauge-track {
  position: relative; height: 10px; border-radius: 6px;
  background: var(--paper); border: 1px solid var(--line); overflow: visible;
}
.gauge-track i {
  display: block; height: 100%; border-radius: 6px; background: var(--navy);
  max-width: 100%;
}
.gauge-track i.warm { background: var(--amber); }
.gauge-track i.hot { background: var(--down); }
.gtick {
  position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-faint);
}
.gtick span {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  font-size: 10.5px; font-style: normal; color: var(--ink-faint); font-weight: 600;
  white-space: nowrap;
}
.conc-row .gauge { margin-top: 20px; }

/* cash stacked bar + fee split bars */
.stackbar {
  display: flex; height: 22px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); margin: 6px 0 10px;
}
.stackbar i { display: block; height: 100%; }
.stackbar .obs { background: var(--navy); }
.stackbar .mod { background: #C9A24B; }
.stack-legend { display: flex; gap: 18px; font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.stack-legend .sw { display: inline-block; width: 18px; height: 10px; border-radius: 3px; vertical-align: baseline; margin-right: 6px; }
.split-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 13.5px; }
.split-row span { flex: 0 0 108px; color: var(--ink-soft); }
.split-row b { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.split-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.split-bar i { display: block; height: 100%; background: var(--navy); }
.split-bar i.alt { background: #8A97A5; }
