/* Fulcrum Tracker. Look and feel after goldao.app: charcoal, gold/amber accents, mono labels. */
:root {
  --bg: #121212;
  --bg-2: #171717;
  --panel: #1b1b1b;
  --panel-2: #222222;
  --line: #2d2d2d;
  --line-2: #3a3a3a;
  --text: #ede7db;
  --text-2: #c9c2b5;
  --muted: #8e887d;
  --gold: #e3b04b;
  --gold-2: #f2c96b;
  --amber: #f08a3c;
  --pos: #4cc38a;
  --neg: #ef6a55;
  --pos-bg: rgba(76, 195, 138, .12);
  --neg-bg: rgba(239, 106, 85, .12);
  --gold-bg: rgba(227, 176, 75, .12);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .25);
  --radius: 14px;
  --radius-sm: 9px;
  --font: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --sidebar: 232px;
  --chart-grid: rgba(255, 255, 255, .06);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f1ea;
  --bg-2: #efebe2;
  --panel: #ffffff;
  --panel-2: #f8f6f1;
  --line: #e4ded2;
  --line-2: #d6cfc1;
  --text: #1e1b16;
  --text-2: #3d3830;
  --muted: #776f62;
  --gold: #a87a16;
  --gold-2: #c08f22;
  --amber: #c9641c;
  --pos: #1f8a5a;
  --neg: #c8442f;
  --pos-bg: rgba(31, 138, 90, .1);
  --neg-bg: rgba(200, 68, 47, .1);
  --gold-bg: rgba(168, 122, 22, .1);
  --shadow: 0 1px 2px rgba(30, 27, 22, .05), 0 8px 24px rgba(30, 27, 22, .06);
  --chart-grid: rgba(0, 0, 0, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow-x: clip; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--gold); }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.amber { color: var(--amber); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.label .accent { color: var(--amber); }

/* ---------- auth ---------- */
.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(227, 176, 75, .08), transparent 60%),
    radial-gradient(700px 400px at 110% 110%, rgba(240, 138, 60, .06), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 34px; height: 34px; }
.brand-name { font-weight: 600; letter-spacing: .02em; font-size: 18px; }
.brand-sub { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--gold); text-transform: uppercase; }
.auth h1 { font-size: 26px; line-height: 1.15; margin: 22px 0 6px; font-weight: 600; letter-spacing: -.01em; }
.auth p.lead { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500; }
.tabs button.on { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }
.profile-list { display: grid; gap: 8px; margin-bottom: 14px; }
.profile-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer;
}
.profile-item.on { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-bg); color: var(--gold); font-weight: 600; font-size: 14px; flex: none; }
.auth-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; }
.note { font-size: 12.5px; color: var(--muted); }
.note.warn { color: var(--amber); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.input, select.input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 16px; /* stops iOS zoom */
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.input.num { font-family: var(--mono); }
.input-wrap { position: relative; }
.input-wrap .prefix, .input-wrap .suffix { position: absolute; top: 50%; transform: translateY(-50%); color: var(--muted); font-family: var(--mono); font-size: 14px; pointer-events: none; }
.input-wrap .prefix { left: 12px; }
.input-wrap .suffix { right: 12px; }
.input-wrap .prefix ~ .input { padding-left: 26px; }
.input-wrap .input.has-suffix { padding-right: 34px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.err { color: var(--neg); font-size: 13px; min-height: 18px; margin: -4px 0 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
  text-decoration: none;
  color: var(--text);
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: transparent;
  color: #1a1408;
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--neg); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { border-color: var(--line-2); color: var(--text); }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--line); gap: 3px; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 8px; cursor: pointer; color: var(--muted); font-family: var(--mono); font-size: 13px; letter-spacing: .06em; font-weight: 600; }
.seg button.on { background: var(--panel-2); color: var(--gold); box-shadow: 0 0 0 1px var(--line-2); }
.seg.full { display: flex; }
.seg.full button { flex: 1; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  display: flex; flex-direction: column;
  padding: 18px 14px;
}
.sidebar .brand { padding: 2px 6px 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font-size: 14.5px;
}
.nav a svg { width: 18px; height: 18px; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.on { color: var(--gold); background: var(--panel); box-shadow: 0 0 0 1px var(--line); }
.nav .badge { margin-left: auto; font-family: var(--mono); font-size: 11px; background: var(--amber); color: #1a1408; border-radius: 99px; padding: 1px 7px; font-weight: 700; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.who .name { font-weight: 500; font-size: 14px; line-height: 1.2; }
.who .sync { font-size: 11.5px; color: var(--muted); }
.who .sync.warn { color: var(--amber); }

.main { min-width: 0; padding: 20px 32px 48px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.topbar .title .label { display: block; margin-bottom: 4px; }
.topbar h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -.015em; line-height: 1.1; }
.topbar .spacer { flex: 1; }
.price-chip {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); background: var(--panel);
  padding: 6px 6px 6px 12px; border-radius: 11px;
  font-family: var(--mono); font-size: 12.5px;
}
.price-chip .tk { color: var(--muted); margin-right: 5px; }
.price-chip .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px rgba(240, 138, 60, .18); }
.price-chip .live-dot.stale { background: var(--muted); box-shadow: none; }
.price-chip .icon-btn { width: 28px; height: 28px; border-radius: 8px; }
.price-chip .asof { color: var(--muted); font-size: 11px; }

