:root {
  --bg: #181a20;
  --panel: #1f252e;
  --panel-2: #252c37;
  --panel-3: #2a313d;
  --line: #2e3540;
  --text: #eef1f6;
  --muted: #9aa3ae;
  --dim: #6f7885;
  --yellow: #f0b90b;
  --green: #0ecb81;
  --red: #f6465d;
  --blue: #4c9dff;
  --blue-soft: #8ec5ff;
  --purple: #7b61ff;
  --shadow: rgba(0, 0, 0, 0.28);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: #07090d; }
body {
  margin: 0;
  min-height: 100vh;
  background: #07090d;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
button, input { font: inherit; }
button {
  color: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.phone-shell {
  position: relative;
  width: min(100vw, 430px);
  min-width: 390px;
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: hidden;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(31, 37, 46, 0.98);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.statusbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  height: 30px;
  padding: 8px 24px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.status-icons { font-size: 9px; color: #dfe4eb; }
.network { font-size: 10px; color: #dfe4eb; }
.app-nav {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  height: 58px;
  padding: 0 14px;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  transition: background 0.16s, transform 0.16s;
}
.icon-btn svg { width: 26px; height: 26px; }
.icon-btn:active,
.mini-icon:active,
.range-tabs button:active,
.month-btn:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.07); }
.title-btn {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}
.title-btn span {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #c7cdd4;
}

.market-tabs, .section-tabs, .range-tabs {
  display: flex;
  align-items: center;
  gap: 22px;
}
.market-tabs {
  height: 62px;
  padding: 0 24px;
  font-size: 25px;
  font-weight: 700;
}
.market-tabs button, .section-tabs button {
  position: relative;
  flex: 0 0 auto;
  color: var(--muted);
  transition: color 0.2s, transform 0.2s;
}
.market-tabs button.active, .section-tabs button.active { color: var(--text); }
.market-tabs button::after, .section-tabs button::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -17px;
  width: 0;
  height: 4px;
  border-radius: 10px;
  background: var(--yellow);
  transform: translateX(-50%);
  transition: width 0.22s;
}
.market-tabs button.active::after { width: 28px; }

.hero-panel {
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 16px;
}
.label-row svg { width: 20px; color: var(--dim); }
.today-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  color: var(--text);
}
.today-value span {
  font-size: 47px;
  font-weight: 700;
  line-height: 0.95;
}
.today-value small {
  font-size: 18px;
  font-weight: 500;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 26px;
}
.metric button {
  width: 100%;
  text-align: left;
  border-radius: 6px;
}
.metric label, .summary-row label {
  display: block;
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 8px;
}
.metric strong {
  display: block;
  min-height: 28px;
  font-size: 23px;
  line-height: 1.05;
}
.metric span {
  display: block;
  margin-top: 7px;
  font-size: 16px;
}

.content { padding: 26px 24px 44px; }
.range-tabs {
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  color: var(--muted);
  font-size: 17px;
}
.range-tabs::-webkit-scrollbar, .section-tabs::-webkit-scrollbar { display: none; }
.range-tabs button {
  min-width: 52px;
  height: 38px;
  border-radius: 7px;
  color: var(--muted);
  transition: background 0.18s, color 0.18s;
}
.range-tabs button.active {
  color: var(--text);
  background: var(--panel-3);
}
.summary-block { margin-top: 28px; }
.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  min-height: 40px;
}
.summary-row label {
  display: inline-block;
  margin: 0;
  border-bottom: 1px dotted #5c6571;
}
.summary-row button {
  text-align: right;
  font-size: 20px;
  min-width: 122px;
}
.drop-cue {
  display: grid;
  place-items: center;
  width: 44px;
  height: 32px;
  margin: 8px auto 26px;
  color: var(--dim);
}
.drop-cue svg { width: 22px; }
.section-tabs {
  position: relative;
  gap: 20px;
  overflow-x: auto;
  padding: 4px 0 26px;
  font-size: 23px;
  font-weight: 650;
  white-space: nowrap;
  scrollbar-width: none;
}
.section-tabs button.has-dot::before {
  content: "";
  position: absolute;
  top: -3px;
  right: -4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--yellow);
}
.section-tabs button::after { bottom: -12px; height: 4px; }
.section-tabs button.active::after { width: 25px; }
.section { display: none; animation: fadeIn 0.22s ease; }
.section.active { display: block; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.15;
}
.view-toggle {
  display: flex;
  padding: 4px;
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.mini-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 40px;
  border-radius: 5px;
  color: var(--muted);
}
.mini-icon.active { background: #202732; color: #dfe5ec; }
.mini-icon svg { width: 24px; height: 24px; }
.month-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 2px 0 24px;
}
.month-label {
  min-width: 110px;
  font-size: 21px;
  font-weight: 750;
}
.month-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--dim);
  font-size: 25px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}
