:root {
  --bg: #08080a;
  --bg2: #101014;
  --card: #16161c;
  --card2: #1d1d25;
  --line: #2a2a34;
  --text: #f2f2f6;
  --muted: #8d8d99;
  --faint: #6a6a76;
  --accent: #c9b07a;
  --accent2: #8ea6ff;
  --up: #3dd68c;
  --down: #ff6b78;
  --warn: #e8b85c;
  --bad: #ff6b78;
  --ok: #3dd68c;
  --await: #6a6a76;
  --tabbar: 56px;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden;
}
body { display: flex; flex-direction: column; }
#app {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior-y: none;
}
body[data-lock="1"] #tabbar { display: none; }
.tabbar {
  flex: 0 0 auto;
  display: flex;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px));
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: #0c0c10;
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tabbar a {
  flex: 1;
  min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  color: var(--faint);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active, .tabbar a[aria-current="page"] { color: var(--accent); }
main {
  padding: 12px calc(env(safe-area-inset-right, 0px) + 16px) 28px calc(env(safe-area-inset-left, 0px) + 16px);
}
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 0 6px;
}
.brand { font-size: 15px; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); text-transform: uppercase; }
.icon-btn {
  appearance: none; border: 0; background: var(--card2); color: var(--text);
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
h1 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 4px; letter-spacing: 0.02em; text-transform: uppercase; }
.net-value { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.net-sub { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; color: var(--muted); font-size: 13px; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
}
.card h2 { margin: 0 0 10px; font-size: 14px; font-weight: 650; }
.row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 44px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.row:first-of-type { border-top: 0; padding-top: 0; }
.row .name { font-weight: 600; }
.row .name i { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 8px; vertical-align: middle; }
.row .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.right { text-align: right; font-variant-numeric: tabular-nums; }
.bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--bg2); margin: 10px 0 4px; }
.bar > span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 6px; }
.warn-card {
  background: #1c1810;
  border: 1px solid #3a3220;
  border-left: 3px solid var(--warn);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.45;
}
.warn-card strong { color: var(--warn); display: block; margin-bottom: 2px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 99px; padding: 4px 10px; font-size: 11px; font-weight: 650;
  background: var(--card2); color: var(--muted);
}
.pill.up { background: #123322; color: var(--up); }
.pill.down { background: #3a1518; color: var(--down); }
.pill.warn { background: #3a2e14; color: var(--warn); }
.pill.grey { background: var(--card2); color: var(--faint); }
.btn {
  appearance: none; border: 0; cursor: pointer;
  min-height: 44px; padding: 0 16px;
  border-radius: 12px; font-weight: 650; font-size: 15px;
  background: var(--accent); color: #16130b;
  width: 100%;
}
.btn.secondary { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: #3a1518; color: var(--down); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1 1 calc(50% - 10px); min-width: 0; }
input, textarea, select {
  width: 100%; min-height: 44px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font: inherit; font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-size: 12px; font-weight: 650; color: var(--muted); margin: 12px 0 6px; }
.lock {
  min-height: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 48px) 24px calc(env(safe-area-inset-bottom, 0px) + 24px);
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  max-width: 420px; margin: 0 auto;
}
.lock-mark {
  width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(160deg, #2a2418, #14120c);
  border: 1px solid #3a3428;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  color: var(--accent);
}
.lock-mark svg { width: 34px; height: 34px; }
.lock h1 { text-transform: none; font-size: 24px; color: var(--text); text-align: center; margin-bottom: 8px; letter-spacing: -0.02em; }
.lock .lead { text-align: center; color: var(--muted); line-height: 1.45; margin: 0 0 20px; }
.error {
  background: #3a1518; color: #ffc4c8; border-radius: 12px;
  padding: 10px 12px; font-size: 13px; margin: 10px 0;
}
.empty { text-align: center; color: var(--muted); padding: 28px 12px; line-height: 1.5; }
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-wrap svg { flex: 0 0 auto; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.split .stat { background: var(--card2); border-radius: 12px; padding: 12px; }
.split .stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.split .stat .v { font-size: 18px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.watch-card { margin: 10px 0; }
.watch-card .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.watch-card .sym { font-size: 12px; color: var(--muted); font-weight: 650; }
.grid-metrics {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px;
}
.grid-metrics div {
  background: var(--bg2); border-radius: 10px; padding: 8px;
}
.grid-metrics .k { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.03em; }
.grid-metrics .v { font-size: 13px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.lights { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.light {
  font-size: 11px; font-weight: 650; border-radius: 99px; padding: 4px 8px;
  background: var(--bg2); color: var(--faint);
}
.light.ok { background: #123322; color: var(--up); }
.light.mid { background: #3a2e14; color: var(--warn); }
.light.bad { background: #3a1518; color: var(--down); }
.thesis { margin: 10px 0; }
.thesis .status { float: right; }
.thesis p { margin: 8px 0 0; font-size: 13px; line-height: 1.45; color: #d5d5dc; white-space: pre-wrap; }
.kicker { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 10px; }
.footer-note { color: var(--faint); font-size: 11px; line-height: 1.45; padding: 8px 0 20px; text-align: center; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 14px);
  z-index: 90; background: #e9eeff; color: #0b1430;
  padding: 10px 16px; border-radius: 12px; font-weight: 600; max-width: 90vw;
}
.update-banner {
  position: sticky; top: 0; z-index: 30;
  background: #2a2418; color: var(--accent);
  padding: 10px 12px; border-radius: 12px; margin: 8px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.linkish { color: var(--accent2); background: none; border: 0; font: inherit; padding: 0; cursor: pointer; text-decoration: underline; min-height: 0; }
.account-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tiny { font-size: 12px; color: var(--muted); }
ol.steps { color: var(--muted); padding-left: 18px; line-height: 1.5; }
.hidden { display: none !important; }
/* Wider screens stay single-column and centred for v1. iPad sidebar is a later pass. */
@media (min-width: 768px) {
  main, .lock { max-width: 640px; margin-left: auto; margin-right: auto; }
  .tabbar { justify-content: center; }
  .tabbar a { max-width: 140px; }
}

.changed-strip { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0 12px; font-size: 13px; line-height: 1.45; }
.changed-strip strong { display: block; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.badge { display: inline-flex; align-items: center; border-radius: 99px; padding: 2px 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; background: #2a2418; color: var(--accent); }
.badge.new { background: #1a2744; color: #93c5fd; }
.badge.paper { background: #2a2030; color: #d8b4fe; }
.badge.warn { background: #3a2e14; color: var(--warn); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips button, .chip {
  appearance: none; border: 1px solid var(--line); background: var(--card2); color: var(--muted);
  border-radius: 99px; padding: 8px 12px; min-height: 44px; font: inherit; font-size: 13px; font-weight: 650; white-space: nowrap; cursor: pointer;
}
.chips button.active, .chip.active { background: #1a2744; color: #93c5fd; border-color: #3b82f6; }
.meter { height: 10px; border-radius: 99px; background: var(--bg2); overflow: hidden; margin: 8px 0; }
.meter > span { display: block; height: 100%; background: #3b82f6; }
.meter.warn > span { background: var(--warn); }
.meter.high > span { background: var(--down); }
.seg { display: flex; background: var(--card2); border-radius: 12px; padding: 3px; margin: 8px 0 12px; }
.seg button { flex: 1; appearance: none; border: 0; background: transparent; color: var(--muted); min-height: 40px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.seg button.active { background: var(--card); color: var(--text); }
.chart { width: 100%; height: 140px; margin: 8px 0; }
.notice { font-size: 12px; color: var(--muted); line-height: 1.45; background: var(--bg2); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.hide-on { letter-spacing: 0.12em; }
.more-link { display: block; color: inherit; text-decoration: none; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.list-check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 0; border-top: 1px solid var(--line); }
.list-check input { width: 22px; height: 22px; min-height: 0; margin-top: 2px; flex: 0 0 auto; }

.badge.delayed { background: #2a2418; color: var(--warn); }
.price-meta { font-size: 11px; color: var(--faint); margin-top: 2px; }