.mobile-top, .tabbar { display: none; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h .spacer { flex: 1; }
.card-b { padding: 18px; }
.card-b.tight { padding: 0; }

.hero .big {
  font-family: var(--font);
  font-weight: 600;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.hero .big small { font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: .08em; margin-left: 8px; font-weight: 400; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 99px; border: 1px solid currentColor;
}
.pill.pos { background: var(--pos-bg); }
.pill.neg { background: var(--neg-bg); }
.pill.gold { background: var(--gold-bg); color: var(--gold); }
.pill.mute { color: var(--muted); }
.bar { position: relative; height: 10px; border-radius: 99px; background: var(--bg-2); border: 1px solid var(--line); overflow: visible; margin: 18px 0 8px; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, #b5521c, var(--amber) 45%, var(--gold-2)); }
.bar > i::after { content: ''; position: absolute; right: -5px; top: 50%; width: 12px; height: 12px; transform: translateY(-50%); border-radius: 50%; background: #ffe9a8; box-shadow: 0 0 12px 3px rgba(242, 201, 107, .6); }
.bar-legend { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.stats > div { padding: 14px 18px; border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; }
.stats .v { font-family: var(--mono); font-size: 15px; margin-top: 4px; }

.kpi .v { font-size: 26px; font-weight: 600; margin-top: 8px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .sub { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 4px; }

.kv { display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv > div:last-child { border-bottom: 0; }
.kv .k { color: var(--text-2); }
.kv .v { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

.ticker-tag { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .08em; padding: 3px 8px; border-radius: 6px; background: var(--gold-bg); color: var(--gold); }
.ticker-tag.SQQQ { background: rgba(240, 138, 60, .12); color: var(--amber); }

.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 220px; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.empty b { color: var(--text-2); display: block; font-size: 15px; margin-bottom: 4px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th {
  text-align: left; font-family: var(--mono); font-weight: 500; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel);
  position: sticky; top: 0;
}
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.n, table.t th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.t tbody tr:hover { background: var(--panel-2); }
.type { font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; }
.type.Buy { color: var(--pos); }
.type.Sell { color: var(--neg); }
.type.Dividend { color: var(--gold); }
.type.Deposit, .type.Withdrawal { color: var(--text-2); }
.type.Split, .type.Adjustment { color: var(--amber); }

/* trade form */
.lots { display: grid; gap: 8px; max-height: 320px; overflow: auto; padding-right: 2px; }
.lot {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); cursor: pointer;
}
.lot.on { border-color: var(--gold); background: var(--gold-bg); }
.lot input { width: 18px; height: 18px; accent-color: var(--gold); }
.lot .meta { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.lot .take { font-family: var(--mono); font-size: 12.5px; color: var(--gold); }
.preview .kv > div { padding: 9px 0; }
.preview .total { font-size: 22px; font-weight: 600; font-family: var(--mono); }

.reached-card { border-color: rgba(76, 195, 138, .4); }
.lot-row { display: grid; grid-template-columns: 1.2fr repeat(5, 1fr) 64px;gap: 12px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.lot-row:last-child { border-bottom: 0; }
.lot-row .c .label { font-size: 10px; display: block; margin-bottom: 3px; }
.lot-row .c .v { font-family: var(--mono); font-size: 14px; }
.progress { height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin-top: 6px; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .spacer { flex: 1; }

.code {
  font-family: var(--mono); font-size: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; display: flex; align-items: center; gap: 8px; overflow-x: auto; white-space: nowrap;
}
.code span { flex: 1; }
ol.steps { padding-left: 18px; margin: 0; display: grid; gap: 10px; color: var(--text-2); font-size: 14px; }

.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); font-size: 14px; display: flex; gap: 10px; align-items: center; animation: up .2s ease-out; }
.toast.ok::before, .toast.bad::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.toast.ok::before { background: var(--pos); }
.toast.bad::before { background: var(--neg); }
@keyframes up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

dialog.modal { border: 1px solid var(--line-2); background: var(--panel); color: var(--text); border-radius: 16px; padding: 0; width: min(92vw, 440px); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
dialog.modal .card-b p { margin: 0 0 14px; color: var(--text-2); font-size: 14px; }
dialog.modal .actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; }

.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(240, 138, 60, .35); background: rgba(240, 138, 60, .08); margin-bottom: 16px; font-size: 14px; }
.banner .spacer { flex: 1; }
.banner > svg { width: 18px; height: 18px; flex: none; color: var(--amber); }
@media (max-width: 600px) { .banner { flex-wrap: wrap; } }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lot-row { grid-template-columns: 1.2fr repeat(3, 1fr) 64px; }
  .lot-row .hide-md { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 0 16px calc(88px + env(safe-area-inset-bottom)); }
  .mobile-top {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 20;
    margin: 0 -16px 16px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .mobile-top .brand img { width: 28px; height: 28px; }
  .mobile-top .spacer { flex: 1; }
  .topbar { margin-bottom: 16px; }
  .topbar h1 { font-size: 24px; }
  .topbar .price-chip, .topbar .theme-btn { display: none; }
  .mprices { display: flex; gap: 10px; font-family: var(--mono); font-size: 11.5px; align-items: center; }
  .mprices .tk { color: var(--muted); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--bg-2) 92%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: grid; justify-items: center; gap: 3px; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: 10.5px; font-family: var(--mono); letter-spacing: .04em; position: relative; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.on { color: var(--gold); }
  .tabbar .badge { position: absolute; top: 1px; left: calc(50% + 6px); font-size: 9.5px; background: var(--amber); color: #1a1408; border-radius: 99px; padding: 0 5px; font-weight: 700; }
  .card-h { flex-wrap: wrap; row-gap: 10px; }
  .card-h .legend { order: 5; width: 100%; }
  .hero .card-h .pill { font-size: 10.5px; letter-spacing: .06em; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .g4.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .stats > div { padding: 12px; }
  .stats .v { font-size: 13px; }
  .kpi .v { font-size: 21px; }
  .card-b { padding: 16px; }
  .lot-row { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
  .lot-row .hide-sm { display: none; }
  .lot-row .act { grid-column: 1 / -1; }
  .lot-row .act .btn { width: 100%; }
  .chart-box { height: 230px; }
  .toast-wrap { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .ledger-table { display: none; }
  .ledger-cards { display: grid; }
}
@media (min-width: 901px) { .ledger-cards { display: none; } .mprices { display: none; } }
.ledger-cards { gap: 0; }
.lc { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.lc:last-child { border-bottom: 0; }
.lc .r { text-align: right; font-family: var(--mono); }
.lc .meta { color: var(--muted); font-size: 12px; font-family: var(--mono); }
@media (max-width: 420px) {
  .row3 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr; }
  .stats > div { border-left: 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
  .stats > div:first-child { border-top: 0; }
}
