:root,
[data-theme="dark"] {
  --bg: #0d0e14;
  --bg-elevated: #12131a;
  --bg-row-hover: #14151c;
  --border: #1c1d26;
  --border-subtle: rgba(255, 255, 255, 0.05);
  --text: #ffffff;
  --text-secondary: #8e8e93;
  --text-tertiary: #636366;
  --accent: #0a84ff;
  --green: #0fb35c;
  --green-bg: #0f2819;
  --red: #fd3245;
  --red-bg: #2a1016;
  --yellow: #ffcc00;
  --yellow-bg: #2a2410;
  --purple: #bf5af2;
  --purple-bg: #25152d;
  --neutral-bg: #1e1f26;
  --tab-active-bg: #1e1f26;
  --nav-bg: rgba(13, 14, 20, 0.94);
  --fab-bg: #f2f2f7;
  --fab-color: #1c1c1e;
  --fab-shadow: rgba(0, 0, 0, 0.45);
  --skeleton-1: #0d0e14;
  --skeleton-2: #14151c;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --scroll-edge-bottom: 16px;
  --scroll-edge-bottom-floor: 0px;
  --app-height: 100dvh;
  --page-x: 6px;
  --pt-swipe-duration: 0.35s;
  --pt-swipe-easing: cubic-bezier(0.32, 0.72, 0, 1);
  --pt-back-duration: 0.24s;
  --pt-back-easing: cubic-bezier(0.28, 0.84, 0.18, 1);
  --pt-overlay-duration: 0.28s;
  --pt-overlay-easing: cubic-bezier(0.32, 0.72, 0, 1);
  --detail-title-size: 0.86rem;
  --price-box-on-color: #ffffff;
  --id-text: #4a4a4e;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-row-hover: #f5f5f7;
  --border: #e5e5ea;
  --border-subtle: rgba(0, 0, 0, 0.06);
  --text: #1c1c1e;
  --text-secondary: #636366;
  --text-tertiary: #8e8e93;
  --accent: #007aff;
  --green: #0fb35c;
  --green-bg: #e8f8ef;
  --red: #fd3245;
  --red-bg: #fde8eb;
  --yellow: #c99700;
  --yellow-bg: #fff8e0;
  --purple: #af52de;
  --purple-bg: #f7eafb;
  --neutral-bg: #f0f0f2;
  --tab-active-bg: #f0f0f2;
  --nav-bg: rgba(255, 255, 255, 0.94);
  --fab-bg: #1c1c1e;
  --fab-color: #ffffff;
  --fab-shadow: rgba(0, 0, 0, 0.2);
  --skeleton-1: #ffffff;
  --skeleton-2: #f5f5f7;
  --price-box-on-color: #ffffff;
  --id-text: var(--text-tertiary);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg);
  scrollbar-width: none;
  -ms-overflow-style: none;
  height: 100%;
  height: -webkit-fill-available;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  max-width: 480px;
  margin: 0 auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
}

.page-transition-shell {
  min-height: 0;
  background: var(--bg);
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.pt-back-preview {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
  visibility: hidden;
  pointer-events: none;
  will-change: transform;
  backface-visibility: hidden;
  transform: translate3d(var(--pt-swipe-back-parallax-x, -30vw), 0, 0);
}

.pt-back-preview > * {
  max-width: 480px;
  margin: 0 auto;
}

.pt-back-preview.is-visible {
  visibility: visible;
}

.pt-back-preview .pt-back-preview-home {
  position: relative;
  width: var(--pt-preview-vw, 100%);
  height: var(--pt-preview-vh, 100%);
  min-height: var(--pt-preview-vh, 100%);
  max-height: var(--pt-preview-vh, 100%);
  overflow: hidden;
  background: var(--bg);
  box-sizing: border-box;
}

.pt-back-preview .pt-back-preview-home .home-fixed-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  height: var(--pt-preview-header-h, auto);
  flex-shrink: 0;
  transform: none;
  z-index: 2;
  overflow: hidden;
}

.pt-back-preview .pt-back-preview-home .page-transition-shell {
  position: absolute;
  top: var(--pt-preview-header-h, 0px);
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  display: block;
  min-height: 0;
  height: auto;
  max-height: none;
}

.pt-back-preview .pt-back-preview-home .list-main {
  position: absolute;
  inset: 0;
  height: 100%;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-overflow-scrolling: auto;
  overscroll-behavior-y: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: none;
}

.pt-back-preview .pt-back-preview-home .list-main::-webkit-scrollbar {
  display: none;
}

.pt-back-preview .pt-back-preview-home .detail-swipe-viewport {
  overflow: hidden;
  overflow-x: hidden;
  height: 100%;
}

.pt-back-preview .pt-back-preview-home .detail-swipe-track {
  transition: none !important;
}

.pt-back-preview .pt-back-preview-home .detail-swipe-panel {
  overflow: hidden;
}

.pt-back-preview .pt-back-preview-home .detail-swipe-track:not(.is-dragging):not(.is-animating) .detail-swipe-panel:not(.is-visible) {
  visibility: hidden;
  height: 0;
  min-height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* 快照在 body.page-detail 内渲染，需隔离详情页样式，避免顶栏/时间错位 */
body.page-detail .pt-back-preview .pt-back-preview-home .home-fixed-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  transform: none;
  width: 100%;
  max-width: none;
}

body.page-detail .pt-back-preview .pt-back-preview-home .top-bar {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  width: 100%;
  max-width: none;
  z-index: auto;
  grid-template-columns: auto 1fr;
  padding: calc(8px + var(--safe-top)) var(--page-x) 8px;
  border-bottom: none;
}

body.page-detail .pt-back-preview .pt-back-preview-home .home-title-row,
body.page-detail .pt-back-preview .pt-back-preview-home .detail-title-row.home-title-row {
  justify-content: space-between;
}

body.page-detail .pt-back-preview .pt-back-preview-home .detail-meta {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  text-align: right;
}

body.page-detail .pt-back-preview .pt-back-preview-home .detail-meta .detail-updated-at {
  margin-left: 0;
}

body.page-detail .pt-back-preview .pt-back-preview-home .sub-tabs {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  width: 100%;
  max-width: none;
  flex: 0 0 auto;
  height: auto;
  padding: 6px var(--page-x) 10px;
}

body.page-detail .pt-back-preview .sub-tab-indicator {
  transition: none !important;
  opacity: 1 !important;
  box-sizing: border-box;
}

html.ios-standalone body.page-detail .pt-back-preview .pt-back-preview-home {
  min-height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
}

html.ios-standalone body.page-detail .pt-back-preview .pt-back-preview-home .top-bar {
  padding: calc(8px + var(--safe-top)) var(--page-x) 8px;
}

body.page-detail .pt-back-preview .pt-back-preview-home .home-columns-header,
body.page-detail .pt-back-preview .pt-back-preview-home .list-header {
  position: absolute;
  top: var(--pt-preview-header-h, auto);
  left: 0;
  right: 0;
  z-index: 1;
  box-shadow: none;
}

body.page-detail .pt-back-preview .pt-back-preview-home .list-row {
  align-items: center;
}

.pt-detail-swipe-front {
  position: relative;
  z-index: 1;
  min-height: var(--app-height, 100dvh);
  background: var(--bg);
}

body.page-detail.is-swipe-back-dragging .pt-detail-swipe-front {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  z-index: 2;
  transform: translate3d(var(--pt-swipe-back-x, 0px), 0, 0);
  box-shadow: var(--pt-swipe-back-shadow, none);
  transition: none;
  will-change: transform;
  backface-visibility: hidden;
}

body.page-detail.is-swipe-back-committing .pt-detail-swipe-front {
  transition: transform var(--pt-back-duration) var(--pt-back-easing), box-shadow var(--pt-back-duration) var(--pt-back-easing);
}

body.page-detail.is-swipe-back-dragging .pt-detail-swipe-front .page-transition-shell {
  position: static;
  inset: auto;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 100%;
  max-height: none;
  margin: 0;
  transform: none;
  left: auto;
  box-shadow: none;
}

body.page-detail.is-swipe-back-dragging .pt-detail-swipe-front .top-bar,
body.page-detail.is-swipe-back-dragging .pt-detail-swipe-front .detail-sub-tabs {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  transform: none;
}

body.page-detail.is-swipe-back-dragging .pt-detail-swipe-front .top-bar {
  top: 0;
}

body.page-detail.is-swipe-back-dragging .pt-detail-swipe-front .detail-sub-tabs {
  top: var(--detail-header-h);
}

