:root {
  --bg: #f4f6f4;
  --surface: #ffffff;
  --ink: #102019;
  --muted: #5d6d66;
  --line: #e0e6e2;
  --brand: #0e5c4a;
  --brand-soft: #e3f1ec;
  --up: #0f7a4f;
  --down: #b3261e;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4e00;
  --accent: #e0a800;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1512;
    --surface: #13201c;
    --ink: #e8f2ee;
    --muted: #93a8a0;
    --line: #22332d;
    --brand: #4fc3a1;
    --brand-soft: #173a30;
    --up: #4cd49a;
    --down: #ff8a80;
    --warn-bg: #3a2f10;
    --warn-ink: #ffd97a;
    --accent: #facc15;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 560px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px 32px; }
.num { font-variant-numeric: tabular-nums; }

/* Top bar */
.top { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.tabs { display: flex; flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 0; border-radius: 999px; }
.tabs button[aria-pressed="true"] { background: var(--brand); color: var(--surface); }
.view-title { flex: 1; margin: 0; font-size: 20px; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 40px; height: 40px; border-radius: 50%; font-size: 18px; }
.ccy { display: flex; gap: 6px; margin: -6px 0 12px; justify-content: flex-end; }
.ccy button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 999px; }
.ccy button[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* Banners */
.banner { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.banner a { color: inherit; font-weight: 700; }
.asof { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.hero .value { font-size: 34px; font-weight: 750; letter-spacing: -.02em; }
.hero .change { font-weight: 600; margin-top: 2px; }
.up { color: var(--up); }
.down { color: var(--down); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .big { font-size: 20px; font-weight: 700; }
.bench { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 14px; }
.bench div { display: flex; justify-content: space-between; }

/* Chart */
.chart { width: 100%; height: 180px; display: block; }
.chart-line { fill: none; stroke: var(--brand); stroke-width: 2.25; stroke-linejoin: round; }
.chart-area { fill: var(--brand-soft); }
.ranges { display: flex; gap: 6px; margin-top: 10px; }
.ranges button { flex: 1; border: 1px solid var(--line); background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 0; border-radius: 10px; }
.ranges button[aria-pressed="true"] { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.chart-dates { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 4px; }

/* Holdings */
.holding { padding: 10px 0; border-top: 1px solid var(--line); }
.holding:first-of-type { border-top: 0; padding-top: 0; }
.holding .row { display: flex; justify-content: space-between; gap: 12px; }
.holding .sym { font-weight: 700; }
.holding .sub { color: var(--muted); font-size: 13px; }
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); }

/* MYR check */
.lines { display: grid; gap: 6px; }
.lines div { display: flex; justify-content: space-between; gap: 12px; }
.lines .total { font-weight: 700; padding-top: 6px; border-top: 1px solid var(--line); }
.note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

footer { color: var(--muted); font-size: 13px; text-align: center; margin-top: 8px; }

/* Settings */
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.checks { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; display: grid; gap: 8px; }
.checks legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.checks label { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.checks input { width: 20px; height: 20px; padding: 0; accent-color: var(--brand); }
input, select { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.primary { border: 0; background: var(--brand); color: var(--surface); font: inherit; font-weight: 700; padding: 12px; border-radius: 12px; }
.secondary { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; padding: 12px; border-radius: 12px; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
