:root {
  --bg: #0b0b0d;
  --bg-2: #121216;
  --card: #17171c;
  --card-2: #1d1d23;
  --line: #2a2a31;
  --text: #f2f2f4;
  --muted: #8d8d97;
  --faint: #5d5d66;
  --accent: #f0821e;
  --accent-2: #d8650f;
  --accent-soft: rgba(240, 130, 30, 0.14);
  --green: #3ddc84;
  --green-soft: rgba(61, 220, 132, 0.14);
  --red: #ff5f57;
  --red-soft: rgba(255, 95, 87, 0.14);
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  padding: calc(64px + var(--safe-t)) 0 calc(96px + var(--safe-b));
  background:
    radial-gradient(120% 60% at 90% -10%, rgba(240,130,30,.16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 19px; letter-spacing: .2px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer;
}
.dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ---------- layout ---------- */
main { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.hello { color: var(--muted); margin: 8px 0 0; }
.hero { font-size: 30px; line-height: 1.12; font-weight: 600; margin: 4px 0 18px; letter-spacing: -.3px; }
.section { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 10px; }
.section h2 { margin: 0; font-size: 16px; font-weight: 600; }
.section a, .link { color: var(--muted); font-size: 13px; text-decoration: none; cursor: pointer; }
.muted { color: var(--muted); } .faint { color: var(--faint); font-size: 12px; }
.up { color: var(--green); } .down { color: var(--red); }

.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
.card + .card { margin-top: 10px; }
.tap { cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.tap:active { transform: scale(.985); border-color: #3a3a42; }

.cta {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  border: 0; border-radius: 16px; cursor: pointer; font-weight: 600; font-size: 16px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 28px rgba(240,130,30,.28);
}
.cta span { flex: 1; text-align: left; }
.btn {
  border: 1px solid var(--line); background: var(--card-2); border-radius: 12px;
  padding: 10px 14px; cursor: pointer; font-weight: 500;
}
.btn.accent { background: var(--accent-soft); border-color: rgba(240,130,30,.4); color: #ffb36b; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }

/* quick tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 6px 10px;
  display: grid; place-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; position: relative;
}
.tile svg { color: var(--accent); width: 26px; height: 26px; }
.badge {
  position: absolute; top: -6px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center;
}

/* pills */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.LONG { background: var(--green-soft); color: var(--green); }
.pill.SHORT { background: var(--red-soft); color: var(--red); }
.pill.WAIT { background: #26262d; color: #c7c7cf; }
.pill.next { background: var(--accent-soft); color: #ffb36b; }

/* signal cards */
.sig-head { display: flex; align-items: center; gap: 10px; }
.sym { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.coin {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: #23232a; color: #ffb36b; font-weight: 700; font-size: 13px; border: 1px solid var(--line);
}
.levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.levels div { background: #121216; border: 1px solid var(--line); border-radius: 10px; padding: 6px 7px; min-width: 0; }
.levels b { display: block; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.levels span { font-size: 11px; color: var(--muted); }
.score-bar { height: 6px; border-radius: 3px; background: #26262d; overflow: hidden; margin-top: 8px; }
.score-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.reasons { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* list */
.list .item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.list .item + .item { border-top: 1px solid var(--line); }
.list.card { padding: 0; overflow: hidden; }
.right { text-align: right; }

/* pair detail */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric { padding: 12px 14px; }
.metric .label { color: var(--muted); font-size: 12px; }
.metric .value { font-size: 20px; font-weight: 600; margin-top: 2px; }
.metric .sub { font-size: 12px; margin-top: 2px; }
.gauge { display: grid; place-items: center; }
.gauge svg { width: 120px; height: 70px; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.check:first-child { border-top: 0; }
.check .val { color: #d5d5dc; font-size: 13px; }
.check .note { color: var(--muted); font-size: 12px; }
.heat-wrap { position: relative; border-radius: 14px; overflow: hidden; background: #2b0a3d; }
.heat-wrap canvas { width: 100%; display: block; touch-action: pan-y; }
.legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 8px; }
.news a { color: #dcdce2; text-decoration: none; }
.news .item { padding: 10px 0; border-top: 1px solid var(--line); }
.news .item:first-child { border-top: 0; }

/* search */
.search {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 16px; outline: none;
}
.search:focus { border-color: rgba(240,130,30,.6); }

/* positions */
.pnl { font-size: 28px; font-weight: 700; }

/* share */
.qr { background: #fff; border-radius: 16px; padding: 14px; width: 220px; margin: 12px auto; }
.qr svg { width: 100%; height: auto; display: block; }
.copy { word-break: break-all; font-size: 12px; color: var(--muted); text-align: center; }

.empty { text-align: center; color: var(--muted); padding: 22px 10px; }
.skeleton { height: 76px; border-radius: var(--radius); background: linear-gradient(90deg, #17171c, #202027, #17171c); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton + .skeleton { margin-top: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%);
  background: #26262d; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; z-index: 50; font-size: 14px;
}

/* ---------- bottom tabs ---------- */
.tabs {
  position: fixed; inset: auto 12px calc(10px + var(--safe-b)) 12px; z-index: 20;
  max-width: 536px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: rgba(23,23,28,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 24px; padding: 8px 6px;
}
.tabs button {
  background: none; border: 0; display: grid; place-items: center; gap: 2px; cursor: pointer;
  color: var(--muted); font-size: 11px; padding: 4px 0;
}
.tabs button.active { color: var(--accent); }
.tabs .fab {
  width: 56px; height: 56px; margin: -30px auto 0; border-radius: 50%; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px rgba(240,130,30,.4);
}
.tabs .fab svg { width: 26px; height: 26px; }
@media (max-width: 420px) {
  .levels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .levels b { font-size: 14px; }
}

[hidden] { display: none !important; }

/* P&L calendar */
.cal .mini-btn { padding: 4px 12px; border-radius: 10px; }
.cal .mini-btn:disabled { opacity: .35; }
.winbar { height: 6px; border-radius: 3px; background: var(--red-soft); overflow: hidden; margin: 8px 0 6px; }
.winbar i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--faint); padding-bottom: 2px; }
.cal-day { min-height: 54px; border-radius: 10px; background: #121216; border: 1px solid var(--line);
  padding: 4px 3px; display: flex; flex-direction: column; align-items: center; gap: 1px; overflow: hidden; }
.cal-day.win { background: rgba(61,220,132,.13); border-color: rgba(61,220,132,.3); cursor: pointer; }
.cal-day.loss { background: rgba(255,95,87,.12); border-color: rgba(255,95,87,.3); cursor: pointer; }
.cal-day.flat { cursor: pointer; }
.cal-day.today { border-color: var(--accent); }
.cal-day.sel { outline: 2px solid var(--accent); }
.cal-n { font-size: 11px; color: var(--muted); align-self: flex-start; padding-left: 2px; }
.cal-v { font-size: 11px; font-weight: 700; white-space: nowrap; }
.cal-day.win .cal-v { color: var(--green); } .cal-day.loss .cal-v { color: var(--red); }
.cal-t { font-size: 9px; color: var(--faint); }
