:root {
  --bg: #0a0c0e;
  --bg-2: #11151a;
  --panel: #161b22;
  --panel-2: #1b222b;
  --ink: #f3f5f7;
  --muted: #8b95a1;
  --line: rgba(243, 245, 247, 0.08);
  --ok: #3dd68c;
  --bad: #ff6b6b;
  --accent: #3dd68c;
  --radius: 18px;
  --font: "Manrope", sans-serif;
  --display: "Sora", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --btc: #ff7a18;
  --eth: #3b9eff;
  --bnb: #f5c518;
  --link: #20c997;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.35rem 1rem;
  background: #0d1014;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.side-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.25rem 0.4rem;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #243029, #1a2220);
  border: 1px solid rgba(61, 214, 140, 0.25);
  color: var(--ok);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.85rem;
}

.side-brand strong {
  display: block;
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.side-brand small {
  color: var(--muted);
  font-size: 0.75rem;
}

.side-nav {
  display: grid;
  gap: 0.35rem;
}

.side-nav a {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.side-nav a.active,
.side-nav a:hover {
  background: var(--panel);
  color: var(--ink);
}

#reloadBtn {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.85rem 1rem;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#reloadBtn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.main {
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 2.5rem;
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(61, 214, 140, 0.07), transparent 50%),
    radial-gradient(700px 380px at 10% 0%, rgba(91, 159, 239, 0.05), transparent 45%),
    var(--bg);
}

.top {
  margin-bottom: 1.25rem;
}

.greet {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.top h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.04em;
  font-weight: 650;
}