@keyframes pt-slide-enter-forward {
  from {
    transform: translate3d(100%, 0, 0);
    opacity: 0.92;
  }
  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes pt-slide-enter-back {
  from {
    transform: translate3d(-33%, 0, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes pt-slide-exit-back {
  from {
    transform: translate3d(0, 0, 0);
    box-shadow: none;
  }
  to {
    transform: translate3d(100%, 0, 0);
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.14);
  }
}

.page-transition-shell.pt-enter-forward {
  animation: pt-slide-enter-forward var(--pt-swipe-duration) var(--pt-swipe-easing) both;
}

.page-transition-shell.pt-enter-back {
  animation: pt-slide-enter-back var(--pt-back-duration) var(--pt-back-easing) both;
}

.page-transition-shell.pt-exit-back {
  animation: pt-slide-exit-back var(--pt-back-duration) var(--pt-back-easing) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .page-transition-shell.pt-enter-forward,
  .page-transition-shell.pt-enter-back,
  .page-transition-shell.pt-exit-back,
  .home-columns-header.pt-enter-back,
  .home-columns-header.pt-enter-forward {
    animation: none !important;
  }

  .detail-swipe-track.is-animating,
  .detail-swipe-track.is-dragging .detail-swipe-panel {
    transition: none !important;
  }

  .sub-tab-indicator,
  .drawer-overlay,
  .side-drawer,
  .rebalance-modal-overlay,
  .rebalance-modal {
    transition: none !important;
    animation: none !important;
  }
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ── Top bar ── */
.top-bar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: calc(8px + var(--safe-top)) var(--page-x) 8px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-title {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--text);
  border-radius: 10px;
}

.icon-btn:active {
  background: var(--bg-elevated);
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* ── Sub tabs ── */
.sub-tabs {
  display: flex;
  gap: 6px;
  padding: 6px var(--page-x) 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.sub-tabs--home,
.sub-tabs--detail {
  gap: 4px;
}

.sub-tabs--home .sub-tab,
.sub-tabs--detail .sub-tab {
  padding: 6px 11px;
}

.sub-tabs--home .sub-tab--platform,
.sub-tabs--detail .sub-tab--platform {
  gap: 5px;
}

.sub-tabs--home [data-home-tab="rebalance"],
.sub-tabs--detail [data-tab="rebalance"] {
  margin-left: 2px;
}

.sub-tab-indicator {
  position: absolute;
  top: 6px;
  left: 0;
  height: calc(100% - 16px);
  border-radius: 20px;
  background: var(--tab-active-bg);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(0.96);
  transition:
    transform var(--pt-swipe-duration) var(--pt-swipe-easing),
    width var(--pt-swipe-duration) var(--pt-swipe-easing),
    opacity 0.18s ease;
  will-change: transform, width;
}

.sub-tabs.has-indicator .sub-tab-indicator {
  opacity: 1;
}

.sub-tabs .sub-tab {
  position: relative;
  z-index: 1;
}

.sub-tabs::-webkit-scrollbar {
  display: none;
}

.sub-tab {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  position: relative;
}

.sub-tab--platform {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sub-tabs .sub-tab[hidden] {
  display: none;
}

.sub-tab--icon-only {
  padding-left: 9px;
  padding-right: 9px;
  gap: 0;
}

.sub-tab-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  display: block;
  overflow: visible;
}

.sub-tab-icon .platform-avatar-fallback {
  font-size: 0.55rem;
}

.sub-tab-icon--glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--text-secondary) 14%, transparent);
  color: var(--text-secondary);
}

.sub-tab.active .sub-tab-icon--glyph {
  background: color-mix(in srgb, var(--text) 12%, transparent);
  color: var(--text);
}

.sub-tab-icon-slot {
  --sub-tab-icon-size: 18px;
  position: relative;
  width: var(--sub-tab-icon-size);
  height: var(--sub-tab-icon-size);
  flex-shrink: 0;
  display: grid;
}

.sub-tab-icon-slot > * {
  grid-area: 1 / 1;
}

.sub-tab-icon-slot .sub-tab-icon {
  width: var(--sub-tab-icon-size);
  height: var(--sub-tab-icon-size);
}

.sub-tab-badge {
  width: var(--sub-tab-icon-size);
  height: var(--sub-tab-icon-size);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  background: #ff3b30;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  box-sizing: border-box;
  z-index: 1;
  pointer-events: none;
}

.sub-tab-icon-slot:not(.has-tab-badge) .sub-tab-badge {
  display: none;
}

.sub-tab.active {
  background: transparent;
  color: var(--text);
}

.sub-tabs:not(.has-indicator) .sub-tab.active {
  background: var(--tab-active-bg);
}

/* ── List header ── */
.list-header,
.home-columns-header {
  display: grid;
  grid-template-columns: 1fr 80px 96px;
  gap: 4px;
  padding: 6px var(--page-x) 8px;
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.home-columns-header {
  position: fixed;
  top: var(--home-fixed-header-h);
  left: 0;
  right: 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  z-index: 95;
  background: var(--bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  box-sizing: border-box;
  will-change: transform;
  backface-visibility: hidden;
}

.home-columns-header.pt-enter-back {
  animation: pt-slide-enter-back var(--pt-back-duration) var(--pt-back-easing) both;
}

body.page-home:is(.home-tab-rebalance, .home-tab-logs) .home-columns-header {
  display: none;
}

.home-columns-header .sortable .sort-icon {
  display: inline-flex;
  visibility: hidden;
  opacity: 0;
}

.home-columns-header .sortable.active .sort-icon {
  visibility: visible;
  opacity: 1;
}

.list-header .sortable {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.list-header .col-price.sortable {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 3px;
  align-items: center;
  justify-self: stretch;
  width: 100%;
}

.list-header .col-price.sortable .sort-icon {
  justify-self: end;
}

.list-header .sortable.active {
  color: var(--text-primary);
}

.list-header .sortable .sort-icon {
  display: none;
}

.sort-icon {
  opacity: 0.6;
  transition: transform 0.15s ease;
}

.list-header .sortable.active .sort-icon {
  display: inline-flex;
  opacity: 1;
}

.list-header .sortable.asc .sort-icon {
  transform: rotate(180deg);
}

.col-sparkline {
  text-align: right;
}

.col-price {
  text-align: right;
}

/* ── List rows ── */
.list-main {
  padding-bottom: max(var(--scroll-edge-bottom), var(--scroll-edge-bottom-floor));
}

.portfolio-list {
  display: flex;
  flex-direction: column;
}

.list-row {
  display: grid;
  grid-template-columns: 1fr 80px 96px;
  gap: 4px;
  align-items: center;
  padding: 14px var(--page-x);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.12s;
}

a.list-row {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a.list-row:active {
  background: var(--bg-row-hover);
}

a.pt-nav-forward {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.col-product {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.asset-info {
  min-width: 0;
}

.asset-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.asset-icon-wrap {
  position: relative;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.market-pause-icon {
  position: absolute;
  left: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff3b30;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-sizing: border-box;
  border: 1px solid var(--bg);
  pointer-events: none;
}

.platform-avatar {
  position: relative;
  background: var(--avatar-fallback, #8e8e93);
}

.platform-avatar[data-platform="usmart"].has-image,
.platform-avatar[data-platform="futunn"].has-image {
  background-color: transparent;
  background-image: var(--platform-avatar-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.platform-avatar[data-platform="usmart"].has-image:not(.is-ready),
.platform-avatar[data-platform="futunn"].has-image:not(.is-ready) {
  background-color: rgba(255, 255, 255, 0.04);
}

.platform-avatar[data-platform="usmart"] .platform-avatar-fallback,
.platform-avatar[data-platform="futunn"] .platform-avatar-fallback {
  opacity: 0;
  transition: none;
}

.platform-avatar[data-platform="usmart"].is-fallback .platform-avatar-fallback,
.platform-avatar[data-platform="futunn"].is-fallback .platform-avatar-fallback {
  opacity: 1;
}

.platform-avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  user-select: none;
  transition: opacity 0.12s ease;
}

.platform-avatar-image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.user-avatar-photo .platform-avatar-image {
  opacity: 0;
}

.user-avatar-photo.has-image .platform-avatar-image {
  opacity: 1;
}

.user-avatar-photo.has-image .platform-avatar-fallback {
  opacity: 0;
}

.platform-avatar.has-image .platform-avatar-image {
  opacity: 1;
}

.platform-avatar.has-image .platform-avatar-fallback {
  opacity: 0;
}

.asset-icon-fallback,
.portfolio-config-icon.is-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--avatar-fallback, #8e8e93);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}

.portfolio-config-icon .platform-avatar-fallback {
  font-size: 0.5rem;
}

.asset-name {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.asset-name-row .asset-name {
  min-width: 0;
}

.refresh-error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  color: var(--red);
  flex: 0 0 13px;
  line-height: 1;
}

.refresh-error-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.asset-tag {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.asset-tag--paused {
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  line-height: 1.4;
}

.detail-paused-tag {
  margin-right: 2px;
}

.list-row.is-refresh-paused .asset-name {
  opacity: 0.88;
}

.asset-sub {
  font-size: 0.72rem;
  color: var(--id-text);
  line-height: 1.35;
}

.asset-sub--tagged {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.asset-sub--tagged .asset-id {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-sub--tagged .rebalance-action-tag {
  flex-shrink: 0;
  min-width: 0;
  margin-right: 0;
  padding: 0 3px;
  font-size: 0.6rem;
  line-height: 1;
  height: calc(0.72rem * 1.35);
  border-radius: 3px;
}

.rebalance-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rebalance-hint-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rebalance-hint .rebalance-action-tag {
  flex-shrink: 0;
  min-width: 0;
  margin-right: 0;
  padding: 0 3px;
  font-size: 0.6rem;
  line-height: 1;
  height: calc(0.72rem * 1.35);
  border-radius: 3px;
}

/* ── Aggregate rebalance history ── */
.aggregate-rebalance-row {
  padding: 14px var(--page-x);
}

.aggregate-rebalance-group:not(:last-child) {
  border-bottom: 1px solid var(--border-subtle);
}

.aggregate-rebalance-group:last-child {
  border-bottom: none;
}

.aggregate-rebalance-meta {
  margin-bottom: 0;
}

.aggregate-rebalance-group:not(.is-collapsed) .aggregate-rebalance-meta {
  margin-bottom: 8px;
}

.aggregate-portfolio {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.aggregate-portfolio .asset-icon {
  width: 28px;
  height: 28px;
}

.aggregate-portfolio-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.aggregate-portfolio-copy strong {
  overflow: hidden;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aggregate-portfolio-copy small {
  color: var(--text-tertiary);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.35;
  margin-top: 0;
}

.aggregate-portfolio-meta-text {
  position: relative;
  top: 1px;
}

.aggregate-rebalance-trades {
  display: flex;
  flex-direction: column;
  margin-left: calc(-1 * var(--page-x));
  margin-right: calc(-1 * var(--page-x));
}

.rebalance-view-controls {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px var(--page-x) 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.rebalance-control-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
}

.rebalance-dropdown-filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  min-width: 0;
}

.rebalance-control-row {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface-secondary);
}

.rebalance-control-btn {
  flex: none;
  min-height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.rebalance-control-btn.active {
  background: var(--surface-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.rebalance-view-switch {
  gap: 4px;
  padding: 0;
  background: transparent;
}

.rebalance-view-switch .rebalance-control-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding-inline: 7px;
  border-radius: 20px;
  font-size: 0.7rem;
}

.rebalance-view-switch .rebalance-control-btn.active {
  background: var(--tab-active-bg);
  box-shadow: none;
}

.rebalance-view-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text-secondary) 14%, transparent);
  color: var(--text-secondary);
}

.rebalance-view-switch .rebalance-control-btn.active .rebalance-view-icon {
  background: color-mix(in srgb, var(--text) 12%, transparent);
  color: var(--text);
}

.rebalance-control-btn[hidden] {
  display: none;
}

.rebalance-market-dropdown,
.rebalance-action-dropdown {
  position: relative;
  z-index: 8;
}

.rebalance-market-dropdown[hidden] {
  display: none;
}

.rebalance-platform-cycle,
.rebalance-market-filter-summary,
.rebalance-action-filter-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  list-style: none;
  white-space: nowrap;
  cursor: pointer;
  width: 118px;
  box-sizing: border-box;
}

.rebalance-platform-cycle {
  background: var(--surface-secondary);
  padding-left: 16px;
  padding-right: 0;
  width: auto;
}

.rebalance-platform-cycle[hidden] {
  display: none;
}

.rebalance-platform-cycle-icons {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transform: translateX(8px);
}

.rebalance-platform-cycle-icons img {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}

.rebalance-market-filter-summary::-webkit-details-marker,
.rebalance-action-filter-summary::-webkit-details-marker {
  display: none;
}

.rebalance-market-dropdown[open] .rebalance-market-filter-summary,
.rebalance-action-dropdown[open] .rebalance-action-filter-summary {
  color: var(--text-primary);
}

.rebalance-market-dropdown[open] .rebalance-market-filter-summary svg,
.rebalance-action-dropdown[open] .rebalance-action-filter-summary svg {
  transform: rotate(180deg);
}

.rebalance-market-filter-selected,
.rebalance-action-filter-selected {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.rebalance-market-filter-selected {
  transform: translateX(8px);
}

.rebalance-market-filter-selected .market-tag,
.rebalance-market-option .market-tag,
.aggregate-symbol-title .market-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  min-height: 16px;
  padding-inline: 3px;
  border-radius: 4px;
  color: #fff;
  font-size: 0.55rem;
  font-style: normal;
  font-weight: 700;
  line-height: 16px;
}

.rebalance-market-filter-selected .market-tag,
.rebalance-action-filter-chip {
  width: 24px;
  min-width: 24px;
  box-sizing: border-box;
}

.rebalance-market-filter-selected .market-tag,
.rebalance-market-option .market-tag {
  font-weight: 500;
}

.rebalance-action-filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 650;
  line-height: 16px;
}

.rebalance-market-menu,
.rebalance-action-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  gap: 6px;
  min-width: 118px;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: #10141d;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .rebalance-market-filter-summary,
[data-theme="light"] .rebalance-action-filter-summary {
  background: transparent;
}

[data-theme="light"] .rebalance-market-menu,
[data-theme="light"] .rebalance-action-menu {
  background: #ffffff;
}

.rebalance-market-option,
.rebalance-action-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 28px;
  border: 0;
  padding: 0 8px;
  opacity: 1;
  font-size: 0.66rem;
  font-weight: 600;
  text-align: left;
}

.rebalance-market-option {
  justify-content: flex-start;
  gap: 7px;
  color: var(--text-secondary);
  border-radius: 6px;
  opacity: 1;
}

.rebalance-market-option[data-rebalance-market="us"] {
  background: #18365c;
}

.rebalance-market-option[data-rebalance-market="hk"] {
  background: #35285b;
}

.rebalance-market-option[data-rebalance-market="cn"] {
  background: #4d2328;
}

.rebalance-action-filter-chip.rebalance-action-tag--open,
.rebalance-action-option.rebalance-action-tag--open {
  background: #142d4e;
}

.rebalance-action-filter-chip.rebalance-action-tag--add,
.rebalance-action-option.rebalance-action-tag--add {
  background: #123725;
}

.rebalance-action-filter-chip.rebalance-action-tag--reduce,
.rebalance-action-option.rebalance-action-tag--reduce {
  background: #481a22;
}

.rebalance-action-filter-chip.rebalance-action-tag--close,
.rebalance-action-option.rebalance-action-tag--close {
  background: #3f3514;
}

[data-theme="light"] .rebalance-market-option[data-rebalance-market="us"] {
  background: #d8eaff;
}

[data-theme="light"] .rebalance-market-option[data-rebalance-market="hk"] {
  background: #e8ddff;
}

[data-theme="light"] .rebalance-market-option[data-rebalance-market="cn"] {
  background: #ffe0e0;
}

[data-theme="light"] .rebalance-action-filter-chip.rebalance-action-tag--open,
[data-theme="light"] .rebalance-action-option.rebalance-action-tag--open {
  background: #d9ebff;
}

[data-theme="light"] .rebalance-action-filter-chip.rebalance-action-tag--add,
[data-theme="light"] .rebalance-action-option.rebalance-action-tag--add {
  background: #d9f3e5;
}

[data-theme="light"] .rebalance-action-filter-chip.rebalance-action-tag--reduce,
[data-theme="light"] .rebalance-action-option.rebalance-action-tag--reduce {
  background: #ffe0e4;
}

[data-theme="light"] .rebalance-action-filter-chip.rebalance-action-tag--close,
[data-theme="light"] .rebalance-action-option.rebalance-action-tag--close {
  background: #fff2bf;
}

.rebalance-market-option > span:nth-child(2) {
  flex: 1;
  font-size: inherit;
  font-weight: inherit;
}

.rebalance-market-option i,
.rebalance-action-option i {
  visibility: hidden;
  font-style: normal;
  font-weight: 700;
}

.rebalance-market-option.active,
.rebalance-action-option.active {
  opacity: 1;
}

.rebalance-market-option.active i,
.rebalance-action-option.active i {
  visibility: visible;
}

@media (max-width: 430px) {
  .rebalance-control-top {
    gap: 5px;
  }

  .rebalance-control-btn {
    padding-inline: 6px;
  }

  .rebalance-market-filter-summary,
  .rebalance-action-filter-summary {
    width: 88px;
    padding-inline: 5px;
  }

  .rebalance-market-filter-selected,
  .rebalance-action-filter-selected {
    gap: 1px;
  }

  .rebalance-market-filter-selected .market-tag,
  .rebalance-action-filter-chip {
    width: 16px;
    min-width: 16px;
    padding-inline: 0;
  }
}

.aggregate-symbol-group .aggregate-portfolio {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aggregate-symbol-group .market-tag {
  flex: none;
}

.aggregate-symbol-title {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.aggregate-symbol-title > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aggregate-symbol-meta {
  display: flex;
  align-items: center;
  gap: 4px;
}

.aggregate-symbol-meta .aggregate-today-rebalance-tag {
  flex: none;
}

.aggregate-symbol-portfolio-tag {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 150px;
  min-height: 17px;
  padding: 0 6px;
  overflow: hidden;
  border-radius: 5px;
  background: color-mix(in srgb, var(--text-secondary) 13%, transparent);
  color: var(--text-secondary);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 550;
  line-height: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aggregate-rebalance-trades .rebalance-row {
  padding-left: 0;
  padding-right: var(--page-x);
}

.aggregate-rebalance-trades .rebalance-row:last-child {
  border-bottom: none;
}

.aggregate-group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.aggregate-group-toggle .aggregate-portfolio {
  flex: 1;
  min-width: 0;
}

.aggregate-group-chevron {
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
}

.aggregate-rebalance-group:not(.is-collapsed) .aggregate-group-chevron {
  transform: rotate(90deg);
}

.aggregate-portfolio-icon-wrap {
  --aggregate-icon-size: 28px;
  --sub-tab-icon-size: 18px;
  position: relative;
  flex-shrink: 0;
  width: var(--aggregate-icon-size);
  height: var(--aggregate-icon-size);
  overflow: visible;
}

.aggregate-portfolio-icon-wrap .asset-icon {
  width: var(--aggregate-icon-size);
  height: var(--aggregate-icon-size);
}

.aggregate-portfolio-icon-wrap .aggregate-unread-badge {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  transform: translate(-35%, -35%);
}

.aggregate-today-rebalance-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: rgba(212, 160, 23, 0.18);
  color: #d4a017;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
}

[data-theme="light"] .aggregate-today-rebalance-tag {
  background: rgba(212, 160, 23, 0.14);
  color: #b8860b;
}

.aggregate-portfolio-link {
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aggregate-portfolio-link:active {
  opacity: 0.72;
}

#rebalance-list .aggregate-rebalance-group.is-collapsed .aggregate-rebalance-trades {
  display: none;
}

.aggregate-rebalance-load-more-wrap {
  padding: 10px 0 2px;
}

.aggregate-rebalance-load-more {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  padding: 8px 0;
  text-align: center;
}

.aggregate-rebalance-load-more:active:not(:disabled) {
  opacity: 0.72;
}

.aggregate-rebalance-load-more:disabled {
  opacity: 0.55;
}

.rebalance-action {
  font-weight: 600;
  color: #d4a017;
}

.list-row.has-rebalance .asset-name {
  font-size: 0.82rem;
}

.col-sparkline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 80px;
  max-width: 80px;
}

.sparkline {
  width: 72px;
  height: 36px;
  min-width: 72px;
  min-height: 36px;
  display: block;
  flex-shrink: 0;
}

.sparkline-empty {
  width: 72px;
  height: 36px;
  min-width: 72px;
  min-height: 36px;
  background: transparent;
  border-radius: 0;
  flex-shrink: 0;
}

.list-row .col-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 3px;
  text-align: right;
  overflow: hidden;
  min-width: 96px;
  max-width: 96px;
}

.list-row .col-price .holding-cell-main,
.list-row .col-price .holding-cell-sub {
  display: block;
  width: 100%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0;
  font-variant-numeric: tabular-nums;
}

.list-row .col-price .holding-cell-main {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  min-height: calc(0.78rem * 1.35);
}

.list-row .col-price .holding-cell-sub {
  font-size: 0.68rem;
  line-height: 1.35;
  min-height: calc(0.68rem * 1.35);
}

.list-row .col-price .holding-cell-main.price-box {
  display: inline-block;
  width: auto;
  max-width: 100%;
  font-size: 0.78rem;
  padding: 0 4px;
  border-radius: 4px;
  margin-left: auto;
  line-height: calc(0.78rem * 1.35);
  min-height: calc(0.78rem * 1.35);
  flex-shrink: 0;
  box-sizing: border-box;
}

.list-row .col-price .holding-cell-main.price-box.positive,
.list-row .col-price .holding-cell-main.price-box.negative {
  color: var(--price-box-on-color);
}

.list-row .col-price .holding-cell-main.price-box.neutral {
  color: var(--text-secondary);
}

.list-row .col-price .holding-cell-sub {
  width: 100%;
  text-align: right;
}

.price-box {
  min-width: auto;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.price-box.positive {
  background: var(--green);
  color: var(--price-box-on-color);
}

.price-box.negative {
  background: var(--red);
  color: var(--price-box-on-color);
}

.price-box.neutral {
  background: var(--neutral-bg);
  color: var(--text-secondary);
}

.price-change {
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  width: 100%;
}

.price-change.positive { color: var(--green); }
.price-change.negative { color: var(--red); }
.price-change.neutral { color: var(--text-secondary); }

.update-hint {
  text-align: center;
  padding: 12px var(--page-x);
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.update-hint.error {
  color: var(--red);
}

/* ── FAB countdown ── */
.fab {
  position: fixed;
  right: var(--page-x);
  bottom: calc(var(--safe-bottom) + 16px);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--fab-bg);
  color: var(--fab-color);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--fab-shadow);
  z-index: 50;
  border: none;
  padding: 0;
}

.fab-countdown {
  position: fixed;
}

.fab-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.fab-ring-bg {
  fill: none;
  stroke: rgba(0, 0, 0, 0.08);
  stroke-width: 2.5;
}

[data-theme="dark"] .fab-ring-bg {
  stroke: rgba(255, 255, 255, 0.12);
}

.fab-ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s linear;
}

.fab-countdown-text {
  position: relative;
  z-index: 1;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.fab:active {
  transform: scale(0.95);
}

.fab:disabled {
  opacity: 0.7;
}

html.ios-mobile:not(:is(.ios-browser, .ios-standalone)) {
  height: 100%;
  overflow: hidden;
}

html.ios-browser,
html.ios-standalone {
  --scroll-edge-bottom-floor: 16px;
}

html.ios-browser {
  --safari-ui-bottom: env(safe-area-inset-bottom, 0px);
}

html.ios-standalone {
  --safari-ui-bottom: env(safe-area-inset-bottom, 34px);
}

/* iOS Safari / PWA：整页滚动 + sticky 顶栏 */
html.ios-mobile:is(.ios-browser, .ios-standalone) {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: visible;
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) body {
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-home,
html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-detail,
html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-account,
html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-login {
  min-height: 100dvh;
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: visible;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-home,
html.ios-mobile:is(.ios-browser, .ios-standalone) .page-account {
  display: block;
  min-height: 100dvh;
  height: auto;
  max-height: none;
  overflow: visible;
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-detail {
  min-height: 100dvh;
  height: auto;
  max-height: none;
  overflow: visible;
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-transition-shell {
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: visible;
  display: block;
  flex: none;
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-home .home-fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transform: none;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-bottom: none;
  box-shadow: none;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-home .list-main {
  flex: none;
  min-height: calc(100dvh - var(--home-fixed-header-h) - var(--home-list-header-h));
  max-height: none;
  height: auto;
  padding-top: calc(var(--home-fixed-header-h) + var(--home-list-header-h));
  padding-bottom: 0;
  overflow: visible;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: auto;
  touch-action: auto;
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-home:is(.home-tab-rebalance, .home-tab-logs) .list-main {
  padding-top: var(--home-fixed-header-h);
  min-height: calc(100dvh - var(--home-fixed-header-h));
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-home .home-columns-header {
  position: fixed;
  top: var(--home-fixed-header-h);
  left: 0;
  right: 0;
  transform: none;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  z-index: 95;
  will-change: auto;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-home .detail-swipe-viewport {
  overflow: visible;
  overflow-x: visible;
  clip-path: none;
  contain: none;
  min-height: 100%;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-home .page-transition-shell {
  min-height: calc(100dvh - var(--home-fixed-header-h) - var(--home-list-header-h));
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-detail .page-transition-shell {
  display: block;
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-detail .top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transform: none;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-bottom: none;
  box-shadow: none;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-detail .detail-sub-tabs {
  position: fixed;
  top: var(--detail-header-h);
  left: 0;
  right: 0;
  transform: none;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  z-index: 99;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-bottom: none;
  box-shadow: none;
}

/* iOS 主屏幕 PWA：顶栏用纯色背景，避免状态栏下方出现 1px 分割线 */
html.ios-mobile.ios-standalone .page-home .home-fixed-header {
  background: var(--bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html.ios-mobile.ios-standalone .page-home .home-fixed-header .top-bar {
  background: transparent;
}

html.ios-mobile.ios-standalone .page-detail .top-bar,
html.ios-mobile.ios-standalone .page-detail .detail-sub-tabs {
  background: var(--bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-detail .detail-main {
  display: block;
  flex: none;
  min-height: calc(100dvh - var(--detail-header-h) - var(--detail-tabs-h) - 12px);
  overflow: visible;
  padding: calc(var(--detail-header-h) + var(--detail-tabs-h) + 12px) var(--detail-x) 0;
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-detail .detail-swipe-viewport {
  width: calc(100% + var(--detail-x) * 2);
  max-width: calc(100% + var(--detail-x) * 2);
  margin-left: calc(-1 * var(--detail-x));
  overflow-x: clip;
  overflow-y: visible;
  flex: none;
  min-height: calc(100dvh - var(--detail-header-h) - var(--detail-tabs-h) - 12px);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-detail .detail-swipe-track {
  height: auto;
  align-items: stretch;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-detail .detail-swipe-panel {
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
  overscroll-behavior-y: auto;
  padding-bottom: max(
    32px,
    var(--scroll-edge-bottom),
    var(--scroll-edge-bottom-floor)
  );
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-detail .detail-swipe-panel.is-visible {
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
  padding-bottom: max(
    32px,
    var(--scroll-edge-bottom),
    var(--scroll-edge-bottom-floor)
  );
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-detail .detail-swipe-track:not(.is-dragging):not(.is-animating) .detail-swipe-panel:not(.is-visible) {
  visibility: hidden;
  height: 0;
  min-height: 0;
  overflow: hidden;
  pointer-events: none;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-detail::after {
  content: '';
  display: block;
  height: calc(
    max(48px, var(--scroll-edge-bottom), var(--scroll-edge-bottom-floor))
    + var(--safari-ui-bottom, 0px)
  );
  pointer-events: none;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .pt-detail-swipe-front {
  min-height: 100dvh;
  height: auto;
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-account .page-transition-shell {
  overflow: visible;
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .page-account .top-bar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  transform: none;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  z-index: 100;
  background: var(--bg);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .account-main {
  padding-top: 12px;
  padding-bottom: max(var(--scroll-edge-bottom), var(--scroll-edge-bottom-floor));
  background: var(--bg);
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .account-main-embedded,
.settings-account-body .account-main {
  background: transparent;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .drawer-overlay,
html.ios-mobile:is(.ios-browser, .ios-standalone) .settings-confirm-overlay {
  box-sizing: border-box;
}

html.ios-mobile.ios-browser .drawer-overlay,
html.ios-mobile.ios-browser .settings-confirm-overlay {
  padding-bottom: var(--safari-ui-bottom, env(safe-area-inset-bottom, 0px));
}

html.ios-mobile.ios-standalone .drawer-overlay,
html.ios-mobile.ios-standalone .settings-confirm-overlay {
  padding-bottom: 0;
}

html.ios-mobile.ios-browser .side-drawer {
  height: calc(100dvh - var(--safari-ui-bottom, env(safe-area-inset-bottom, 0px)));
  max-height: calc(100dvh - var(--safari-ui-bottom, env(safe-area-inset-bottom, 0px)));
}

html.ios-mobile.ios-standalone .side-drawer {
  height: 100dvh;
  max-height: 100dvh;
  padding-bottom: var(--safe-bottom);
  box-sizing: border-box;
}

html.ios-mobile.ios-browser .drawer-body {
  padding-bottom: calc(18px + var(--safari-ui-bottom, env(safe-area-inset-bottom, 0px)));
}

html.ios-mobile.ios-standalone .drawer-body {
  padding-bottom: 18px;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .rebalance-modal-overlay {
  padding-bottom: 0;
  box-sizing: border-box;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .rebalance-modal {
  max-height: min(
    88dvh,
    calc(100dvh - var(--safe-top) - var(--safari-ui-bottom, env(safe-area-inset-bottom, 0px)) - 12px)
  );
}

html.ios-mobile:is(.ios-browser, .ios-standalone) .rebalance-modal-footer {
  padding-bottom: calc(14px + var(--safari-ui-bottom, env(safe-area-inset-bottom, 0px)));
}

html.ios-mobile:not(:is(.ios-browser, .ios-standalone)) body.page-home,
html.ios-mobile:not(:is(.ios-browser, .ios-standalone)) body.page-detail,
html.ios-mobile:not(:is(.ios-browser, .ios-standalone)) body.page-account,
html.ios-mobile:not(:is(.ios-browser, .ios-standalone)) body.page-login {
  min-height: 0;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  overflow: hidden;
}

html.ios-mobile:not(:is(.ios-browser, .ios-standalone)) .page-transition-shell {
  min-height: 0;
  height: auto;
  flex: 1 1 auto;
}

.loading-inline {
  text-align: center;
  padding: 40px var(--page-x);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ── Page layout spacing (home + detail) ── */
.page-home,
.page-account {
  display: flex;
  flex-direction: column;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  min-height: var(--app-height, 100dvh);
  overflow: hidden;
}

.page-home {
  --home-header-h: calc(56px + var(--safe-top));
  --home-tabs-h: 44px;
  --home-fixed-header-h: calc(var(--home-header-h) + var(--home-tabs-h));
  --home-list-header-h: 33px;
}

.page-home .sub-tabs {
  min-height: var(--home-tabs-h);
  box-sizing: border-box;
}

.page-home .page-transition-shell,
.page-account .page-transition-shell {
  order: 0;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page-account .page-transition-shell {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.page-home .home-fixed-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: visible;
  border-bottom: none;
  box-shadow: none;
}

.page-home .home-fixed-header .top-bar {
  position: static;
  top: auto;
  z-index: auto;
}

.page-home .list-main {
  flex: 1;
  min-height: 0;
  padding-top: calc(var(--home-fixed-header-h) + var(--home-list-header-h));
  padding-bottom: max(var(--scroll-edge-bottom), var(--scroll-edge-bottom-floor));
  background: var(--bg);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.page-home:is(.home-tab-rebalance, .home-tab-logs) .list-main {
  padding-top: var(--home-fixed-header-h);
}

.page-home .list-main::-webkit-scrollbar {
  display: none;
}

/* iOS 整页滚动：首页与详情页一致，底部留白放在 swipe-panel */
html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-home {
  display: block;
  height: auto;
  max-height: none;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: visible;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-home:is(.home-tab-rebalance, .home-tab-logs) .page-transition-shell {
  min-height: calc(100dvh - var(--home-fixed-header-h));
}

html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-home #home-main .detail-swipe-viewport,
html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-home #home-main .detail-swipe-track {
  height: auto;
  min-height: 100%;
  max-height: none;
  overflow: visible;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-home .detail-swipe-panel {
  overflow: visible;
}

html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-home .detail-swipe-panel.is-visible {
  height: auto;
  min-height: 100%;
  max-height: none;
  overflow: visible;
  padding-bottom: max(var(--scroll-edge-bottom), var(--scroll-edge-bottom-floor));
}

html.ios-mobile:is(.ios-browser, .ios-standalone) body.page-home::after {
  content: '';
  display: block;
  height: max(var(--scroll-edge-bottom), var(--scroll-edge-bottom-floor));
  pointer-events: none;
}

.page-home .top-bar {
  grid-template-columns: auto 1fr;
}

.page-home .home-title-row {
  justify-content: space-between;
  gap: 8px;
}

.page-home .home-title-row h1 {
  flex: 0 1 auto;
}

.page-home .detail-meta {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  gap: 6px;
  text-align: right;
}

.page-home .detail-meta .detail-updated-at {
  margin-left: 0;
}

.page-home .detail-refresh-hint {
  top: calc(var(--home-fixed-header-h) + 6px);
}

.page-home .top-bar .icon-btn,
.page-detail .top-bar .icon-btn,
.page-detail .back-btn {
  width: 28px;
  height: 40px;
  border-radius: 8px;
}

.page-home #menu-btn {
  justify-content: flex-start;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.page-detail .top-bar {
  grid-template-columns: auto 1fr auto;
}

.page-detail .back-btn {
  justify-content: flex-start;
  align-items: center;
  margin-left: 0;
  font-size: 0;
  line-height: 0;
  padding: 0;
  flex-shrink: 0;
}

.page-detail .back-btn svg {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.page-detail .detail-title-wrap {
  /* 与首页一致：由 top-bar 垂直居中整块标题，不在内部再拔高 */
  justify-content: center;
  min-width: 0;
}

.page-home #notify-btn,
.page-detail .theme-toggle {
  justify-content: flex-end;
}

.page-usmart-detail .top-bar,
.page-futunn-detail .top-bar {
  grid-template-columns: auto 1fr;
}

@media (max-width: 767px) {
  .page-detail .top-bar {
    padding-left: var(--page-x);
    padding-right: var(--page-x);
  }

  .page-detail .detail-title-row {
    justify-content: flex-start;
    gap: 4px;
  }
}

.detail-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.detail-title-row h1 {
  font-size: var(--detail-title-size);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 0 1 auto;
}

.detail-refresh-error-icon {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.detail-title-row .id-line {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--id-text);
  white-space: nowrap;
  line-height: 1.2;
}

.detail-updated-at {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-tertiary);
  white-space: nowrap;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.detail-updated-at.is-stale {
  color: var(--yellow);
}

.detail-refresh-countdowns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.detail-refresh-countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  min-height: 16px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #b8e0ff;
  background: rgba(10, 132, 255, 0.32);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.detail-refresh-countdown[data-platform="futunn"] {
  color: #ffd4a8;
  background: rgba(255, 149, 0, 0.28);
}

.detail-refresh-countdown[data-platform="usmart"] {
  color: #b8e0ff;
  background: rgba(10, 132, 255, 0.32);
}

.detail-refresh-countdown.is-readonly {
  cursor: default;
  pointer-events: none;
}

[data-theme="light"] .detail-refresh-countdown {
  color: #007aff;
  background: rgba(0, 122, 255, 0.16);
}

[data-theme="light"] .detail-refresh-countdown[data-platform="futunn"] {
  color: #c45f00;
  background: rgba(255, 149, 0, 0.18);
}

[data-theme="light"] .detail-refresh-countdown[data-platform="usmart"] {
  color: #007aff;
  background: rgba(0, 122, 255, 0.16);
}

.detail-refresh-countdown.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.detail-refresh-countdown.is-closed {
  color: var(--text-tertiary);
  background: rgba(142, 142, 147, 0.22);
  font-weight: 500;
}

.detail-refresh-hint {
  position: fixed;
  top: calc(var(--detail-header-h) + var(--detail-tabs-h) + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - var(--detail-x) * 2);
  max-width: calc(480px - var(--detail-x) * 2);
  z-index: 101;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  pointer-events: none;
}

.detail-refresh-hint.is-error {
  color: var(--red);
}

.detail-platform-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.detail-platform-icon .platform-avatar-fallback {
  font-size: 0.62rem;
}

.page-home .col-product {
  gap: 8px;
}

/* ── Skeleton ── */
.skeleton-row {
  height: 67px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-bottom-color: transparent;
}

[data-theme="light"] .skeleton-row {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.03) 25%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.03) 75%
  );
  background-size: 200% 100%;
}

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

/* ── Detail pages ── */
.page-detail {
  --detail-header-h: calc(56px + var(--safe-top));
  --detail-tabs-h: 44px;
  --detail-x: 8px;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  min-height: var(--app-height, 100dvh);
  overflow: hidden;
}

.page-detail .page-transition-shell {
  position: relative;
  z-index: 1;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: auto;
  background: var(--bg);
}

.page-detail .top-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 100;
  border-bottom: none;
  box-shadow: none;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  /* 与首页 top-bar 同一套左右边距，保证返回键与汉堡菜单同列 */
  padding-left: var(--page-x);
  padding-right: var(--page-x);
}

.page-detail .detail-sub-tabs {
  position: fixed;
  top: var(--detail-header-h);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 99;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: none;
  box-shadow: none;
  padding-left: var(--detail-x);
  padding-right: var(--detail-x);
}

.page-detail .detail-main {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: auto;
  padding: calc(var(--detail-header-h) + var(--detail-tabs-h) + 12px) var(--detail-x) 0;
  box-sizing: border-box;
}

.page-detail .detail-main::-webkit-scrollbar {
  display: none;
}

.detail-swipe-viewport {
  overflow: hidden;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  position: relative;
  contain: layout paint;
  clip-path: inset(0);
  isolation: isolate;
}

.page-detail .detail-swipe-viewport {
  width: calc(100% + var(--detail-x) * 2);
  max-width: calc(100% + var(--detail-x) * 2);
  margin-left: calc(-1 * var(--detail-x));
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  contain: none;
  clip-path: none;
}

.page-detail .detail-swipe-track {
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

.page-detail .detail-swipe-panel {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: max(var(--scroll-edge-bottom), var(--scroll-edge-bottom-floor));
  box-sizing: border-box;
}

/* 预留下方空白，保证小屏可滑到最后一条标的（避开底部安全区 / Safari 底栏） */
.page-detail .holding-list,
.page-detail .rebalance-panel {
  padding-bottom: calc(
    96px
    + max(
      var(--safe-bottom),
      var(--safari-ui-bottom, 0px)
    )
  );
}

@media (max-width: 480px) {
  .page-detail .holding-list,
  .page-detail .rebalance-panel {
    padding-bottom: calc(
      120px
      + max(
        var(--safe-bottom),
        var(--safari-ui-bottom, 0px)
      )
    );
  }

  .page-detail .detail-swipe-panel {
    padding-bottom: max(
      32px,
      var(--scroll-edge-bottom),
      var(--scroll-edge-bottom-floor)
    );
  }
}

.page-detail .detail-swipe-panel::-webkit-scrollbar {
  display: none;
}

.page-home .detail-swipe-viewport {
  overflow: visible;
  overflow-x: visible;
  clip-path: none;
  contain: none;
}

.page-home .detail-swipe-panel.is-visible {
  overflow: visible;
}

.page-home .detail-swipe-track {
  align-items: flex-start;
}

.page-home .detail-swipe-track:not(.is-dragging):not(.is-animating) .detail-swipe-panel:not(.is-visible) {
  visibility: hidden;
  height: 0;
  min-height: 0;
  overflow: hidden;
  pointer-events: none;
}

.page-home .detail-swipe-panel {
  display: flex;
  flex-direction: column;
}

.detail-swipe-track {
  display: flex;
  flex-wrap: nowrap;
  will-change: transform;
  touch-action: pan-x pan-y;
  --swipe-progress: 0;
}

.page-detail .detail-swipe-track {
  touch-action: pan-x pan-y;
}

.detail-swipe-track.is-animating {
  transition: transform var(--pt-swipe-duration) var(--pt-swipe-easing);
}

.detail-swipe-track.is-dragging .detail-swipe-panel,
.detail-swipe-track.is-animating .detail-swipe-panel {
  transition:
    opacity var(--pt-swipe-duration) var(--pt-swipe-easing),
    transform var(--pt-swipe-duration) var(--pt-swipe-easing);
}

.detail-swipe-track.is-dragging .detail-swipe-panel:first-child,
.detail-swipe-track.is-animating .detail-swipe-panel:first-child {
  opacity: calc(1 - var(--swipe-progress) * 0.14);
  transform: translate3d(calc(var(--swipe-progress) * -10px), 0, 0) scale(calc(1 - var(--swipe-progress) * 0.012));
}

.detail-swipe-track.is-dragging .detail-swipe-panel:last-child,
.detail-swipe-track.is-animating .detail-swipe-panel:last-child {
  opacity: calc(0.86 + var(--swipe-progress) * 0.14);
  transform: translate3d(calc((1 - var(--swipe-progress)) * 10px), 0, 0) scale(calc(0.988 + var(--swipe-progress) * 0.012));
}

.detail-swipe-panel {
  flex: 0 0 auto;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
  transform-origin: center top;
  backface-visibility: hidden;
}

@keyframes panel-content-enter-left {
  from {
    opacity: 0.55;
    transform: translate3d(18px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes panel-content-enter-right {
  from {
    opacity: 0.55;
    transform: translate3d(-18px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.page-home .detail-swipe-panel.is-content-enter-left > .portfolio-list,
.page-home .detail-swipe-panel.is-content-enter-left > #rebalance-list,
.page-home .detail-swipe-panel.is-content-enter-left > .rebalance-page-content,
.page-home .detail-swipe-panel.is-content-enter-left > .refresh-log-page {
  animation: panel-content-enter-left var(--pt-swipe-duration) var(--pt-swipe-easing) both;
}

.page-home .detail-swipe-panel.is-content-enter-right > .portfolio-list,
.page-home .detail-swipe-panel.is-content-enter-right > #rebalance-list,
.page-home .detail-swipe-panel.is-content-enter-right > .rebalance-page-content,
.page-home .detail-swipe-panel.is-content-enter-right > .refresh-log-page {
  animation: panel-content-enter-right var(--pt-swipe-duration) var(--pt-swipe-easing) both;
}

.detail-swipe-panel > .kpi-grid,
.detail-swipe-panel > .return-curve-panel,
.detail-swipe-panel > .detail-empty {
  padding-left: var(--detail-x);
  padding-right: var(--detail-x);
  box-sizing: border-box;
}

.detail-swipe-panel > .rebalance-panel .rebalance-summary {
  padding-left: var(--detail-x);
  padding-right: var(--detail-x);
  box-sizing: border-box;
}

.detail-swipe-track:not(.is-dragging):not(.is-animating) .detail-swipe-panel:not(.is-visible) {
  visibility: hidden;
}

.page-detail .detail-swipe-track:not(.is-dragging):not(.is-animating) .detail-swipe-panel:not(.is-visible) {
  visibility: hidden;
  pointer-events: none;
}

.detail-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--text);
}

.detail-title-wrap h1 {
  font-size: var(--detail-title-size);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-title-wrap .detail-title-row h1 {
  text-align: left;
}

.detail-title-wrap .id-line {
  font-size: 0.72rem;
  color: var(--id-text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#app {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.page-detail .detail-main#app {
  overflow: hidden;
}

.detail-holdings,
.holdings-table {
  width: 100%;
  max-width: 100%;
}

.rebalance-table {
  width: 100%;
  max-width: 100%;
}

.allocation-strip {
  margin-bottom: 12px;
}

.allocation-strip .allocation-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border-subtle);
  margin-bottom: 10px;
}

.allocation-segment {
  min-width: 2px;
}

.allocation-segment.cash { background: #8e8e93; }
.allocation-segment.us { background: #0a84ff; }
.allocation-segment.hk { background: #ff9f0a; }
.allocation-segment.cn { background: #ff453a; }

.allocation-strip .allocation-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.allocation-strip .allocation-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.allocation-strip .allocation-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.allocation-dot.cash { background: #8e8e93; }
.allocation-dot.us { background: #0a84ff; }
.allocation-dot.hk { background: #ff9f0a; }
.allocation-dot.cn { background: #ff453a; }

.allocation-strip .allocation-label {
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--text-secondary);
  white-space: nowrap;
}

.allocation-strip .allocation-value {
  font-size: 0.72rem;
  line-height: 1.2;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.return-curve-panel {
  margin-top: 12px;
  margin-bottom: 16px;
}

.return-curve-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.curve-range-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 1;
  min-width: 0;
}

.curve-range-btn,
.curve-settings-btn {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.curve-range-btn {
  color: var(--text-secondary);
}

.curve-range-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
  font-weight: 600;
  box-shadow: none;
}

.curve-range-btn:active {
  opacity: 0.85;
}

.curve-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  flex-shrink: 1;
}

.curve-settings-wrap {
  position: relative;
  flex-shrink: 0;
}

.curve-settings-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-tertiary);
}

.curve-settings-label {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.curve-settings-btn:hover,
.curve-settings-btn[aria-expanded="true"],
.curve-settings-btn.has-selection {
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-color: var(--border);
}

.curve-settings-icon {
  display: block;
  flex-shrink: 0;
  width: 12px;
  height: 12px;
}

.curve-date {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  line-height: 1.2;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.curve-summary {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 8px;
  margin-bottom: 12px;
}

.curve-summary-item {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.curve-summary-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.curve-summary-label {
  font-size: 0.62rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.curve-summary-value {
  font-size: 0.62rem;
  font-weight: 400;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.curve-summary-value.positive {
  color: var(--green);
}

.curve-summary-value.negative {
  color: var(--red);
}

.curve-settings-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 210px;
  padding: 8px;
  border-radius: 12px;
  background: var(--bg-elevated);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.curve-settings-menu[hidden] {
  display: none;
}

.curve-settings-menu-title {
  padding: 2px 6px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.curve-benchmark-toggles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}


.curve-benchmark-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.64rem;
  font-weight: 500;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, background 0.15s ease;
}

.curve-benchmark-btn.active {
  color: var(--text);
  background: var(--tab-active-bg);
}

.curve-benchmark-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}

.curve-benchmark-btn.active .curve-benchmark-dot {
  opacity: 1;
}

.return-curve-chart {
  height: 148px;
  width: 100%;
  overflow: visible;
  container-type: inline-size;
}

.return-curve-chart-layout {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 14px;
  gap: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.return-curve-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  grid-column: 1;
  grid-row: 1;
  padding-right: 6px;
  overflow: visible;
}

.return-curve-plot {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
}

.return-curve-x-axis {
  position: relative;
  grid-column: 2;
  grid-row: 2;
  height: 14px;
}

.return-curve-axis-label {
  position: absolute;
  font-size: clamp(7px, 1.5625cqw, 10px);
  line-height: 1;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.return-curve-y-axis .return-curve-axis-label {
  position: static;
  transform: none;
}

.return-curve-x-axis .return-curve-axis-label {
  top: 1px;
}

.return-curve-x-axis .return-curve-axis-label.is-start {
  transform: translateX(0);
}

.return-curve-x-axis .return-curve-axis-label.is-middle {
  transform: translateX(-50%);
}

.return-curve-x-axis .return-curve-axis-label.is-end {
  transform: translateX(-100%);
}

.return-curve-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.return-curve-loading,
.return-curve-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.holdings-table {
  width: 100%;
}

.holdings-table-header,
.holding-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) repeat(4, minmax(0, 1fr));
  column-gap: 0;
  align-items: start;
  padding-right: 0;
}

.holdings-table-header {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 0;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.page-detail .holdings-table-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
}

.page-detail .holding-col-symbol,
.page-detail .rebalance-stock.holding-col-symbol {
  overflow: visible;
}

.page-detail .rebalance-stock {
  overflow: visible;
}

.page-detail .holding-row .market-tag,
.page-detail .rebalance-row .market-tag {
  flex-shrink: 0;
  min-width: 16px;
}

.page-detail .holdings-table-header .holding-col-today,
.page-detail .holding-col-today {
  padding-right: var(--detail-x);
  box-sizing: border-box;
}

.page-detail .rebalance-table-header .rebalance-col-time,
.page-detail .rebalance-time {
  padding-right: 8px;
  box-sizing: border-box;
}

.detail-swipe-panel > .rebalance-panel .rebalance-filter-bar {
  margin-left: var(--detail-x);
  margin-right: var(--detail-x);
}

.holdings-table-header .holding-col {
  white-space: nowrap;
  line-height: 1.2;
}

.holdings-table-header .sortable {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  width: 100%;
  text-align: right;
  -webkit-tap-highlight-color: transparent;
}

.holdings-table-header .sortable .holding-sort-label {
  white-space: nowrap;
}

.holdings-table-header .sortable .holding-sort-icon {
  display: none;
  flex-shrink: 0;
}

.holdings-table-header .sortable.active {
  color: var(--text-primary);
}

.holdings-table-header .sortable.active .holding-sort-icon {
  display: inline-flex;
  align-items: center;
}

.holdings-table-header .sortable .sort-icon {
  opacity: 1;
  transition: transform 0.15s ease;
}

.holdings-table-header .sortable.asc .sort-icon {
  transform: rotate(180deg);
}

.holding-list {
  display: flex;
  flex-direction: column;
}

.holding-row {
  padding-top: 14px;
  padding-bottom: 14px;
  padding-left: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.holding-row .holding-col-symbol {
  padding-left: 0;
}

.holding-row:last-child {
  border-bottom: none;
}

.holding-col {
  min-width: 0;
}

.holding-col-symbol {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 6px;
  row-gap: 0;
  align-items: center;
  overflow: hidden;
  min-width: 0;
}

.holdings-table-header .holding-col-symbol {
  padding-left: calc(16px + 6px);
}

.holding-col-symbol .market-tag {
  grid-column: 1;
  grid-row: 1;
}

.holding-col-symbol .holding-cell-main {
  grid-column: 2;
  grid-row: 1;
}

.holding-col-symbol .holding-cell-sub {
  grid-column: 2;
  grid-row: 2;
}

.holdings-table-header .holding-col-weight,
.holding-col-weight,
.holdings-table-header .holding-col-pnl,
.holding-col-pnl,
.holdings-table-header .holding-col-price,
.holding-col-price,
.holdings-table-header .holding-col-today,
.holding-col-today {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 3px;
  text-align: right;
  padding-left: 0;
  overflow: hidden;
  min-width: 0;
}

.holding-col-weight .holding-cell-main,
.holding-col-pnl .holding-cell-main,
.holding-col-price .holding-cell-main,
.holding-col-today .holding-cell-main,
.holding-col-weight .holding-cell-sub,
.holding-col-pnl .holding-cell-sub,
.holding-col-price .holding-cell-sub,
.holding-col-today .holding-cell-sub {
  display: block;
  width: 100%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0;
}

.holding-col-weight .holding-cell-main,
.holding-col-pnl .holding-cell-main,
.holding-col-price .holding-cell-main,
.holding-col-today .holding-cell-main {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  min-height: calc(0.78rem * 1.35);
}

.holding-col-weight .holding-cell-sub,
.holding-col-pnl .holding-cell-sub,
.holding-col-price .holding-cell-sub,
.holding-col-today .holding-cell-sub {
  font-size: 0.68rem;
  line-height: 1.35;
  min-height: calc(0.68rem * 1.35);
}

.holding-cell-sub-spacer {
  visibility: hidden;
}

.holding-col-today .holding-cell-main.price-box {
  display: inline-block;
  width: auto;
  max-width: 100%;
  font-size: 0.78rem;
  padding: 0 4px;
  border-radius: 4px;
  margin-left: auto;
  line-height: calc(0.78rem * 1.35);
  min-height: calc(0.78rem * 1.35);
  flex-shrink: 0;
  box-sizing: border-box;
}

.holdings-table-header .holding-col-pnl {
  display: flex;
  text-align: right;
}

.holdings-table-header .holding-col.sortable {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.holding-col-today .holding-cell-sub {
  width: 100%;
  text-align: right;
}

.holding-col-today .holding-cell-main.price-box.positive,
.holding-col-today .holding-cell-main.price-box.negative {
  color: var(--price-box-on-color);
}

.holding-col-today .holding-cell-main.price-box.neutral {
  color: var(--text-secondary);
}

.holding-row.has-today-rebalance {
  background: rgba(10, 132, 255, 0.05);
}

.holding-col-symbol .holding-cell-main {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--detail-title-size);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
  text-align: left;
}

.holding-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-rebalance-tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}

.holding-rebalance-tag--reduce {
  background: rgba(253, 50, 69, 0.18);
  color: var(--red);
}

.holding-rebalance-tag--add {
  background: rgba(13, 179, 92, 0.18);
  color: var(--green);
}

.holding-rebalance-tag--open {
  background: rgba(10, 132, 255, 0.18);
  color: #64d2ff;
}

.holding-rebalance-tag--close {
  background: rgba(255, 204, 0, 0.18);
  color: var(--yellow);
}

.holding-rebalance-tag--neutral {
  background: rgba(142, 142, 147, 0.18);
  color: var(--text-secondary);
}

.holding-rebalance-tag--today {
  width: 14px;
  height: 14px;
  padding: 0;
  background: rgba(212, 160, 23, 0.18);
  color: #d4a017;
}

[data-theme="light"] .holding-rebalance-tag--today {
  background: rgba(212, 160, 23, 0.14);
  color: #b8860b;
}

.today-rebalance-icon {
  display: block;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
}

.rebalance-stock .holding-cell-sub-symbol {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 0.72rem;
  line-height: 1.35;
}

.rebalance-stock .holding-cell-sub-symbol .holding-rebalance-tag {
  height: calc(0.72rem * 1.35);
  padding: 0 3px;
  font-size: 0.6rem;
  line-height: 1;
}

.rebalance-stock .holding-cell-sub-symbol .futu-symbol-link {
  min-width: 0;
  overflow: hidden;
  position: relative;
  text-overflow: ellipsis;
  top: -1px;
}

.holding-col-symbol .holding-cell-sub {
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.72rem;
  line-height: 1.35;
}

.holding-cell-sub-symbol {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 0.72rem;
  line-height: 1.35;
}

.holding-cell-sub-symbol .holding-rebalance-tag {
  height: calc(0.72rem * 1.35);
  padding: 0 3px;
  font-size: 0.6rem;
  line-height: 1;
}

.rebalance-stock .holding-cell-sub-symbol .holding-rebalance-tag--today,
.holding-cell-sub-symbol .holding-rebalance-tag--today {
  width: 14px;
  height: 14px;
  padding: 0;
}

.holding-cell-sub-symbol .holding-rebalance-tag--today .today-rebalance-icon {
  width: 10px;
  height: 10px;
}

.holding-cell-sub-symbol .futu-symbol-link {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.holding-cell-main {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.35;
}

.holding-cell-sub {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
  line-height: 1.35;
  margin-top: 3px;
}

.holding-cell-main.positive,
.holding-cell-sub.positive { color: var(--green); }

.holding-cell-main.negative,
.holding-cell-sub.negative { color: var(--red); }

.holding-col-weight .holding-cell-sub.holding-weight-drift {
  color: var(--text-tertiary);
}

.futu-symbol-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.futu-symbol-link:active {
  opacity: 0.72;
}

.copy-hint {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
  pointer-events: none;
  white-space: nowrap;
}

[data-theme="light"] .copy-hint {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.copy-hint[hidden] {
  display: none;
}

.holding-row .market-tag,
.symbol-identity .market-tag {
  flex-shrink: 0;
  margin: 0;
  padding: 2px 2px;
  border-radius: 0 3px 3px 0;
  font-size: 0.44rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--bg);
  width: 16px;
  box-sizing: border-box;
  text-align: center;
}

.rebalance-row .market-tag {
  flex-shrink: 0;
  margin: 0;
  padding: 2px 2px;
  border-radius: 0 3px 3px 0;
  font-size: 0.44rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--bg);
  width: 16px;
  box-sizing: border-box;
  text-align: center;
}

[data-theme="light"] .holding-row .market-tag,
[data-theme="light"] .rebalance-row .market-tag,
[data-theme="light"] .symbol-identity .market-tag {
  color: #ffffff;
}

.market-tag.market-us {
  background: #4d9ef7;
}

.market-tag.market-hk {
  background: #9d7bf7;
}

.market-tag.market-cn {
  background: #f25555;
}

[data-theme="light"] .market-tag.market-us {
  background: #5cabff;
}

[data-theme="light"] .market-tag.market-hk {
  background: #a78bfa;
}

[data-theme="light"] .market-tag.market-cn {
  background: #ff6b6b;
}

.list-row-static {
  cursor: default;
}

.holding-metric {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.detail-empty {
  padding: 24px var(--page-x);
  text-align: center;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.kpi-grid.kpi-grid-5 {
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
}

.kpi-grid.kpi-grid-5 .kpi-card {
  box-sizing: border-box;
  padding: 0;
  min-height: 0;
}

.kpi-grid.kpi-grid-5 .kpi-label {
  font-size: 0.66rem;
  margin-bottom: 4px;
  line-height: 1.2;
}

.kpi-grid.kpi-grid-5 .kpi-value {
  font-size: 0.95rem;
  line-height: 1.35;
}

.kpi-card-stacked {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 100%;
}

.kpi-inline-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}

.kpi-inline-label {
  flex-shrink: 0;
  font-size: 0.66rem;
  line-height: 1.2;
  color: var(--text-secondary);
}

.kpi-inline-value {
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-inline-value.positive { color: var(--green); }
.kpi-inline-value.negative { color: var(--red); }
.kpi-inline-value.neutral { color: var(--text); }

@media (max-width: 767px) {
  .kpi-grid.kpi-grid-5 > .kpi-card:not(.kpi-card-allocation) .kpi-value {
    font-size: 1.05rem;
    line-height: 1.3;
  }

  .kpi-grid.kpi-grid-5 .kpi-inline-value {
    font-size: 0.78rem;
  }
}

.kpi-card-allocation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0 8px;
  align-self: stretch;
  height: 100%;
  overflow: hidden;
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1.1;
}

.kpi-allocation-item {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-allocation-item.kpi-allocation-empty {
  color: var(--text-tertiary);
  grid-column: 1 / -1;
  align-items: flex-start;
}

.kpi-allocation-item.kpi-allocation-cash { color: #8e8e93; }
.kpi-allocation-item.kpi-allocation-us { color: #0a84ff; }
.kpi-allocation-item.kpi-allocation-hk { color: #ff9f0a; }
.kpi-allocation-item.kpi-allocation-cn { color: #ff453a; }

[data-theme="light"] .kpi-allocation-item.kpi-allocation-cash { color: #8e8e93; }
[data-theme="light"] .kpi-allocation-item.kpi-allocation-us { color: #007aff; }
[data-theme="light"] .kpi-allocation-item.kpi-allocation-hk { color: #ff9500; }
[data-theme="light"] .kpi-allocation-item.kpi-allocation-cn { color: #ff3b30; }

.kpi-card {
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi-value.positive { color: var(--green); }
.kpi-value.negative { color: var(--red); }
.kpi-value.neutral { color: var(--text); }

.section-card {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 14px var(--page-x);
  margin-bottom: 12px;
}

.section-title {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-badge {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

.holding-item {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 8px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.holding-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.holding-item:first-child {
  padding-top: 0;
}

.holding-symbol {
  font-size: 0.92rem;
  font-weight: 600;
}

.holding-name {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.holding-right {
  text-align: right;
}

.holding-pct {
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.holding-pnl {
  font-size: 0.72rem;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.holding-pnl.positive { color: var(--green); }
.holding-pnl.negative { color: var(--red); }

.recent-op {
  background: rgba(10, 132, 255, 0.12);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.85rem;
}

.recent-op-label {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
}

.rebalance-panel {
  display: flex;
  flex-direction: column;
}

.rebalance-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--card-bg);
}

.rebalance-filter-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rebalance-filter-clear {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.symbol-identity {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin: 0 8px 14px 0;
}

.symbol-identity .market-tag {
  margin-top: 4px;
}

.symbol-identity-main {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
}

.symbol-identity-copy {
  min-width: 0;
}

.symbol-identity-copy strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-identity-copy span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: 0.7rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-identity-metrics {
  display: grid;
  grid-template-columns: minmax(0, auto) auto;
  align-items: end;
  gap: 9px;
  flex-shrink: 0;
  text-align: right;
}

.symbol-identity-metrics div {
  min-width: 0;
}

.symbol-identity-metrics span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-tertiary);
  font-size: 0.56rem;
  line-height: 1.15;
  white-space: nowrap;
}

.symbol-identity-metrics strong {
  display: block;
  color: var(--text);
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.symbol-identity-metrics strong.positive { color: var(--green); }
.symbol-identity-metrics strong.negative { color: var(--red); }

.symbol-all-rebalances {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.symbol-all-rebalances:active {
  opacity: 0.8;
}

.symbol-quote-panel {
  margin: 0 8px;
}

.symbol-quote-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 0 0;
}

.symbol-quote-column {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.symbol-quote-column-title {
  color: var(--text-tertiary);
  font-size: 0.64rem;
  line-height: 1.2;
  white-space: nowrap;
}

.symbol-quote-column strong {
  overflow: hidden;
  color: var(--text);
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-quote-column-change {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.symbol-quote-column .positive { color: var(--green); }
.symbol-quote-column .negative { color: var(--red); }

.holding-today-sub {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.premarket-label {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: 14px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(255, 159, 10, 0.14);
  color: #ff9f0a;
  font-size: 0.56rem;
  font-style: normal;
  font-weight: 500;
  line-height: 14px;
}

.rebalance-weight-chart-card {
  margin: 12px 8px;
  padding: 0 0 8px;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
}

.rebalance-weight-chart-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 4px;
}

.rebalance-weight-chart-header strong {
  color: var(--text);
  font-size: 0.76rem;
}

.rebalance-weight-chart-header span {
  color: var(--text-tertiary);
  font-size: 0.66rem;
}

.rebalance-chart-range-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rebalance-chart-range-row > span {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 0.66rem;
}

.rebalance-chart-counts .open .curve-summary-value { color: var(--accent); }
.rebalance-chart-counts .total .curve-summary-value { color: var(--text-secondary); }
.rebalance-chart-counts .add .curve-summary-value { color: var(--green); }
.rebalance-chart-counts .reduce .curve-summary-value { color: var(--red); }
.rebalance-chart-counts .close .curve-summary-value { color: var(--yellow); }

.rebalance-chart-counts {
  grid-template-columns: repeat(5, max-content);
  align-items: center;
  justify-content: start;
  gap: 8px;
  margin: 0;
}

.rebalance-chart-counts .rebalance-action-tag {
  min-width: 24px;
  padding-right: 5px;
  padding-left: 5px;
  font-size: 0.58rem;
  font-weight: 400;
}

.rebalance-chart-ranges {
  margin: 6px 0 8px;
}

.rebalance-chart-empty {
  padding: 30px 0 24px;
  color: var(--text-tertiary);
  font-size: 0.72rem;
  text-align: center;
}

.rebalance-weight-chart-scroll {
  width: 100%;
  overflow: hidden;
}

.rebalance-weight-chart {
  display: block;
  width: 100%;
  min-width: 320px;
  height: auto;
  overflow: visible;
}

.rebalance-weight-grid line {
  stroke: var(--border);
  stroke-width: 1;
}

.rebalance-weight-grid.is-zero line {
  display: none;
}

.rebalance-weight-grid text,
.rebalance-weight-date,
.rebalance-price-axis text {
  fill: var(--text-tertiary);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.rebalance-weight-line {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.rebalance-weight-bar {
  stroke: transparent;
  stroke-width: 2;
}

.rebalance-weight-bar--open { fill: #0a84ff; }
.rebalance-weight-bar--add { fill: var(--green); }
.rebalance-weight-bar--reduce { fill: var(--red); }
.rebalance-weight-bar--close { fill: var(--yellow); }

.rebalance-weight-bar-marker:focus {
  outline: none;
}

.rebalance-weight-bar-marker:focus .rebalance-weight-bar {
  stroke: var(--text);
}

.rebalance-weight-bar-label {
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  paint-order: stroke fill;
  stroke: var(--bg);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.rebalance-weight-bar-label--open { fill: #0a84ff; }
.rebalance-weight-bar-label--add { fill: var(--green); }
.rebalance-weight-bar-label--reduce { fill: var(--red); }
.rebalance-weight-bar-label--close { fill: var(--yellow); }

.rebalance-price-line {
  fill: none;
  stroke: var(--purple);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.rebalance-cost-reference line {
  stroke: var(--text-secondary);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
  opacity: 0.75;
}

.rebalance-price-node {
  cursor: help;
  fill: var(--purple);
  stroke: var(--bg);
  stroke-width: 1.5;
}

.rebalance-price-marker:focus {
  outline: none;
}

.rebalance-price-marker:focus .rebalance-price-node {
  stroke: var(--text);
  stroke-width: 2.5;
}

.rebalance-price-node--current {
  stroke: var(--text);
  stroke-width: 2;
}

.rebalance-price-value-label {
  fill: var(--purple);
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.rebalance-price-label-bg {
  fill: var(--purple-bg);
  stroke: color-mix(in srgb, var(--purple) 35%, transparent);
  stroke-width: 0.8;
  pointer-events: none;
}

.rebalance-price-value-label.is-current {
  fill: var(--purple);
  font-size: 10px;
  font-weight: 700;
}

.rebalance-price-node--current.positive { fill: var(--green); }
.rebalance-price-node--current.negative { fill: var(--red); }
.rebalance-price-node--current.neutral { fill: var(--text-secondary); }

.rebalance-price-label-bg.is-current.positive {
  fill: var(--green-bg);
  stroke: color-mix(in srgb, var(--green) 35%, transparent);
}

.rebalance-price-label-bg.is-current.negative {
  fill: var(--red-bg);
  stroke: color-mix(in srgb, var(--red) 35%, transparent);
}

.rebalance-price-label-bg.is-current.neutral {
  fill: var(--neutral-bg);
  stroke: color-mix(in srgb, var(--text-secondary) 30%, transparent);
}

.rebalance-price-value-label.is-current.positive { fill: var(--green); }
.rebalance-price-value-label.is-current.negative { fill: var(--red); }
.rebalance-price-value-label.is-current.neutral { fill: var(--text-secondary); }

.rebalance-weight-node {
  cursor: help;
  stroke: var(--bg);
  stroke-width: 2;
}

.rebalance-weight-marker {
  cursor: help;
}

.rebalance-weight-marker:focus {
  outline: none;
}

.rebalance-weight-marker:focus .rebalance-weight-node {
  stroke: var(--text);
  stroke-width: 3;
}

.rebalance-weight-node-label {
  fill: #fff;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.rebalance-weight-node--increase { fill: var(--green); }
.rebalance-weight-node--decrease { fill: var(--red); }

.rebalance-weight-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 6px;
  padding: 0 2px;
}

.rebalance-weight-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: 0.62rem;
}

.rebalance-weight-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rebalance-weight-legend i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.rebalance-weight-legend i.weight { background: var(--accent); }
.rebalance-weight-legend i.cost { background: var(--text-secondary); }
.rebalance-weight-legend i.price { background: var(--purple); }

.rebalance-summary {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.rebalance-list {
  display: flex;
  flex-direction: column;
}

.rebalance-panel .rebalance-history-load-more-wrap {
  padding: 10px 0 2px;
}

.rebalance-table-header,
.rebalance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px 72px 72px 56px;
  column-gap: 2px;
  row-gap: 4px;
  padding-right: 0;
}

.rebalance-table-header {
  align-items: center;
}

.rebalance-row {
  align-items: start;
  padding-top: 14px;
  padding-bottom: 14px;
  padding-left: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.rebalance-row[data-rebalance-symbol] {
  cursor: pointer;
}

.rebalance-row[data-rebalance-symbol]:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.rebalance-table-header {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 0;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.rebalance-table-header .rebalance-col {
  white-space: nowrap;
  line-height: 1.2;
}

.rebalance-table-header .rebalance-col-symbol {
  padding-left: calc(16px + 6px);
}

.rebalance-table-header .rebalance-col-action {
  margin-left: 0;
  text-align: right;
}

.rebalance-table-header .rebalance-col-price,
.rebalance-table-header .rebalance-col-ratio,
.rebalance-table-header .rebalance-col-time {
  text-align: right;
}

.rebalance-row:last-child {
  border-bottom: none;
}

.rebalance-stock {
  min-width: 0;
  overflow: hidden;
  padding-right: 10px;
}

.rebalance-stock.holding-col-symbol .rebalance-name,
.rebalance-stock.holding-col-symbol .holding-cell-main {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rebalance-stock .market-tag {
  grid-column: 1;
  grid-row: 1;
}

.rebalance-stock .rebalance-name {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  max-width: 100%;
}

.rebalance-stock .rebalance-symbol {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  max-width: 100%;
}

.rebalance-name {
  font-size: var(--detail-title-size);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-detail .rebalance-stock .rebalance-name,
.page-detail .rebalance-stock .holding-cell-main {
  font-size: var(--detail-title-size);
  line-height: 1.2;
}

.rebalance-symbol {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rebalance-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.rebalance-time-clock {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.rebalance-time-date {
  font-size: 0.66rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.rebalance-time--hk .rebalance-time-clock {
  color: #9d7bf7;
}

.rebalance-time--cn .rebalance-time-clock {
  color: var(--red);
}

.rebalance-time--us .rebalance-time-clock {
  color: var(--accent);
}

[data-theme="light"] .rebalance-time--hk .rebalance-time-clock {
  color: #a78bfa;
}

.rebalance-action-col {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  align-self: center;
  margin-left: 0;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.rebalance-price-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  align-self: start;
  min-width: 72px;
  line-height: 1.3;
}

.rebalance-price {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.3;
}

.rebalance-action-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
  box-sizing: border-box;
}

.rebalance-action-tag--reduce {
  background: rgba(253, 50, 69, 0.18);
  color: var(--red);
}

.rebalance-action-tag--add {
  background: rgba(13, 179, 92, 0.18);
  color: var(--green);
}

.rebalance-action-tag--open {
  background: rgba(10, 132, 255, 0.18);
  color: #64d2ff;
}

[data-theme="light"] .holding-rebalance-tag--open,
[data-theme="light"] .rebalance-action-tag--open {
  color: #007aff;
}

.rebalance-action-tag--close {
  background: rgba(255, 204, 0, 0.18);
  color: var(--yellow);
}

.rebalance-action-tag--neutral {
  background: rgba(142, 142, 147, 0.18);
  color: var(--text-secondary);
}

.rebalance-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  align-self: start;
  gap: 2px;
  min-width: 72px;
  line-height: 1.3;
}

.rebalance-delta {
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rebalance-delta.positive {
  color: var(--green);
}

.rebalance-delta.negative {
  color: var(--red);
}

.rebalance-delta.open {
  color: var(--accent);
}

.rebalance-delta.close {
  color: var(--yellow);
}

.rebalance-delta.neutral {
  color: var(--text-secondary);
}

.rebalance-pct-change {
  font-size: 0.66rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.loading,
.error-state,
.empty-state {
  text-align: center;
  padding: 48px var(--page-x);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.error-state {
  color: var(--red);
}

/* ── Side drawer ── */
body.drawer-open {
  overflow: hidden;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--pt-overlay-duration) var(--pt-overlay-easing),
    visibility var(--pt-overlay-duration);
}

body.drawer-open .drawer-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.drawer-overlay[hidden] {
  display: block;
}

.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(300px, 82vw);
  height: 100dvh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  z-index: 201;
  transform: translate3d(-100%, 0, 0);
  transition: transform var(--pt-swipe-duration) var(--pt-swipe-easing);
  padding-top: var(--safe-top);
  display: flex;
  flex-direction: column;
  will-change: transform;
  backface-visibility: hidden;
}

.side-drawer.open {
  transform: translate3d(0, 0, 0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 12px calc(18px + var(--page-x));
  border-bottom: 1px solid var(--border);
}

.drawer-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.drawer-theme-toggle:active {
  background: var(--bg-row-hover);
}

.drawer-theme-toggle[data-theme="dark"]::after {
  content: '深色';
}

.drawer-theme-toggle[data-theme="light"]::after {
  content: '浅色';
}

.drawer-theme-toggle[data-theme="auto"]::after {
  content: '自动';
}

.drawer-theme-icon {
  display: none;
  flex-shrink: 0;
}

.drawer-theme-toggle[data-theme="dark"] .drawer-theme-icon--dark,
.drawer-theme-toggle[data-theme="light"] .drawer-theme-icon--light,
.drawer-theme-toggle[data-theme="auto"] .drawer-theme-icon--auto {
  display: block;
}

.drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.6rem;
  line-height: 1;
  border-radius: 8px;
}

.drawer-close:active {
  background: var(--bg-row-hover);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  padding-bottom: calc(18px + var(--safe-bottom));
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.drawer-body::-webkit-scrollbar {
  display: none;
}

.settings-section {
  overflow: visible;
  background: transparent;
}

.settings-section + .settings-section {
  margin-top: 2px;
}

.settings-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px var(--page-x);
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.settings-section-toggle:active {
  background: var(--bg-row-hover);
}

.settings-account-body .settings-section-toggle:active,
.account-sections .settings-section-toggle:active {
  background: transparent;
}

.settings-nav-link {
  text-decoration: none;
}

.settings-nav-chevron {
  transform: none;
}

.settings-section-leading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.settings-section-icon {
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.9;
}

.settings-chevron {
  flex-shrink: 0;
  opacity: 0.55;
  transition: transform 0.15s ease;
}

.settings-section.open .settings-chevron {
  transform: rotate(90deg);
}

.settings-section-body {
  padding: 0 16px 16px;
}

.settings-section-body[hidden] {
  display: none;
}

.settings-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.interval-options,
.platform-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.settings-appearance-action {
  width: 100%;
}

.interval-btn,
.theme-btn,
.platform-btn {
  padding: 12px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.interval-btn.active,
.theme-btn.active,
.platform-btn.active {
  border-color: var(--accent);
  background: rgba(10, 132, 255, 0.12);
  color: var(--accent);
}

.platform-options-icon {
  grid-template-columns: repeat(2, 72px);
  justify-content: start;
}

.platform-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  padding: 0;
}

.platform-btn-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: block;
}

.platform-btn-avatar .platform-avatar-fallback {
  font-size: 0.95rem;
}

.platform-btn-icon .platform-avatar.has-image[data-platform] {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.platform-btn-icon.active {
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.25);
}

.interval-btn:active,
.theme-btn:active,
.platform-btn:active {
  transform: scale(0.98);
}

.settings-field {
  display: block;
  margin-top: 14px;
}

.settings-field-label-spaced {
  display: block;
  margin-top: 18px;
}

.settings-field-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.settings-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}

.settings-input:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-primary-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}

.settings-primary-btn:active {
  transform: scale(0.98);
}

.settings-primary-btn:disabled {
  opacity: 0.6;
}

.settings-secondary-btn {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.settings-textarea {
  width: 100%;
  min-height: 88px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.45;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.settings-textarea:focus,
.settings-secondary-btn:active {
  outline: none;
}

.settings-textarea:focus {
  border-color: var(--accent);
}

.settings-error {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--red);
}

.portfolio-config-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.portfolio-config-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px 0;
}

.portfolio-config-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.84rem;
  line-height: 1.2;
}

.portfolio-config-icon {
  width: 1em;
  height: 1em;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.portfolio-config-icon.has-image[data-platform] {
  background-size: cover;
  background-position: center;
}

.portfolio-config-name {
  font-size: 1em;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.portfolio-config-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.portfolio-move-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  flex: 1;
}

.portfolio-move-btn {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-muted, rgba(255, 255, 255, 0.06));
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 600;
}

.portfolio-move-btn:disabled {
  opacity: 0.35;
}

.portfolio-remove-btn {
  flex-shrink: 0;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 600;
}

.settings-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.settings-confirm-overlay[hidden] {
  display: none;
}

.settings-confirm-modal {
  width: min(100%, 320px);
  padding: 18px;
  border-radius: 16px;
  background: var(--surface-elevated, var(--bg));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.settings-confirm-modal h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
}

.settings-confirm-modal p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.45;
}

.settings-confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.settings-confirm-btn {
  flex: 1;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
}

.settings-confirm-btn-danger {
  border-color: rgba(255, 59, 48, 0.35);
  background: rgba(255, 59, 48, 0.16);
  color: var(--red);
}

/* ── Rebalance modal ── */
body.rebalance-modal-open {
  overflow: hidden;
}

.rebalance-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: max(12px, var(--safe-top)) 0 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--pt-overlay-duration) var(--pt-overlay-easing);
}

.rebalance-modal-overlay:not([hidden]) {
  opacity: 1;
}

.rebalance-modal-overlay.is-closing {
  opacity: 0;
  pointer-events: none;
}

.rebalance-modal-overlay[hidden] {
  display: none;
}

.rebalance-modal {
  width: 100%;
  max-height: min(88dvh, calc(var(--app-height, 100dvh) - var(--safe-top) - 12px));
  display: flex;
  flex-direction: column;
  border-radius: 18px 18px 0 0;
  background: var(--surface-elevated, var(--bg));
  border: none;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: rebalance-modal-in var(--pt-swipe-duration) var(--pt-swipe-easing) both;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.rebalance-modal-overlay.is-closing .rebalance-modal {
  animation: rebalance-modal-out var(--pt-swipe-duration) var(--pt-swipe-easing) forwards;
}

@keyframes rebalance-modal-in {
  from {
    opacity: 0;
    transform: translate3d(0, 100%, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes rebalance-modal-out {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  to {
    opacity: 0;
    transform: translate3d(0, 100%, 0);
  }
}

@keyframes rebalance-modal-in-desktop {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rebalance-modal-out-desktop {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.96);
  }
}

.rebalance-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 14px 18px 10px;
}

.rebalance-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.rebalance-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--surface-muted, rgba(255, 255, 255, 0.06));
  color: var(--text-secondary);
  font-size: 1.3rem;
  line-height: 1;
}

.rebalance-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 4px;
  background: color-mix(in srgb, var(--surface-muted, var(--bg)) 48%, var(--bg));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.rebalance-modal-body::-webkit-scrollbar {
  display: none;
}

.rebalance-modal-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rebalance-modal-list .aggregate-rebalance-row {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-elevated, var(--bg));
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.12);
}

.rebalance-modal-list .aggregate-rebalance-group:not(.is-collapsed) .aggregate-rebalance-meta {
  margin-bottom: 0;
}

.rebalance-modal-list .aggregate-rebalance-meta {
  position: relative;
  padding: 13px 14px 12px 17px;
  border-bottom: 1px solid var(--border-subtle);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 72%),
    var(--surface-muted, rgba(255, 255, 255, 0.035));
}

.rebalance-modal-list .aggregate-rebalance-meta::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.rebalance-modal-list .aggregate-portfolio {
  gap: 11px;
}

.rebalance-modal-list .aggregate-portfolio .asset-icon {
  width: 32px;
  height: 32px;
}

.rebalance-modal-list .aggregate-portfolio-copy strong {
  max-width: none;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 750;
  line-height: 1.3;
  white-space: normal;
}

.rebalance-modal-list .aggregate-portfolio-copy small {
  margin-top: 3px;
  font-size: 0.68rem;
  line-height: 1.25;
}

.rebalance-modal-list .aggregate-rebalance-trades {
  margin: 0;
}

.rebalance-modal-list .rebalance-stock .rebalance-name {
  font-size: var(--detail-title-size);
}

.rebalance-modal-list .rebalance-stock .rebalance-symbol {
  font-size: 0.72rem;
}

.rebalance-modal-list .rebalance-stock .market-tag {
  font-size: 0.44rem;
}

.rebalance-modal-list .rebalance-stock .holding-rebalance-tag {
  font-size: 0.6rem;
}

.rebalance-modal-list .aggregate-rebalance-trades .rebalance-row {
  padding-top: 11px;
  padding-bottom: 11px;
  padding-left: 14px;
  padding-right: 14px;
}

.rebalance-modal-list .aggregate-rebalance-trades .rebalance-row:not(:last-child) {
  border-bottom-color: var(--border-subtle);
}

.rebalance-modal-footer {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  padding: 10px 14px calc(14px + var(--safe-bottom));
}

.rebalance-modal-btn {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}

.rebalance-modal-btn-primary {
  background: #0a84ff;
  border-color: #0a84ff;
  color: #fff;
}

/* ── Refresh logs ── */
.refresh-log-page {
  display: none;
  width: 100%;
  padding: 10px var(--page-x) max(24px, var(--safe-bottom));
  box-sizing: border-box;
}

.refresh-log-category-nav {
  position: sticky;
  z-index: 6;
  top: 0;
  margin: -10px calc(var(--page-x) * -1) 10px;
  padding: 10px var(--page-x) 8px;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(18px);
}

.refresh-log-category-switch {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.refresh-log-category-switch::-webkit-scrollbar {
  display: none;
}

.refresh-log-category-switch .rebalance-control-btn {
  min-height: 30px;
  padding-inline: 11px;
}

.refresh-log-category-switch .rebalance-control-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

body.page-home.home-tab-logs .rebalance-page-content {
  display: none;
}

body.page-home.home-tab-logs .refresh-log-page {
  display: block;
}

.refresh-log-body {
  padding: 0;
}

.refresh-log-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.refresh-log-card {
  --refresh-log-color: var(--green);
  overflow: hidden;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--refresh-log-color);
  border-radius: 13px;
  background: var(--surface-elevated, var(--bg));
}

.refresh-log-card.is-partial {
  --refresh-log-color: #ff9f0a;
}

.refresh-log-card.is-failed {
  --refresh-log-color: var(--red);
}

.refresh-log-card.is-warning {
  --refresh-log-color: #ff9f0a;
}

.system-log-card {
  padding: 12px 14px;
}

.system-log-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-log-card-header time {
  color: var(--text-tertiary);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.system-log-card-header--pending {
  flex-wrap: wrap;
}

.system-log-card-title {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
}

.system-log-confirmation-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 13%, transparent);
  color: var(--blue);
  font-size: 0.68rem;
  white-space: nowrap;
}

.system-log-http-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 13%, transparent);
  color: var(--green);
  font-size: 0.68rem;
  white-space: nowrap;
}

.system-log-http-tag.is-failed {
  background: color-mix(in srgb, var(--red) 13%, transparent);
  color: var(--red);
}

.system-log-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--refresh-log-color) 14%, transparent);
  color: var(--refresh-log-color);
  font-size: 0.68rem;
  font-weight: 700;
}

.system-log-portfolio {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--text-tertiary);
  font-size: 0.72rem;
}

.system-log-portfolio-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  overflow: hidden;
  border-radius: 50%;
}

.system-log-portfolio-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-log-portfolio-id {
  color: var(--text-tertiary);
  white-space: nowrap;
}

.system-log-change-count {
  margin-left: auto;
  white-space: nowrap;
}

.system-log-holding-counts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.system-log-holding-change-list {
  display: grid;
  gap: 6px;
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
}

.system-log-holding-change-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  font-size: 0.72rem;
}

.system-log-holding-change-list span {
  color: var(--text-tertiary);
}

.system-log-holding-change-list .is-removed {
  color: var(--red);
}

.system-log-holding-change-list .is-added {
  color: var(--green);
}

.system-log-holding-change-list strong {
  min-width: 0;
  color: var(--text);
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.system-log-no-detail {
  margin-top: 5px;
  color: var(--text-tertiary);
  font-size: 0.7rem;
}

.system-log-summary {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.system-log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 7px;
  color: var(--text-tertiary);
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.system-log-change-heading {
  margin-top: 9px;
  color: var(--text-tertiary);
  font-size: 0.72rem;
}

.system-log-change-list {
  display: grid;
  gap: 0;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.system-log-change-heading + .system-log-change-list {
  margin-top: 4px;
}

.system-log-change-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
}

.system-log-change-name {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-log-change-action {
  color: var(--blue);
}

.system-log-change-weight {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.system-log-change-list .system-log-change-more {
  display: block;
  min-height: 0;
  padding-top: 7px;
  border-bottom: 0;
  color: var(--text-tertiary);
  text-align: right;
}

.refresh-log-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 64px;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.4;
}

.refresh-log-line > * {
  flex-shrink: 0;
}

.refresh-log-line time {
  font-variant-numeric: tabular-nums;
}

.refresh-log-trigger-tag,
.refresh-log-count-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
}

.refresh-log-trigger-tag {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
}

.refresh-log-trigger-tag.is-startup {
  background: color-mix(in srgb, var(--yellow) 16%, transparent);
  color: var(--yellow);
}

.refresh-log-trigger-tag.is-manual {
  background: color-mix(in srgb, #ff9f0a 16%, transparent);
  color: #ff9f0a;
}

.refresh-log-count-tag.is-success {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
}

.refresh-log-count-tag.is-failed {
  background: color-mix(in srgb, var(--red) 14%, transparent);
  color: var(--red);
}

.refresh-log-duration {
  color: var(--text-tertiary);
  font-size: 0.76rem;
}

.refresh-log-details {
  margin: 0;
  padding: 0;
  border: 0;
}

.refresh-log-details summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.refresh-log-details summary::-webkit-details-marker {
  display: none;
}

.refresh-log-expand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  color: var(--text-tertiary);
  transition: transform 180ms ease;
}

.refresh-log-expand-icon svg {
  width: 17px;
  height: 17px;
}

.refresh-log-details[open] .refresh-log-expand-icon {
  transform: rotate(90deg);
}

.refresh-log-details ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0 0 14px;
  list-style: none;
}

.refresh-log-detail {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.refresh-log-detail-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
}

.refresh-log-detail.is-failed .refresh-log-detail-dot {
  background: var(--red);
}

.refresh-log-platform-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 50%;
}

.refresh-log-platform-icon .platform-avatar-fallback {
  font-size: 0.5rem;
}

.refresh-log-detail-main {
  min-width: 0;
  flex: 1;
}

.refresh-log-detail-main strong,
.refresh-log-detail-main small {
  display: block;
  overflow-wrap: anywhere;
}

.refresh-log-detail-main strong {
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.35;
}

.refresh-log-detail-main small {
  margin-top: 2px;
  color: var(--red);
  font-size: 0.68rem;
  line-height: 1.4;
}

.refresh-log-detail-duration {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 0.68rem;
}

.refresh-log-empty {
  padding: 40px 16px;
  color: var(--text-tertiary);
  font-size: 0.82rem;
  text-align: center;
}

.refresh-log-page-footer {
  display: flex;
  justify-content: center;
  padding-top: 12px;
}

.refresh-log-page-footer #refresh-log-more {
  width: min(100%, 360px);
}

/* ── Push settings ── */
.push-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.push-settings-label {
  font-size: 0.84rem;
  font-weight: 600;
}

.push-toggle {
  width: 50px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted, rgba(255, 255, 255, 0.08));
  position: relative;
  flex-shrink: 0;
}

.push-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.push-toggle.active {
  background: #0a84ff;
  border-color: #0a84ff;
}

.push-toggle.active::after {
  transform: translateX(20px);
}

.push-device-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
}

.push-device-btn.active {
  border-color: rgba(10, 132, 255, 0.45);
  color: #0a84ff;
}

.push-device-btn:disabled {
  opacity: 0.45;
}

.push-status-text {
  margin-top: 10px;
  font-size: 0.74rem;
  color: var(--text-tertiary);
  line-height: 1.45;
}

.push-devices-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.push-devices-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.push-devices-title {
  font-size: 0.8rem;
  font-weight: 700;
}

.push-devices-count {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.push-device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.push-device-empty,
.push-devices-hint {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.45;
}

.push-devices-hint {
  margin-top: 10px;
}

.push-devices-hint.is-success {
  color: var(--green);
}

.push-devices-hint.is-error {
  color: var(--red);
}

.push-device-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-muted, rgba(255, 255, 255, 0.04));
}

.push-device-item.is-current {
  border-color: rgba(10, 132, 255, 0.45);
}

.push-device-main {
  min-width: 0;
}

.push-device-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.push-device-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.push-device-badge {
  font-size: 0.62rem;
  font-weight: 700;
  color: #0a84ff;
  background: rgba(10, 132, 255, 0.12);
  border-radius: 999px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.push-device-meta {
  margin-top: 3px;
  font-size: 0.68rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.push-device-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.push-device-action {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.68rem;
  font-weight: 600;
}

.push-device-action.danger {
  color: #ff453a;
  border-color: rgba(255, 69, 58, 0.35);
}

.push-device-action:disabled {
  opacity: 0.45;
}

.settings-cert-link {
  display: block;
  margin-top: 12px;
  font-size: 0.76rem;
  color: #0a84ff;
  text-decoration: none;
}

/* ── Login page ── */
html.auth-pending .login-main {
  visibility: hidden;
}

.page-login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px var(--page-x);
}

.login-main {
  width: 100%;
  max-width: 360px;
}

.login-card {
  padding: 24px 20px;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.login-brand {
  text-align: center;
  margin-bottom: 20px;
}

.login-logo {
  border-radius: 14px;
  margin-bottom: 12px;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.1rem;
}

.login-brand p {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.login-hint {
  margin: 6px 0 0;
  font-size: 0.74rem;
  color: var(--text-tertiary, var(--text-secondary));
}

.login-form .settings-primary-btn {
  margin-top: 16px;
}

/* ── Account page ── */
.page-account {
  padding-bottom: 0;
}

.page-account .top-bar {
  grid-template-columns: auto 1fr auto;
  padding-left: var(--page-x);
  padding-right: var(--page-x);
}

.page-account .back-btn {
  width: 40px;
  height: 40px;
  justify-content: flex-start;
}

.account-main {
  padding: 0 0 calc(24px + var(--safe-bottom));
}

.settings-account-body {
  padding: 0;
}

.account-main-embedded {
  padding-bottom: 16px;
}

.account-main-embedded .account-profile-banner {
  padding-top: 12px;
}

.account-profile-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px var(--page-x) 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.account-banner-error {
  width: 100%;
  margin: 0;
}

.account-sections {
  padding-top: 2px;
}

.account-sections .settings-section-body {
  padding-left: var(--page-x);
  padding-right: var(--page-x);
}

.account-logout-wrap {
  padding: 12px var(--page-x) 0;
}

.account-cache-wrap {
  padding: 18px var(--page-x) 0;
}

.account-main-embedded .account-cache-wrap,
.account-main-embedded .account-logout-wrap {
  padding-left: 0;
  padding-right: 0;
}

.account-main-embedded .account-logout-wrap {
  padding-bottom: 0;
}

.account-cache-btn,
.account-logout-btn {
  width: 100%;
}

.account-admin-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.account-role-assign {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary, #8a8a8a);
}

.account-role-assign .account-role-select {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  font-size: 13px;
}

.account-role-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.account-role-tab {
  border: 1px solid var(--border, rgba(127, 127, 127, 0.35));
  background: transparent;
  color: var(--text-secondary, #8a8a8a);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.account-role-tab.active {
  color: var(--text, #f2f2f2);
  border-color: var(--text, #f2f2f2);
}

.account-role-editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.account-perm-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-perm-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #f2f2f2);
}

.account-platform-checks,
.account-portfolio-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-platform-checks[hidden],
.account-portfolio-checks[hidden] {
  display: none;
}

.account-portfolio-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.account-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary, #8a8a8a);
  line-height: 1.4;
}

.account-check input {
  margin-top: 2px;
}

.account-profile-card,
.account-users-section {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.account-users-section {
  margin-top: 12px;
}

.account-profile-label,
.account-section-head h2 {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.account-profile-line,
.account-user-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.account-profile-line > span,
.account-user-line > span {
  font-size: 0.6rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-tertiary);
}

.account-profile-name {
  margin-top: 0;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
}

.account-user-display-name {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
}

.account-name-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.account-profile-card .settings-secondary-btn {
  margin-top: 14px;
}

.account-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-section-head h2 {
  font-size: 0.92rem;
  color: var(--text-primary);
}

.account-inline-btn {
  border: none;
  background: none;
  color: #0a84ff;
  font-size: 0.82rem;
  padding: 0;
}

.account-user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.account-user-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
}

.account-user-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-user-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.account-user-access {
  font-size: 0.72rem;
  color: var(--text-tertiary, var(--text-secondary));
  line-height: 1.35;
}

.account-user-block + .account-user-block {
  margin-top: 8px;
}

.account-user-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-left: 46px;
}

.account-user-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.account-reset-panel {
  margin-top: 8px;
  padding: 10px 12px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
}

.account-reset-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.account-reset-actions .settings-primary-btn {
  margin-top: 0;
}

.account-form-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.account-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.account-form-head h2 {
  margin: 0;
  font-size: 0.92rem;
}

.account-form-close {
  border: none;
  background: none;
  color: var(--text-tertiary);
  font-size: 1.4rem;
  line-height: 1;
}

.account-action-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
}

.account-action-btn-danger {
  color: #fd3245;
  border-color: rgba(253, 50, 69, 0.25);
}

.account-device-count {
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: 0.76rem;
  font-weight: 500;
}

.account-login-device-list,
.account-user-devices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-user-devices {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg);
}

.account-login-device {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg);
}

.account-login-device.is-current {
  border-color: rgba(10, 132, 255, 0.38);
}

.account-login-device-main {
  min-width: 0;
}

.account-login-device-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.account-login-device-meta {
  margin-top: 3px;
  color: var(--text-tertiary);
  font-size: 0.7rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.account-device-badge {
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.12);
  color: #0a84ff;
  font-size: 0.64rem;
  font-weight: 600;
}

.account-device-limit {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.account-device-limit label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  font-size: 0.72rem;
}

.account-device-limit-input {
  width: 58px;
  min-height: 30px;
  padding: 4px 7px;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--user-avatar-color, #8e8e93);
  color: #fff;
}

.user-avatar-photo {
  position: relative;
  background: var(--avatar-fallback, var(--user-avatar-color, #8e8e93));
}

.user-avatar-photo.has-image {
  background: transparent;
}

.user-avatar.is-fallback span {
  font-weight: 600;
  line-height: 1;
}

.user-avatar-sm {
  width: 22px;
  height: 22px;
  font-size: 0.62rem;
}

.user-avatar-md {
  width: 36px;
  height: 36px;
  font-size: 0.9rem;
}

.user-avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
}

.user-avatar-profile {
  width: 40px;
  height: 40px;
  font-size: 0.85rem;
}

.account-profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-profile-avatar-wrap {
  display: inline-flex;
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  line-height: 0;
}

.account-profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.account-profile-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.account-profile-actions .settings-secondary-btn {
  margin-top: 0;
}

.account-avatar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.account-avatar-actions .settings-secondary-btn {
  margin-top: 0;
}

.account-text-btn {
  border: none;
  background: none;
  color: #fd3245;
  font-size: 0.82rem;
  padding: 0;
}

.account-user-meta {
  flex: 1;
  min-width: 0;
}

/* ── Desktop split layout (≥768px, home page only) ── */
@media (min-width: 768px) {
  html.pt-desktop body.page-home {
    --desktop-sidebar-w: 420px;
    display: grid;
    grid-template-columns: var(--desktop-sidebar-w) 1fr;
    grid-template-rows: auto auto 1fr;
    max-width: none;
    width: 100%;
    margin: 0;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  html.pt-desktop body.page-home .home-fixed-header {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: none;
    flex-shrink: 0;
  }

  html.pt-desktop body.page-home .home-columns-header {
    grid-column: 1;
    grid-row: 2;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: none;
    flex-shrink: 0;
    z-index: 2;
  }

  html.pt-desktop body.page-home > .page-transition-shell {
    grid-column: 1;
    grid-row: 3;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  html.pt-desktop body.page-home > .desktop-detail-pane {
    grid-column: 2;
    grid-row: 1 / -1;
    position: relative;
    min-width: 0;
    min-height: 0;
    height: 100dvh;
    overflow: hidden;
    border-left: 1px solid var(--border);
    background: var(--bg);
  }

  html.pt-desktop .page-home .list-main {
    padding-top: 0;
  }

  html.pt-desktop .page-home .detail-refresh-hint {
    left: 0;
    transform: none;
    max-width: var(--desktop-sidebar-w);
    width: calc(var(--desktop-sidebar-w) - var(--page-x) * 2);
  }

  html.pt-desktop .list-row.is-selected {
    background: var(--bg-row-hover);
    box-shadow: inset 3px 0 0 var(--accent);
  }

  html.pt-desktop .list-row.is-selected:active {
    background: var(--bg-row-hover);
  }

  html.pt-desktop .page-transition-shell,
  html.pt-desktop .page-transition-shell.pt-enter-forward,
  html.pt-desktop .page-transition-shell.pt-enter-back,
  html.pt-desktop .page-transition-shell.pt-exit-back {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  html.pt-desktop .rebalance-modal-overlay {
    align-items: center;
    justify-content: center;
    padding: max(16px, var(--safe-top)) 16px max(16px, var(--safe-bottom));
  }

  html.pt-desktop .rebalance-modal {
    width: min(100%, 420px);
    max-height: calc(var(--app-height, 100dvh) - var(--safe-bottom) - var(--safe-top) - 48px);
    margin: 0;
    border-radius: 18px;
    animation: rebalance-modal-in-desktop var(--pt-swipe-duration) var(--pt-swipe-easing) both;
  }

  html.pt-desktop .rebalance-modal-body {
    padding: 14px;
  }

  html.pt-desktop .rebalance-modal-footer {
    padding: 10px 14px 14px;
  }

  html.pt-desktop .rebalance-modal-overlay.is-closing .rebalance-modal {
    animation: rebalance-modal-out-desktop var(--pt-swipe-duration) var(--pt-swipe-easing) forwards;
  }
}

.desktop-detail-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.desktop-detail-placeholder[hidden],
html.pt-desktop .desktop-detail-pane.has-detail .desktop-detail-placeholder {
  display: none !important;
}

.desktop-detail-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: var(--bg);
}

.desktop-detail-frame[hidden],
html.pt-desktop .desktop-detail-pane:not(.has-detail) .desktop-detail-frame {
  display: none !important;
}

/* ── Detail embed mode (desktop right pane iframe) ── */
html.pt-embed {
  height: 100%;
}

html.pt-embed body.page-detail {
  max-width: none;
  margin: 0;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

html.pt-embed body.page-detail > .pt-detail-swipe-front,
html.pt-embed body.page-detail > .page-transition-shell {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

html.pt-embed body.page-detail .page-transition-shell {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

html.pt-embed body.page-detail .pt-detail-swipe-front {
  min-height: 0;
  height: 100%;
  max-height: 100%;
}

html.pt-embed .page-detail .top-bar,
html.pt-embed .page-detail .detail-sub-tabs {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  max-width: none;
  width: 100%;
  flex-shrink: 0;
  z-index: 2;
}

html.pt-embed body.page-detail .detail-main,
html.pt-embed body.page-detail .detail-main#app {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0 var(--detail-x);
}

html.pt-embed .page-detail .detail-swipe-viewport {
  contain: none;
  clip-path: none;
  overflow: hidden;
}

html.pt-embed .return-curve-chart {
  height: 168px;
}

html.pt-embed .return-curve-chart-layout {
  grid-template-rows: 154px 14px;
}

html.pt-embed .return-curve-plot {
  min-height: 124px;
}

html.pt-embed .page-detail .detail-refresh-hint {
  top: 8px;
  left: var(--detail-x);
  transform: none;
  max-width: none;
  width: calc(100% - var(--detail-x) * 2);
}

html.pt-embed-split .page-detail .detail-refresh-hint {
  top: 8px;
}

html.pt-embed body.page-detail .back-btn {
  display: none;
}

html.pt-embed .page-detail .top-bar {
  grid-template-columns: 1fr auto;
}

html.pt-embed .page-usmart-detail .top-bar,
html.pt-embed .page-futunn-detail .top-bar {
  grid-template-columns: 1fr;
}

html.pt-embed .page-transition-shell,
html.pt-embed .page-transition-shell.pt-enter-forward,
html.pt-embed .page-transition-shell.pt-enter-back,
html.pt-embed .page-transition-shell.pt-exit-back {
  animation: none !important;
  transform: none !important;
  opacity: 1 !important;
}

/* ── Desktop embed split: portfolio + rebalance side by side ── */
@media (min-width: 768px) {
  html.pt-embed-split body.page-detail {
    --detail-header-h: calc(56px + var(--safe-top));
    --detail-tabs-h: 0px;
    --detail-x: var(--page-x);
  }

  html.pt-embed-split body.page-detail .detail-sub-tabs {
    display: none !important;
  }

  html.pt-embed-split body.page-detail .top-bar {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    flex-shrink: 0;
    box-sizing: border-box;
    min-height: var(--detail-header-h);
    grid-template-columns: 1fr;
    align-items: center;
    padding: calc(8px + var(--safe-top)) var(--detail-x) 8px calc(var(--detail-x) * 2);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 2;
  }

  html.pt-embed-split body.page-detail .top-bar .back-btn {
    display: none;
  }

  html.pt-embed-split body.page-detail .top-bar .detail-title-wrap {
    min-width: 0;
  }

  html.pt-embed-split body.page-detail .detail-title-row {
    justify-content: space-between;
    gap: 8px;
  }

  html.pt-embed-split body.page-detail .detail-title-row h1 {
    flex: 0 1 auto;
    text-align: left;
  }

  html.pt-embed-split body.page-detail .page-transition-shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
  }

  html.pt-embed-split body.page-detail .detail-main,
  html.pt-embed-split body.page-detail .detail-main#app {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 !important;
    overflow: hidden;
  }

  html.pt-embed-split .page-detail .detail-swipe-viewport {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }

  html.pt-embed-split .page-detail .detail-swipe-track {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
    transform: none !important;
    align-items: stretch;
  }

  html.pt-embed-split .page-detail .detail-swipe-panel {
    flex: none !important;
    width: auto !important;
    max-width: none !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    padding: 12px 12px max(16px, var(--safe-bottom));
    box-sizing: border-box;
  }

  html.pt-embed-split .page-detail .detail-swipe-panel[data-tab="portfolio"] {
    padding-top: 12px;
    padding-left: var(--detail-x);
    padding-right: 10px;
  }

  html.pt-embed-split .page-detail .detail-swipe-panel[data-tab="rebalance"] {
    padding-top: 12px;
    padding-left: 10px;
    padding-right: var(--detail-x);
    border-left: 1px solid var(--border);
  }

  html.pt-embed-split .page-detail .detail-swipe-track.is-dragging .detail-swipe-panel,
  html.pt-embed-split .page-detail .detail-swipe-track.is-animating .detail-swipe-panel {
    transition: none;
    opacity: 1 !important;
    transform: none !important;
  }

  /* 分栏详情调仓列与首页同一套基准 grid，避免另开一列宽 */
  html.pt-embed-split .rebalance-table-header,
  html.pt-embed-split .rebalance-row {
    grid-template-columns: minmax(0, 1fr) 40px 72px 72px 56px;
    column-gap: 2px;
  }

  html.pt-embed-split .return-curve-chart {
    height: 156px;
  }

  html.pt-embed-split .return-curve-chart-layout {
    grid-template-rows: 142px 14px;
  }
}
