/* 盈立证券 uSMART — 三页高还原 */
:root {
  --bg: #131313;
  --bg2: #1a1a1a;
  --bg3: #1c1c1e;
  --text: #ffffff;
  --text2: #8e8e93;
  --text3: #6e6e73;
  --blue: #0a84ff;
  --blue-active: #1084dd;
  --red: #ff3b5c;
  --red-up: #e03a5c;
  --green-down: #00c853;
  --green-down2: #1db954;
  --teal: #14aa7d;
  --border: #2a2a2a;
  --nav-h: 54px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --phone-w: 390px;
}

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

html, body {
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  font-family: "PingFang SC", "SF Pro Text", "Helvetica Neue",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  overflow: hidden;
}

/* ========== App (mobile full-screen) ========== */
.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
}

@media (min-width: 481px) {
  body {
    background: #000;
  }
  .app {
    box-shadow: 0 0 0 1px #222;
  }
}

/* ========== Pages ========== */
.pages {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
  transition: opacity .18s ease, transform .18s ease;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

.page.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  z-index: 1;
}

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

/* ========== Bottom Nav ========== */
.bottom-nav {
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  background: #161616;
  border-top: 0.5px solid #2a2a2a;
  flex-shrink: 0;
  z-index: 30;
  padding-top: 0;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 6px;
  gap: 2px;
  color: #b0b0b0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.nav-item .nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item .nav-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.nav-item span {
  font-size: 10px;
  line-height: 1.2;
}

.nav-item.active {
  color: var(--blue-active);
}

.nav-item.active .nav-icon svg {
  stroke: var(--blue-active);
  fill: var(--blue-active);
}

.nav-item.active .nav-icon svg.outline-only {
  fill: none;
}

.nav-item.active .nav-icon svg.filled-only {
  stroke: none;
}

/* ========== Shared icons helpers ========== */
.chevron {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #666;
  border-top: 1.5px solid #666;
  transform: rotate(45deg);
  flex-shrink: 0;
}

.chevron.down {
  transform: rotate(135deg);
  width: 6px;
  height: 6px;
  border-color: #999;
}

.chevron.white { border-color: rgba(255,255,255,.7); }

/* ========== PAGE: 我的 ========== */
.me-header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  padding: 4px 16px 8px;
}

.me-header-actions button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  position: relative;
  padding: 4px;
  display: flex;
}

.me-header-actions .dot {
  position: absolute;
  top: 2px;
  right: 0;
  width: 7px;
  height: 7px;
  background: #ff3b30;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
}

.me-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 16px 16px;
}

.me-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.me-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.me-user .phone-num {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.3px;
  line-height: 1.3;
}

.me-user .uid {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text2);
}

.me-user .uid .copy {
  opacity: .7;
  display: flex;
}

/* Upgrade banner */
.upgrade-banner {
  margin: 0 16px 14px;
  height: 62px;
  border-radius: 10px;
  background:
    linear-gradient(115deg, #1eb896 0%, #14aa7d 45%, #0d9a72 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.upgrade-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 120% at 70% 120%, rgba(255,255,255,.18), transparent 55%),
    radial-gradient(ellipse 60% 80% at 20% -20%, rgba(255,255,255,.12), transparent 50%);
  pointer-events: none;
}

.upgrade-banner .ub-text { position: relative; z-index: 1; }
.upgrade-banner .ub-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}
.upgrade-banner .ub-sub {
  font-size: 12px;
  color: rgba(255,255,255,.85);
  margin-top: 2px;
}
.upgrade-banner .ub-btn {
  position: relative;
  z-index: 1;
  background: #fff;
  color: #0d8a6a;
  border: none;
  border-radius: 6px;
  padding: 6px 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

/* Feature row */
.feature-row {
  display: flex;
  justify-content: space-around;
  padding: 6px 8px 18px;
}

.feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.feature-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.feature-item span {
  font-size: 12px;
  color: #e8e8e8;
  white-space: nowrap;
}

/* Menu list */
.menu-list {
  background: var(--bg2);
  margin: 0;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
  cursor: pointer;
  min-height: 52px;
}

.menu-item + .menu-item {
  border-top: none;
}

.menu-item .mi-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.menu-item .mi-icon svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-item .mi-body {
  flex: 1;
  min-width: 0;
}

.menu-item .mi-title {
  font-size: 15px;
  color: #fff;
  line-height: 1.3;
}

.menu-item .mi-sub {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
}

/* ========== PAGE: 自选/市场 ========== */
.wl-top {
  display: flex;
  align-items: center;
  padding: 6px 12px 4px 14px;
  gap: 4px;
}

.wl-logo {
  width: 28px;
  height: 28px;
  margin-right: 6px;
  flex-shrink: 0;
}

.wl-tabs {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex: 1;
}

.wl-tab {
  background: none;
  border: none;
  color: #8e8e93;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  padding: 4px 0 8px;
  font-weight: 400;
}

.wl-tab.active {
  color: #fff;
  font-size: 22px;
  font-weight: 600;
}

.wl-tab.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  background: var(--blue);
  border-radius: 50%;
}