.sub {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.connect {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.connect h2 {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-size: 1.1rem;
}

.connect ol {
  margin: 0;
  color: var(--muted);
}

.portfolio {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.balance-card,
.asset-card,
.chart-card,
.howto article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.balance-card {
  padding: 1.35rem 1.4rem 1.2rem;
}

.balance-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.balance-value {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.2rem, 4.5vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.pill.up {
  background: rgba(61, 214, 140, 0.16);
  color: var(--ok);
}

.pill.down {
  background: rgba(255, 107, 107, 0.16);
  color: var(--bad);
}

.balance-sub {
  margin: 0.55rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.stack-bar {
  display: flex;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  gap: 3px;
  background: rgba(255, 255, 255, 0.03);
  padding: 2px;
}

.stack-bar .stack-seg {
  display: grid;
  place-items: center;
  height: 100%;
  border-radius: 999px;
  min-width: 28px;
  position: relative;
  overflow: hidden;
}

.stack-bar .stack-seg em {
  font-style: normal;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #0a0c0e;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
  white-space: nowrap;
  line-height: 1;
}

.stack-bar .stack-seg.is-narrow em {
  font-size: 0.56rem;
  letter-spacing: 0;
}

.stack-legend {
  list-style: none;
  margin: 0.95rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}

.stack-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem 0.28rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.stack-legend .leg-name {
  color: var(--ink);
  font-weight: 700;
  min-width: 2.4rem;
}

.stack-legend strong {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.asset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.asset-card {
  padding: 1rem 1.05rem;
  background: var(--panel-2);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.asset-card:hover {
  border-color: rgba(243, 245, 247, 0.16);
  transform: translateY(-1px);
}

.asset-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: start;
  margin-bottom: 0.85rem;
}

.asset-id {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.token-icon,
.token-badge,
.trade-token,
.token-fallback {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.token-fallback {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.68rem;
  color: #0a0c0e;
}

.asset-id .name {
  font-weight: 750;
  letter-spacing: -0.02em;
}

.asset-id .ticker {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.asset-chg {
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.asset-chg.pill.up {
  background: rgba(61, 214, 140, 0.16);
  color: var(--ok);
}

.asset-chg.pill.down {
  background: rgba(255, 107, 107, 0.16);
  color: var(--bad);
}

.up {
  color: var(--ok);
}

.down {
  color: var(--bad);
}

.asset-qty {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.asset-name-inline {
  display: none;
}

.asset-usd {
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.asset-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.asset-foot .asset-usd {
  flex: 1 0 100%;
  margin-bottom: 0.15rem;
  font-size: 0.9rem;
}

.section-head {
  margin: 0.4rem 0 0.55rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.interval-bar {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.28rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.interval-bar button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.interval-bar button.active {
  background: var(--panel-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(243, 245, 247, 0.08);
}

.interval-bar button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.live-line {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.live-line::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.18);
  vertical-align: middle;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.sk {
  display: inline-block;
  vertical-align: middle;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.1) 45%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.sk-lg {
  width: min(220px, 55vw);
  height: 2.2rem;
}

.sk-md {
  width: min(180px, 50vw);
  height: 0.9rem;
}

.sk-sm {
  width: 72px;
  height: 0.85rem;
}

.sk-xs {
  width: 42px;
  height: 0.7rem;
}

.sk-pill {
  min-width: 84px;
  min-height: 1.7rem;
  background: rgba(255, 255, 255, 0.04) !important;
  color: transparent !important;
}

.sk-bar {
  gap: 3px;
}

.sk-bar-seg {
  display: block;
  height: 100%;
  border-radius: 999px;
  animation: shimmer 1.2s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.12) 45%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
}

.sk-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.sk-card {
  min-height: 78px;
  padding: 0.85rem 0.9rem;
}

.sk-line {
  display: block;
  width: 100%;
  height: 0.7rem;
  margin-top: 0.45rem;
}

.sk-line.w40 { width: 40%; }
.sk-line.w55 { width: 55%; }
.sk-line.w70 { width: 70%; }
.sk-line.w85 { width: 85%; }

.sk-chart-card {
  min-height: 420px;
}

.sk-chart-stage {
  height: 180px;
  margin-top: 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.sk-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.sk-metric {
  height: 52px;
  border-radius: 12px;
}

.is-loading .balance-card,
.is-loading .charts {
  pointer-events: none;
}

.charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chart-card {
  padding: 1.15rem 1.15rem 0.9rem;
  background:
    radial-gradient(420px 180px at 90% 0%, color-mix(in srgb, var(--token, #3dd68c) 14%, transparent), transparent 60%),
    var(--panel);
  overflow: hidden;
}

.chart-card header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  align-items: start;
}

.chart-card h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.chart-card .pair {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.chart-card header .meta {
  text-align: right;
}

.chart-price {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.chart-pnl {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.token-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.token-badge {
  box-shadow: 0 0 24px color-mix(in srgb, var(--token, #3dd68c) 28%, transparent);
}

.trade-token {
  width: 22px;
  height: 22px;
  border-radius: 7px;
}

.chart-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.metric {
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.chart-stage {
  height: 230px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    rgba(0, 0, 0, 0.18);
  padding: 0.45rem 0.35rem 0.2rem;
  position: relative;
}

.chart-legend {
  display: flex;
  gap: 0.85rem;
  justify-content: flex-end;
  margin: 0.55rem 0 0.15rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
}

.chart-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.chart-legend .buy-dot {
  background: #f3f5f7;
  border: 2px solid #ff7a18;
  width: 8px;
  height: 8px;
  box-sizing: border-box;
}

.chart-legend .avg {
  width: 14px;
  height: 0;
  border-top: 2px dashed #ff5c8a;
  border-radius: 0;
  background: transparent;
}

.trades-head {
  margin: 0.75rem 0 0.45rem;
}

.trades-title {
  margin: 0;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trades-hint {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.35;
}

.trades-cols {
  display: grid;
  grid-template-columns: 22px 0.9fr 1.1fr 1fr 1.1fr;
  gap: 0.55rem;
  padding: 0 0.2rem 0.35rem 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.trades {
  list-style: none;
  margin: 0;
  padding: 0 0.2rem 0 0;
  max-height: 168px;
  overflow: auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  scrollbar-width: thin;
  scrollbar-color: rgba(243, 245, 247, 0.22) rgba(255, 255, 255, 0.04);
}

.trades::-webkit-scrollbar {
  width: 6px;
}

.trades::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.trades::-webkit-scrollbar-thumb {
  background: rgba(243, 245, 247, 0.22);
  border-radius: 999px;
}

.trades::-webkit-scrollbar-thumb:hover {
  background: rgba(243, 245, 247, 0.38);
}

.dca-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0 0 0.75rem;
}

.dca-strip > div {
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.dca-label {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dca-strip strong {
  display: inline-block;
  margin-top: 0.25rem;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dca-strip em {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 500;
  line-height: 1.35;
}

.trades li {
  display: grid;
  grid-template-columns: 22px 0.9fr 1.1fr 1fr 1.1fr;
  gap: 0.55rem;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 0.48rem 0;
  min-height: 42px;
}

.trade-date {
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.trade-px {
  color: var(--ink);
  font-weight: 650;
  white-space: nowrap;
}

.trade-usdt {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.trade-amt {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  justify-self: end;
}

.trade-compact {
  display: none;
}

@media (max-width: 980px) {
  .section-head {
    align-items: start;
    gap: 0.75rem;
  }

  .interval-bar {
    width: 100%;
    justify-content: space-between;
  }

  .interval-bar button {
    flex: 1;
    padding: 0.42rem 0.35rem;
    font-size: 0.74rem;
  }

  .live-line {
    margin-bottom: 0.65rem;
    font-size: 0.76rem;
  }

  .chart-card {
    padding: 0.85rem 0.8rem 0.7rem;
  }

  .chart-card header {
    margin-bottom: 0.55rem;
    gap: 0.6rem;
  }

  .chart-card h3 {
    font-size: 1rem;
  }

  .chart-card .pair {
    font-size: 0.72rem;
  }

  .chart-price {
    font-size: 1.1rem;
  }

  .chart-pnl {
    font-size: 0.74rem;
  }

  .chart-card .token-badge {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .chart-metrics {
    gap: 0.4rem;
    margin-bottom: 0.55rem;
  }

  .metric {
    padding: 0.45rem 0.5rem;
    border-radius: 10px;
  }

  .metric span {
    font-size: 0.62rem;
  }

  .metric strong {
    margin-top: 0.15rem;
    font-size: 0.82rem;
  }

  .chart-stage {
    height: 180px;
    border-radius: 12px;
    padding: 0.25rem 0.15rem 0.1rem;
  }

  .chart-legend {
    gap: 0.55rem;
    margin: 0.4rem 0 0;
    font-size: 0.68rem;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .trades-head {
    margin: 0.55rem 0 0.35rem;
  }

  .trades-title {
    font-size: 0.72rem;
  }

  .trades-cols {
    display: none;
  }

  .trades-hint {
    font-size: 0.7rem;
    line-height: 1.35;
  }

  .trades {
    max-height: none;
    overflow: visible;
    display: grid;
    gap: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
  }

  .trades li {
    grid-template-columns: minmax(0, 1.3fr) auto auto;
    grid-template-areas: "compact px usdt";
    gap: 0.35rem 0.5rem;
    min-height: 0;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    border-top: 1px solid var(--line);
    align-items: center;
  }

  .trades li:first-child {
    border-top: 0;
  }

  .trade-token,
  .trade-date,
  .trade-amt {
    display: none;
  }

  .trade-compact {
    display: block;
    grid-area: compact;
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .trade-px {
    grid-area: px;
    font-size: 0.74rem;
    justify-self: end;
    color: var(--muted);
  }

  .trade-usdt {
    grid-area: usdt;
    justify-self: end;
    font-size: 0.78rem;
    min-width: 3.6rem;
    text-align: right;
  }
}

.howto {
  margin-top: 1.75rem;
}

.howto h2 {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.howto-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.howto article {
  padding: 1rem 1.05rem;
}

.howto h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.howto p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.08em 0.35em;
  border-radius: 6px;
}

@media (max-width: 1100px) {
  .portfolio {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    display: none;
  }

  #reloadBtn {
    margin-top: 0;
    margin-left: auto;
  }

  .charts,
  .howto-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .portfolio {
    gap: 0.75rem;
    margin-bottom: 1.1rem;
  }

  .balance-card {
    padding: 1rem 1.05rem 0.95rem;
  }

  .balance-value {
    font-size: 2rem;
  }

  .stack-legend {
    gap: 0.4rem;
  }

  .stack-legend li {
    padding: 0.22rem 0.45rem;
    font-size: 0.78rem;
  }

  .asset-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .asset-card {
    padding: 0.65rem 0.7rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "id qty chg"
      "id meta chg";
    column-gap: 0.65rem;
    row-gap: 0.12rem;
    align-items: center;
  }

  .asset-top {
    display: contents;
    margin: 0;
  }

  .asset-id {
    grid-area: id;
    gap: 0;
  }

  .asset-id > div {
    display: none;
  }

  .asset-card .token-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .asset-chg {
    grid-area: chg;
    justify-self: end;
    align-self: center;
    font-size: 0.7rem;
    padding: 0.26rem 0.48rem;
  }

  .asset-qty {
    grid-area: qty;
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.15;
  }

  .asset-name-inline {
    display: inline;
    margin-right: 0.2rem;
  }

  .asset-foot {
    grid-area: meta;
    margin: 0;
    font-size: 0.72rem;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.35rem;
    line-height: 1.25;
  }

  .asset-foot .asset-usd {
    flex: 0 0 auto;
    margin: 0;
    font-size: 0.72rem;
  }

  .asset-foot span:not(:last-child)::after {
    content: "·";
    margin-left: 0.35rem;
    opacity: 0.7;
  }
}