.weekday {
  height: 28px;
  color: var(--muted);
  text-align: center;
  font-size: 15px;
}
.day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 67px;
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  transition: transform 0.16s, filter 0.16s, background 0.16s;
}
.day-cell:active { transform: scale(0.96); filter: brightness(1.1); }
.day-cell.empty { visibility: hidden; }
.day-cell .day-num {
  font-size: 18px;
  font-weight: 650;
  line-height: 1.1;
}
.day-cell .day-pnl {
  margin-top: 8px;
  font-size: 13px;
  color: var(--dim);
}
.day-cell.pos { background: rgba(14, 203, 129, 0.12); }
.day-cell.pos .day-pnl { color: var(--green); }
.day-cell.neg { background: rgba(246, 70, 93, 0.13); }
.day-cell.neg .day-pnl { color: var(--red); }
.day-cell.today::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid var(--panel-2);
  transform: translateX(-50%);
}

.chart-section { margin-top: 44px; }
.chart-section time, .asset-value time {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 17px;
}
.chart-total, .asset-total {
  margin-top: 22px;
  color: var(--red);
  font-size: 28px;
  font-weight: 750;
  text-align: left;
}
.asset-total { color: var(--text); }
.chart-wrap {
  width: 100%;
  height: 248px;
  margin-top: 32px;
}
.chart-wrap.tall { height: 270px; margin-top: 22px; }
.chart-svg { width: 100%; height: 100%; overflow: visible; }
.grid-line { stroke: #303742; stroke-width: 1; opacity: 0.55; }
.axis-label { fill: var(--muted); font-size: 12px; }
.line-yellow { stroke: var(--yellow); }
.line-blue { stroke: var(--blue); }
.line-soft { stroke: var(--blue-soft); }
.line-asset { stroke: var(--yellow); }
.data-line {
  fill: none;
  stroke-width: 1.7;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: d 0.24s ease;
}
.legend-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 22px;
}
.legend-item strong {
  display: block;
  color: var(--red);
  font-size: 26px;
  line-height: 1.1;
}
.legend-item span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}
.legend-item span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--yellow);
}
.legend-item:nth-child(2) span::before { background: var(--blue); }
.legend-item:nth-child(3) span::before { background: var(--blue-soft); }

.asset-summary {
  min-height: 390px;
  margin-top: 54px;
}
.empty-state {
  display: grid;
  place-items: center;
  gap: 16px;
  height: 265px;
  color: var(--muted);
  font-size: 19px;
}
.empty-state svg {
  width: 86px;
  height: 86px;
  color: #eff3f8;
  stroke-width: 1.8;
}
.note {
  margin: 28px 8px 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.neutral { color: var(--text) !important; }

.editable-trigger {
  border-radius: 6px;
  transition: background 0.16s, box-shadow 0.16s;
}
.editable-trigger:hover,
.editable-trigger:focus-visible {
  outline: 0;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 1px rgba(240, 185, 11, 0.12);
}
.placeholder {
  min-height: 580px;
  border-top: 1px solid transparent;
}

.float-widget {
  position: fixed;
  z-index: 50;
  right: calc(50vw - min(50vw, 215px) + 22px);
  top: 28%;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  color: #9c8cff;
  touch-action: none;
  filter: drop-shadow(0 0 12px rgba(123, 97, 255, 0.35));
}
.float-widget::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 14px;
  background: rgba(123, 97, 255, 0.1);
  box-shadow: 0 0 20px rgba(123, 97, 255, 0.25);
}
.float-widget .orbit {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 33px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, rgba(246, 70, 93, 0.35), rgba(123, 97, 255, 0.45));
  filter: blur(2px);
}
.float-widget svg {
  position: relative;
  width: 38px;
  height: 38px;
  stroke-width: 2.2;
}

.drawer {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 0;
  width: min(100vw, 430px);
  min-width: 390px;
  padding: 10px 20px 22px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: #202733;
  box-shadow: 0 -16px 35px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, calc(100% + 8px));
  transition: transform 0.24s ease;
}
.drawer.open { transform: translate(-50%, 0); }
.drawer-grip {
  width: 48px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 99px;
  background: #69727f;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.drawer-head strong { display: block; font-size: 18px; }
.drawer-head span, .drawer label {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}
.lock-toggle {
  display: flex !important;
  align-items: center;
  gap: 7px;
  margin: 0 !important;
}
.lock-toggle input { accent-color: var(--yellow); }
.drawer input#editInput {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid #3a4350;
  border-radius: 7px;
  outline: 0;
  background: #171c24;
  color: var(--text);
}
.drawer input#editInput:focus { border-color: var(--yellow); }
.drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.drawer-actions button {
  height: 42px;
  border-radius: 7px;
  font-weight: 700;
}
.drawer-actions .ghost { background: #2a313d; color: var(--muted); }
.drawer-actions .primary { background: var(--yellow); color: #16181d; }
.home-indicator {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 6px;
  width: 134px;
  height: 4px;
  border-radius: 999px;
  background: rgba(230, 235, 242, 0.72);
  transform: translateX(-50%);
  pointer-events: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 389px) {
  .phone-shell, .drawer { min-width: 320px; }
  .today-value span { font-size: 40px; }
  .metric-grid { gap: 12px; }
  .section-tabs { font-size: 20px; }
  .day-cell { min-height: 58px; }
}