.wl-search {
  background: none;
  border: none;
  color: #fff;
  padding: 6px;
  cursor: pointer;
  display: flex;
}

.wl-subtabs {
  display: flex;
  align-items: center;
  padding: 2px 0 8px 16px;
  gap: 0;
  overflow-x: auto;
}

.wl-subtabs::-webkit-scrollbar { display: none; }

.wl-sub {
  background: none;
  border: none;
  color: #8e8e93;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 12px;
  white-space: nowrap;
  position: relative;
}

.wl-sub.active {
  color: #fff;
}

.wl-sub.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2.5px;
  background: var(--blue);
  border-radius: 2px;
}

.wl-filter {
  margin-left: auto;
  margin-right: 12px;
  background: none;
  border: none;
  color: #aaa;
  padding: 4px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
}

/* Rewards */
.rewards-section {
  padding: 4px 0 10px;
}

.rewards-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px;
  font-size: 13px;
  color: var(--text2);
}

.rewards-scroll {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
}

.rewards-scroll::-webkit-scrollbar { display: none; }

.reward-card {
  flex: 0 0 118px;
  height: 56px;
  border-radius: 8px;
  background: linear-gradient(180deg, #e8f4ff 0%, #d4ebff 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.reward-card .rc-icon {
  width: 28px;
  height: 28px;
  background: #fff;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.reward-card .rc-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.reward-card .rc-amt {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.2;
}

.reward-card .rc-label {
  font-size: 11px;
  color: #8e8e93;
}

/* Stock list controls */
.stock-controls {
  display: flex;
  align-items: center;
  padding: 8px 12px 4px;
  gap: 10px;
}

.stock-controls .view-icons {
  display: flex;
  gap: 10px;
  color: #888;
  flex-shrink: 0;
}

.stock-controls .cols {
  display: flex;
  flex: 1;
  justify-content: flex-end;
  gap: 0;
  font-size: 11px;
  color: var(--text2);
}

.stock-controls .col-h {
  display: flex;
  align-items: center;
  gap: 1px;
  width: 58px;
  justify-content: flex-end;
  white-space: nowrap;
}

.stock-controls .col-h:last-child { width: 48px; }

.sort-arrows {
  display: flex;
  flex-direction: column;
  line-height: 0.55;
  font-size: 7px;
  color: #555;
  margin-left: 1px;
}

/* Stock rows */
.stock-list { padding: 0 12px; }

.stock-row {
  display: flex;
  align-items: flex-start;
  padding: 10px 0;
  gap: 4px;
}

.stock-row .sr-name {
  width: 100px;
  flex-shrink: 0;
  padding-right: 4px;
}

.stock-row .sr-name .cn {
  font-size: 15px;
  color: #fff;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stock-row .sr-name .code {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
}

.stock-row .sr-data {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.stock-row .sr-col {
  width: 58px;
  text-align: right;
}

.stock-row .sr-col:last-child { width: 48px; }

.stock-row .sr-col .v {
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  line-height: 1.3;
}

.stock-row .sr-col .sub {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  flex-wrap: wrap;
}

.stock-row .badge {
  display: inline-block;
  font-size: 9px;
  border: 0.5px solid #555;
  border-radius: 2px;
  padding: 0 3px;
  color: #888;
  line-height: 1.4;
}

.up { color: var(--red-up) !important; }
.down { color: var(--green-down2) !important; }
.neutral { color: #fff !important; }

.wl-actions {
  display: flex;
  gap: 12px;
  padding: 16px;
}

.wl-actions button {
  flex: 1;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: #2a2a2a;
  color: #c8c8c8;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ========== PAGE: 交易 ========== */
.tr-header {
  display: flex;
  align-items: center;
  padding: 6px 14px 10px;
  gap: 4px;
}

.tr-logo {
  width: 28px;
  height: 28px;
  margin-right: 4px;
}

.tr-tabs {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex: 1;
}

.tr-tab {
  background: none;
  border: none;
  color: #8e8e93;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 0;
  font-weight: 400;
}

.tr-tab.active {
  color: #fff;
  font-size: 22px;
  font-weight: 600;
}

.tr-header-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.tr-header-actions button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  position: relative;
  display: flex;
  padding: 2px;
}

.tr-header-actions .dot {
  position: absolute;
  top: 0;
  right: -2px;
  width: 7px;
  height: 7px;
  background: #ff3b30;
  border-radius: 50%;
}

/* Asset card */
.asset-card {
  margin: 0 14px 14px;
  border-radius: 12px;
  background: linear-gradient(105deg, #5ac8fa 0%, #2ba4ff 40%, #1a90ff 100%);
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
  min-height: 100px;
}

.asset-card::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -30px;
  width: 140px;
  height: 100px;
  background: radial-gradient(ellipse, rgba(255,255,255,.2), transparent 70%);
  pointer-events: none;
}

.ac-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,.85);
  position: relative;
  z-index: 1;
}

.ac-top-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ac-top-left .eye { opacity: .8; display: flex; }

.ac-currency {
  display: flex;
  align-items: center;
  gap: 3px;
}

.ac-top-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ac-value {
  font-size: 32px;
  font-weight: 600;
  color: #fff;
  margin-top: 10px;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}

.ac-filter {
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: rgba(255,255,255,.9);
  z-index: 1;
  display: flex;
}

/* Action grid */
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 0;
  padding: 4px 8px 18px;
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.action-item .ai-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.action-item .ai-icon img {
  width: 44px;
  height: 44px;
  object-fit: cover;
}

.ai-blue { background: #1a5a9e; }
.ai-blue2 { background: #164e8a; }
.ai-gold { background: #8a6a18; }
.ai-orange { background: #9a4a28; }
.ai-yellow { background: #7a6a18; }
.ai-coral { background: #8a4828; }
.ai-purple { background: #4a3a6a; }
.ai-navy { background: #163a5a; }

.ipo-txt {
  font-size: 13px;
  font-weight: 700;
  color: #ffc8a0;
  letter-spacing: 0.5px;
}

.action-item span {
  font-size: 12px;
  color: #e0e0e0;
  text-align: center;
  line-height: 1.25;
  max-width: 72px;
}

/* Holdings tabs */
.hold-tabs {
  display: flex;
  align-items: center;
  padding: 4px 14px 0;
  gap: 18px;
  border-bottom: 0.5px solid #2a2a2a;
}

.hold-tab {
  background: none;
  border: none;
  color: #8e8e93;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  padding: 10px 0;
  position: relative;
}

.hold-tab.active {
  color: #fff;
  font-weight: 500;
}

.hold-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.5px;
  background: var(--blue);
  border-radius: 2px;
}

.hold-gear {
  margin-left: auto;
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  display: flex;
  padding: 8px;
}

/* Account block */
.account-block {
  padding: 12px 14px 0;
}

.account-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.account-head img {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
}

.account-head .ah-title {
  font-size: 14px;
  color: #fff;
  flex: 1;
}

.account-stats {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.9fr;
  gap: 8px;
  margin-bottom: 14px;
}

.as-col .as-label {
  font-size: 11px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 4px;
}

.as-col .as-val {
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.as-col .as-val.down { color: var(--green-down2); }

/* Holdings table */
.hold-table-head {
  display: flex;
  padding: 6px 14px;
  font-size: 11px;
  color: var(--text2);
}

.hold-table-head span:nth-child(1) { flex: 1.1; }
.hold-table-head span:nth-child(2) { flex: 1; text-align: right; }
.hold-table-head span:nth-child(3) { flex: 1; text-align: right; }
.hold-table-head span:nth-child(4) { flex: 0.9; text-align: right; }

.hold-row {
  display: flex;
  padding: 10px 14px;
  align-items: flex-start;
}

.hold-row .hr-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hold-row .hr-col:nth-child(1) { flex: 1.1; }
.hold-row .hr-col:nth-child(2) { flex: 1; text-align: right; align-items: flex-end; }
.hold-row .hr-col:nth-child(3) { flex: 1; text-align: right; align-items: flex-end; }
.hold-row .hr-col:nth-child(4) { flex: 0.9; text-align: right; align-items: flex-end; }

.hold-row .hr-main {
  font-size: 14px;
  color: #fff;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.hold-row .hr-sub {
  font-size: 11px;
  color: var(--text2);
}

.hold-row .hr-col:nth-child(4) .hr-main,
.hold-row .hr-col:nth-child(4) .hr-sub {
  color: var(--green-down2);
}

.info-i {
  display: inline-flex;
  width: 12px;
  height: 12px;
  border: 1px solid #666;
  border-radius: 50%;
  font-size: 8px;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  color: #666;
  vertical-align: middle;
}
