/* 
  全局样式（不依赖构建工具）。
  通过 CSS 变量实现主题切换（light/dark）。
*/

:root {
  --bg: #0b1220;
  --bg2: #0f172a;
  --card: rgba(255, 255, 255, 0.92);
  --cardBorder: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.62);
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
  --shadow2: 0 6px 18px rgba(2, 6, 23, 0.08);
  --radius: 16px;

  --primary: #2563eb;
  --primary2: #1d4ed8;
  --success: #16a34a;
  --danger: #ef4444;
  --warning: #f97316;

  --ring: rgba(37, 99, 235, 0.28);
  --gridMax: 1240px;
}

* {
  box-sizing: border-box;
}

html,
body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  --card: rgba(15, 23, 42, 0.78);
  --cardBorder: rgba(148, 163, 184, 0.16);
  --text: rgba(248, 250, 252, 0.92);
  --muted: rgba(248, 250, 252, 0.62);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
  --shadow2: 0 8px 22px rgba(0, 0, 0, 0.22);
  --ring: rgba(59, 130, 246, 0.35);
}

/* 背景：柔和渐变 + 微网格 */
.app-bg {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 10% 0%, rgba(37, 99, 235, 0.16), transparent 55%),
    radial-gradient(1000px 600px at 90% 0%, rgba(249, 115, 22, 0.14), transparent 55%),
    radial-gradient(900px 600px at 50% 100%, rgba(22, 163, 74, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(248, 250, 252, 1), rgba(241, 245, 249, 1));
}

html[data-theme="dark"] .app-bg {
  background:
    radial-gradient(1200px 700px at 10% 0%, rgba(37, 99, 235, 0.30), transparent 55%),
    radial-gradient(1000px 600px at 90% 0%, rgba(249, 115, 22, 0.20), transparent 55%),
    radial-gradient(900px 600px at 50% 100%, rgba(22, 163, 74, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

/* 首页背景图区域 */
.home-hero {
  position: relative;
  border-radius: 24px;
  min-height: 210px;
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--cardBorder);
  box-shadow: var(--shadow);
  background-image:
    linear-gradient(115deg, rgba(15, 23, 42, 0.62), rgba(15, 23, 42, 0.2)),
    url("https://images.unsplash.com/photo-1642543492481-44e81e3914a7?auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  background-position: center;
}

.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 240px at 80% 100%, rgba(59, 130, 246, 0.35), transparent 60%);
}

.home-hero-content {
  position: relative;
  z-index: 1;
  padding: 24px;
  color: #fff;
  max-width: 640px;
}

.home-hero-kicker {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.2px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.home-hero-title {
  margin-top: 12px;
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.12;
  font-weight: 900;
}

.home-hero-subtitle {
  margin-top: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.86);
}

/* 内页横幅（参考持仓页 Hero） */
.feature-hero {
  position: relative;
  border-radius: 24px;
  min-height: 168px;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--cardBorder);
  box-shadow: var(--shadow);
  background-size: cover;
  background-position: center;
}

.feature-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(102deg, rgba(2, 6, 23, 0.68), rgba(2, 6, 23, 0.28));
}

.feature-hero-rankings {
  background-image: url("https://images.unsplash.com/photo-1611974789855-9c2a0a7236a3?auto=format&fit=crop&w=1800&q=80");
}

.feature-hero-watchlist {
  background-image: url("https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?auto=format&fit=crop&w=1800&q=80");
}

.feature-hero-news {
  background-image: url("https://images.unsplash.com/photo-1611974789855-9c2a0a7236a3?auto=format&fit=crop&w=1800&q=80");
}

.feature-hero-content {
  position: relative;
  z-index: 1;
  color: #fff;
  padding: 16px 18px;
  max-width: 760px;
}

.feature-hero-kicker {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.feature-hero-title {
  margin-top: 10px;
  font-size: clamp(28px, 3.8vw, 40px);
  line-height: 1.1;
  font-weight: 900;
}

.feature-hero-subtitle {
  margin-top: 8px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.86);
}

.app-container {
  max-width: var(--gridMax);
  margin: 0 auto;
  padding: 28px 18px 46px;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(2, 6, 23, 0.06);
}

html[data-theme="dark"] .app-topbar {
  background: rgba(2, 6, 23, 0.40);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.app-topbar-inner {
  max-width: var(--gridMax);
  margin: 0 auto;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.25px;
}

.brand .logo {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

html[data-theme="dark"] .brand .logo {
  background: rgba(59, 130, 246, 0.18);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.55);
}

html[data-theme="dark"] .page-switch {
  background: rgba(15, 23, 42, 0.45);
}

.page-switch a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.15s ease;
}

.page-switch a.active {
  color: white;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.95), rgba(29, 78, 216, 0.95));
}

/* 右下角悬浮切换菜单（随滚动固定） */
.fab-switch {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: inline-flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

html[data-theme="dark"] .fab-switch {
  background: rgba(15, 23, 42, 0.84);
}

.fab-switch a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 120px;
  padding: 12px 14px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.fab-switch a.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.95), rgba(29, 78, 216, 0.95));
}

.fab-switch a i {
  font-size: 18px;
}

.fab-switch-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 82px;
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

html[data-theme="dark"] .fab-switch-toggle {
  background: rgba(15, 23, 42, 0.92);
}

body.is-scrolling .fab-switch {
  transform: scale(0.96) translateY(2px);
  opacity: 0.92;
}

.ranking-meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 榜单页重设计 */
.rankings-shell {
  max-width: 980px;
}

.rankings-hero {
  border-radius: 24px;
  border: 1px solid var(--cardBorder);
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(37, 99, 235, 0.2), transparent 60%),
    radial-gradient(700px 400px at 100% 100%, rgba(249, 115, 22, 0.18), transparent 62%),
    var(--card);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.rankings-hero-kicker {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

.rankings-hero-title {
  font-size: clamp(30px, 4vw, 38px);
  font-weight: 900;
  line-height: 1.08;
  margin: 0;
}

.rankings-hero-subtitle {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.rankings-hero-right {
  display: grid;
  gap: 10px;
}

.rankings-data-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  color: var(--muted);
}

html[data-theme="dark"] .rankings-data-badge {
  background: rgba(15, 23, 42, 0.6);
}

.rankings-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.rankings-tab-btn {
  border: 1px solid var(--cardBorder);
  border-radius: 14px;
  padding: 11px 10px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  transition: all 0.15s ease;
}

html[data-theme="dark"] .rankings-tab-btn {
  background: rgba(15, 23, 42, 0.6);
}

.rankings-tab-btn.active {
  color: #fff;
  border-color: rgba(37, 99, 235, 0.28);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.95), rgba(29, 78, 216, 0.95));
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.rankings-list-header {
  align-items: center;
}

.rankings-list-title {
  font-size: 18px;
}

.rankings-list {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.rankings-list.rankings-list--refreshing {
  opacity: 0.72;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.7);
}

html[data-theme="dark"] .ranking-item {
  background: rgba(15, 23, 42, 0.58);
}

.ranking-item.top3 {
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.12);
}

.rank-pill {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
}

.rank-normal {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.16);
}

.rank-top-1 {
  color: #7a3d00;
  background: linear-gradient(180deg, #fde68a, #f59e0b);
}

.rank-top-2 {
  color: #334155;
  background: linear-gradient(180deg, #e2e8f0, #94a3b8);
}

.rank-top-3 {
  color: #6b3410;
  background: linear-gradient(180deg, #fdba74, #f97316);
}

.ranking-main {
  flex: 1;
  min-width: 0;
}

.ranking-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-code {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.ranking-side {
  min-width: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  text-align: right;
  align-self: stretch;
}

.ranking-change {
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.4px;
}

.ranking-plus-btn {
  margin-top: 0;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--cardBorder);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  white-space: nowrap;
}

html[data-theme="dark"] .ranking-plus-btn {
  background: rgba(15, 23, 42, 0.65);
}

.ranking-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--cardBorder);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

html[data-theme="dark"] .ranking-chip {
  background: rgba(15, 23, 42, 0.62);
}

.chip {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.55);
}

html[data-theme="dark"] .chip {
  background: rgba(15, 23, 42, 0.45);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
  box-shadow: var(--shadow2);
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.85);
}

.btn:active {
  transform: translateY(1px);
}

html[data-theme="dark"] .btn {
  background: rgba(15, 23, 42, 0.60);
}

html[data-theme="dark"] .btn:hover {
  background: rgba(15, 23, 42, 0.78);
}

.btn-primary {
  border-color: rgba(37, 99, 235, 0.25);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.95), rgba(29, 78, 216, 0.95));
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(180deg, rgba(37, 99, 235, 1), rgba(29, 78, 216, 1));
}

.btn-danger {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.10);
  color: var(--danger);
}

.btn-ghost {
  box-shadow: none;
  background: transparent;
}

.card {
  border-radius: 20px;
  border: 1px solid var(--cardBorder);
  background: var(--card);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--cardBorder);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.summary-rate-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.1;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.88);
  color: rgba(15, 23, 42, 0.74);
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.10);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.summary-rate-badge.is-positive {
  color: #b91c1c;
  border-color: rgba(248, 113, 113, 0.28);
  background: linear-gradient(180deg, rgba(254, 226, 226, 0.95), rgba(254, 202, 202, 0.78));
}

.summary-rate-badge.is-negative {
  color: #166534;
  border-color: rgba(74, 222, 128, 0.26);
  background: linear-gradient(180deg, rgba(220, 252, 231, 0.95), rgba(187, 247, 208, 0.78));
}

html[data-theme="dark"] .summary-rate-badge {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.72);
  color: rgba(248, 250, 252, 0.76);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.26);
}

html[data-theme="dark"] .summary-rate-badge.is-positive {
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(185, 28, 28, 0.22);
  color: rgba(254, 202, 202, 0.94);
}

html[data-theme="dark"] .summary-rate-badge.is-negative {
  border-color: rgba(74, 222, 128, 0.26);
  background: rgba(22, 163, 74, 0.18);
  color: rgba(187, 247, 208, 0.94);
}

.card-body {
  padding: 22px;
}

.h1 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
}

.chip#autoUpdateStatus {
  min-width: 108px;
  justify-content: center;
}

.chip#autoUpdateStatus.is-syncing {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.1);
}

.chip#autoUpdateStatus.is-success {
  color: #15803d;
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
}

.chip#autoUpdateStatus.is-error {
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
}

.table-wrap.refreshing {
  animation: tableRefreshGlow 0.7s ease;
}

@keyframes tableRefreshGlow {
  0% {
    box-shadow: inset 0 0 0 0 rgba(37, 99, 235, 0);
  }
  40% {
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.22);
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.fund-row {
  position: relative;
  transition: background-color 0.18s ease;
}

.fund-row.fund-row-positive td:first-child {
  border-left: 3px solid rgba(34, 197, 94, 0.85);
}

.fund-row.fund-row-negative td:first-child {
  border-left: 3px solid rgba(239, 68, 68, 0.85);
}

.fund-row-updated {
  animation: rowUpdatedPulse 0.65s ease;
}

@keyframes rowUpdatedPulse {
  0% {
    background: rgba(37, 99, 235, 0.02);
  }
  50% {
    background: rgba(37, 99, 235, 0.12);
  }
  100% {
    background: rgba(37, 99, 235, 0.02);
  }
}

.value-updated {
  animation: valueBlink 0.55s ease;
}

@keyframes valueBlink {
  0% {
    opacity: 0.7;
    transform: translateY(1px);
  }
  60% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 1;
  }
}

.fund-cell-name {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fund-cell-amount {
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* 表格：更紧凑、可读性更强 */
.table-wrap {
  overflow: auto;
  border-radius: calc(var(--radius) - 2px);
  -webkit-overflow-scrolling: touch;
}

/* 持仓：桌面 / 手机副标题切换 */
.fund-subtle-mobile {
  display: none;
}

/* 手机端排序条（仅小屏） */
.fund-mobile-toolbar {
  display: none !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 0 14px 12px;
}

.fund-mobile-toolbar-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.fund-mobile-sort-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fund-sort-chip {
  border: 1px solid var(--cardBorder);
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.fund-sort-chip.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.95), rgba(29, 78, 216, 0.95));
}

html[data-theme="dark"] .fund-sort-chip.is-active {
  color: #fff;
}

/* 持仓卡片列表（手机） */
.fund-cards {
  display: none !important;
  flex-direction: column;
  gap: 12px;
  padding: 4px 12px 16px;
}

.fund-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  transition: background-color 0.18s ease, transform 0.12s ease;
  touch-action: pan-y;
}

html[data-theme="dark"] .fund-card {
  background: rgba(15, 23, 42, 0.72);
}

.fund-card.dragging {
  opacity: 0.5;
}

.fund-card.fund-card-positive {
  border-left: 4px solid rgba(34, 197, 94, 0.9);
}

.fund-card.fund-card-negative {
  border-left: 4px solid rgba(239, 68, 68, 0.9);
}

.fund-card-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.fund-card-drag {
  flex: 0 0 auto;
  color: var(--muted);
  padding-top: 2px;
  font-size: 18px;
}

.fund-card-head-main {
  flex: 1;
  min-width: 0;
}

.fund-card-code-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.fund-card-code {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.fund-card-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.15);
  color: rgb(29, 78, 216);
}

html[data-theme="dark"] .fund-card-badge {
  background: rgba(96, 165, 250, 0.2);
  color: rgb(147, 197, 253);
}

.fund-card-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.fund-card-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
}

.fund-card-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.5);
  color: rgb(37, 99, 235);
}

.fund-card-icon-btn.fund-card-icon-danger {
  color: rgb(220, 38, 38);
}

html[data-theme="dark"] .fund-card-icon-btn {
  background: rgba(15, 23, 42, 0.5);
}

.fund-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  padding-top: 10px;
  border-top: 1px solid var(--cardBorder);
}

.fund-card-metric-wide {
  grid-column: 1 / -1;
}

.fund-card-metric-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 2px;
}

.fund-card-metric-value {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}


.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  position: sticky;
  top: 0;
  background: rgba(241, 245, 249, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(15, 23, 42, 0.70);
  font-weight: 700;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.2px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] .table thead th {
  background: rgba(2, 6, 23, 0.35);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  color: rgba(248, 250, 252, 0.75);
}

.table th,
.table td {
  padding: 12px 14px;
  white-space: nowrap;
}

.table tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

html[data-theme="dark"] .table tbody tr:hover {
  background: rgba(59, 130, 246, 0.08);
}

/* 登录页容器 */
.auth-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 42px 18px;
}

/* 登录/注册全新视觉 */
.auth-v2 {
  max-width: 1180px;
  margin: 0 auto;
  padding: 42px 18px;
  display: grid;
  grid-template-columns: 1fr 430px;
  gap: 18px;
}

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  background-image:
    linear-gradient(120deg, rgba(15, 23, 42, 0.64), rgba(37, 99, 235, 0.24)),
    url("https://images.unsplash.com/photo-1460925895917-afdab827c52f?auto=format&fit=crop&w=2200&q=80");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.auth-page .auth-v2 {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 18px clamp(10px, 2.8vw, 28px);
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 520px);
  align-items: stretch;
}

.auth-v2-showcase {
  border-radius: 24px;
  border: 1px solid var(--cardBorder);
  box-shadow: var(--shadow);
  padding: 34px;
  min-height: 560px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-size: cover;
  background-position: center;
}

.auth-page .auth-v2-showcase,
.auth-page .auth-v2-card {
  min-height: calc(100dvh - 54px);
}

.auth-v2-login .auth-v2-showcase {
  background-image:
    linear-gradient(125deg, rgba(15, 23, 42, 0.74), rgba(29, 78, 216, 0.32)),
    url("https://images.unsplash.com/photo-1659874108382-748f41f4f1f8?auto=format&fit=crop&w=1400&q=80");
}

.auth-v2-register .auth-v2-showcase {
  background-image:
    linear-gradient(125deg, rgba(5, 46, 22, 0.72), rgba(22, 163, 74, 0.34)),
    url("https://images.unsplash.com/photo-1606189934846-a527add8a77b?auto=format&fit=crop&w=1400&q=80");
}

.auth-v2-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
}

.auth-v2-showcase h1 {
  margin-top: 18px;
  font-size: clamp(36px, 4vw, 50px);
  line-height: 1.08;
  font-weight: 900;
}

.auth-v2-showcase p {
  margin-top: 16px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.88);
  max-width: 560px;
}

.auth-v2-points {
  margin-top: 20px;
  display: grid;
  gap: 8px;
}

.auth-v2-points span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.94);
}

.auth-v2-form-wrap {
  display: flex;
  align-items: stretch;
}

.auth-v2-card {
  width: 100%;
  border-radius: 24px;
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-v2-head h2 {
  font-size: 38px;
  font-weight: 900;
  line-height: 1.05;
}

.auth-v2-head p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.auth-v2 form label {
  font-size: 13px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.8);
}

.auth-v2 .input {
  min-height: 46px;
  padding: 12px 14px;
  font-size: 14px;
}

.auth-v2 .subtle {
  font-size: 12px;
}

.auth-v2-link {
  display: inline-flex;
  align-items: center;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}

.auth-v2-link:hover {
  color: #1e40af;
  text-decoration: underline;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 460px;
  gap: 20px;
}

.auth-hero {
  min-height: 520px;
  border-radius: 24px;
  border: 1px solid var(--cardBorder);
  background:
    radial-gradient(1000px 600px at 0% 0%, rgba(37, 99, 235, 0.22), transparent 56%),
    radial-gradient(900px 520px at 100% 100%, rgba(249, 115, 22, 0.20), transparent 60%),
    var(--card);
  box-shadow: var(--shadow);
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-hero.login {
  background:
    radial-gradient(1000px 600px at 0% 0%, rgba(37, 99, 235, 0.24), transparent 56%),
    radial-gradient(900px 520px at 100% 100%, rgba(56, 189, 248, 0.18), transparent 60%),
    var(--card);
}

.auth-hero.register {
  background:
    radial-gradient(1000px 600px at 0% 0%, rgba(34, 197, 94, 0.22), transparent 56%),
    radial-gradient(900px 520px at 100% 100%, rgba(168, 85, 247, 0.20), transparent 60%),
    var(--card);
}

.auth-hero-title {
  font-size: clamp(28px, 4.8vw, 48px);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0.4px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--cardBorder);
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

html[data-theme="dark"] .auth-badge {
  background: rgba(15, 23, 42, 0.62);
}

.auth-hero-sub {
  margin-top: 14px;
  color: var(--muted);
  font-size: 15px;
}

.auth-hero-points {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.auth-hero-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}

.auth-panel .card {
  min-height: 520px;
}

.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  outline: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

html[data-theme="dark"] .input {
  background: rgba(15, 23, 42, 0.55);
}

.input:focus {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 4px var(--ring);
}

/* 添加基金交互重构 */
.fund-picker-modal {
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 30px);
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--cardBorder);
  background: var(--card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.fund-picker-header {
  padding: 16px 18px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.fund-picker-title {
  font-size: 20px;
  font-weight: 800;
}

.fund-picker-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.fund-picker-search {
  margin: 0 18px 12px;
  border: 1px solid var(--cardBorder);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 10px;
}

html[data-theme="dark"] .fund-picker-search {
  background: rgba(15, 23, 42, 0.6);
}

.fund-picker-search i {
  color: var(--muted);
}

.fund-picker-search input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.fund-picker-body {
  padding: 0 18px 18px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
  min-height: 320px;
}

.fund-picker-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.fund-picker-results-wrap {
  min-width: 0;
}

.fund-picker-results {
  height: 100%;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--cardBorder);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.64);
}

html[data-theme="dark"] .fund-picker-results {
  background: rgba(15, 23, 42, 0.58);
}

.fund-picker-empty {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
}

.fund-picker-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--cardBorder);
}

.fund-picker-item:last-child {
  border-bottom: none;
}

.fund-picker-item:hover {
  background: rgba(37, 99, 235, 0.06);
}

.fund-picker-item.active {
  background: rgba(37, 99, 235, 0.12);
}

.fund-picker-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.fund-picker-item-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.fund-picker-side {
  border: 1px solid var(--cardBorder);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

html[data-theme="dark"] .fund-picker-side {
  background: rgba(15, 23, 42, 0.6);
}

.fund-selected-display {
  min-height: 60px;
  border: 1px solid var(--cardBorder);
  border-radius: 12px;
  padding: 10px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
}

html[data-theme="dark"] .fund-selected-display {
  background: rgba(15, 23, 42, 0.7);
}

.fund-selected-display.active {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.12);
}

.fund-amount-wrap {
  margin-top: 4px;
}

.fund-picker-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.watchlist-modal {
  width: min(860px, calc(100vw - 24px));
}

.watch-picker-body {
  grid-template-columns: 1fr 260px;
}

.watchlist-wrap {
  border: 1px solid var(--cardBorder);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
  padding: 12px;
}

html[data-theme="dark"] .watchlist-wrap {
  background: rgba(15, 23, 42, 0.55);
}

.watchlist-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 8px;
}

.watchlist-list {
  display: grid;
  gap: 0;
}

.watchlist-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(80px, 0.8fr) minmax(84px, 0.8fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 6px 10px;
  border-bottom: 1px solid var(--cardBorder);
}

.watchlist-hcol {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.watchlist-hcol-main {
  text-align: left;
}

.watchlist-hcol-action {
  text-align: right;
}

.watchlist-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(72px, 0.9fr) minmax(78px, 0.8fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 6px;
  border-bottom: 1px solid var(--cardBorder);
}

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

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

.watchlist-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watchlist-code {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.watchlist-col-industry {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

.watchlist-col-change {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
  letter-spacing: -0.5px;
}

.watchlist-sector-name {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.watchlist-col-action {
  display: flex;
  justify-content: flex-end;
}

.watch-delete-btn {
  padding: 8px 10px;
  font-size: 12px;
}

.news-header {
  align-items: center;
}

.news-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

.news-toggle input {
  display: none;
}

.news-toggle-slider {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.38);
  position: relative;
  transition: all 0.18s ease;
}

.news-toggle-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(2, 6, 23, 0.2);
  transition: all 0.18s ease;
}

.news-toggle input:checked + .news-toggle-slider {
  background: rgba(37, 99, 235, 0.9);
}

.news-toggle input:checked + .news-toggle-slider::after {
  transform: translateX(20px);
}

.news-list {
  display: grid;
  gap: 10px;
}

.news-item {
  border: 1px solid var(--cardBorder);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  padding: 12px 14px;
}

html[data-theme="dark"] .news-item {
  background: rgba(15, 23, 42, 0.62);
}

.news-time {
  font-size: 12px;
  color: #f59e0b;
  margin-bottom: 6px;
}

.news-content {
  font-size: 16px;
  line-height: 1.52;
  color: var(--text);
}

.news-tags {
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.news-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.news-chip i {
  font-size: 12px;
  opacity: 0.85;
}

.news-chip-theme {
  font-weight: 700;
}

.news-chip-fund {
  opacity: 0.9;
}

.news-chip--tone-0 {
  color: #0f766e;
  border-color: rgba(20, 184, 166, 0.3);
  background: linear-gradient(180deg, rgba(204, 251, 241, 0.92), rgba(153, 246, 228, 0.7));
}

.news-chip--tone-1 {
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.32);
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.92), rgba(191, 219, 254, 0.7));
}

.news-chip--tone-2 {
  color: #9a3412;
  border-color: rgba(251, 146, 60, 0.32);
  background: linear-gradient(180deg, rgba(255, 237, 213, 0.95), rgba(254, 215, 170, 0.75));
}

.news-chip--tone-3 {
  color: #7e22ce;
  border-color: rgba(168, 85, 247, 0.3);
  background: linear-gradient(180deg, rgba(243, 232, 255, 0.94), rgba(233, 213, 255, 0.74));
}

.news-chip--tone-4 {
  color: #b91c1c;
  border-color: rgba(248, 113, 113, 0.32);
  background: linear-gradient(180deg, rgba(254, 226, 226, 0.94), rgba(254, 202, 202, 0.74));
}

html[data-theme="dark"] .news-chip {
  color: rgba(241, 245, 249, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .news-chip--tone-0 {
  border-color: rgba(45, 212, 191, 0.32);
  background: rgba(13, 148, 136, 0.26);
}

html[data-theme="dark"] .news-chip--tone-1 {
  border-color: rgba(96, 165, 250, 0.34);
  background: rgba(37, 99, 235, 0.28);
}

html[data-theme="dark"] .news-chip--tone-2 {
  border-color: rgba(251, 146, 60, 0.34);
  background: rgba(194, 65, 12, 0.28);
}

html[data-theme="dark"] .news-chip--tone-3 {
  border-color: rgba(192, 132, 252, 0.34);
  background: rgba(126, 34, 206, 0.28);
}

html[data-theme="dark"] .news-chip--tone-4 {
  border-color: rgba(248, 113, 113, 0.36);
  background: rgba(185, 28, 28, 0.28);
}

.news-loading,
.news-done {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

/* 小屏优化 */
@media (max-width: 640px) {
  .app-topbar {
    position: sticky;
    top: 0;
  }
  .app-topbar-inner {
    padding: 12px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .brand {
    justify-content: flex-start;
    font-size: 16px;
  }
  .brand .logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .top-actions {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  .top-actions > * {
    flex: 0 0 auto;
  }
  .app-container {
    padding: 18px 12px 28px;
  }
  .chip {
    font-size: 11px;
    padding: 6px 9px;
  }
  .btn {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
  }
  .h1 {
    font-size: 20px;
  }
  .card-header {
    padding: 14px 14px;
  }
  .card-body {
    padding: 14px;
  }
  .table-wrap {
    overflow-x: auto;
  }
  .table {
    min-width: 780px;
  }
  .table th,
  .table td {
    padding: 10px 10px;
    font-size: 12px;
  }
  .fund-cell-name {
    max-width: 140px;
  }
  .fund-cell-amount {
    min-width: 86px;
  }
  .fund-realtime-time {
    display: none;
  }

  /* 持仓：手机卡片视图，避免横滑宽表 */
  .fund-subtle-desktop {
    display: none;
  }
  .fund-subtle-mobile {
    display: block;
  }
  .fund-mobile-toolbar {
    display: flex !important;
  }
  .fund-cards {
    display: flex !important;
    flex-direction: column;
  }
  .fund-table-desktop {
    display: none !important;
  }
  .fund-list-wrap {
    overflow: visible;
  }
  /* 有悬浮导航的页面：预留底部空间 + 安全区（避免被 Home 条 / 刘海遮挡） */
  body:has(.fab-switch) .app-container {
    padding-bottom: calc(148px + env(safe-area-inset-bottom, 0px));
  }
  body.fab-switch-collapsed:has(.fab-switch) .app-container {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .fab-switch {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 8px;
    border-radius: 16px;
  }
  .fab-switch a {
    min-width: 102px;
    padding: 10px 11px;
    gap: 8px;
    border-radius: 12px;
    font-size: 13px;
  }
  .fab-switch-toggle {
    display: inline-flex;
  }
  body.fab-switch-collapsed .fab-switch {
    gap: 0;
    padding: 6px;
  }
  body.fab-switch-collapsed .fab-switch a {
    display: none;
  }
  body.fab-switch-collapsed .fab-switch-toggle {
    min-width: 64px;
    min-height: 32px;
    padding: 6px 8px;
    font-size: 11px;
  }
  body.fab-switch-collapsed .fab-switch-toggle span {
    display: none;
  }
  .rankings-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rankings-hero {
    padding: 16px;
  }
  .rankings-hero-title {
    font-size: 24px;
  }
  .ranking-item {
    padding: 12px;
    gap: 10px;
    align-items: flex-start;
  }
  .rank-pill {
    width: 38px;
    height: 38px;
  }
  .ranking-side {
    min-width: 104px;
    gap: 8px;
  }
  .ranking-plus-btn {
    min-height: 30px;
    padding: 0 8px;
    font-size: 11px;
  }
  .ranking-name {
    font-size: 14px;
    white-space: normal;
    line-height: 1.25;
  }
  .ranking-change {
    font-size: 20px;
  }
  .fund-picker-modal {
    width: calc(100vw - 14px);
    max-height: calc(100vh - 14px);
    border-radius: 14px;
  }
  .fund-picker-header {
    padding: 12px 12px 8px;
  }
  .fund-picker-title {
    font-size: 17px;
  }
  .fund-picker-search {
    margin: 0 12px 10px;
  }
  .fund-picker-body {
    padding: 0 12px 12px;
    grid-template-columns: 1fr;
  }
  .watch-picker-body {
    grid-template-columns: 1fr;
  }
  .fund-picker-results {
    max-height: 260px;
  }
  .home-hero {
    min-height: 168px;
    border-radius: 16px;
  }
  .home-hero-content {
    padding: 16px;
  }
  .home-hero-title {
    font-size: 22px;
  }
  .feature-hero {
    min-height: 136px;
    border-radius: 16px;
  }
  .feature-hero-content {
    padding: 12px 14px;
  }
  .feature-hero-title {
    font-size: 22px;
  }
  .feature-hero-subtitle {
    font-size: 13px;
  }
  .news-content {
    font-size: 14px;
  }
  .news-chip {
    font-size: 11px;
    padding: 2px 8px;
  }
  .news-chip i {
    font-size: 11px;
  }
}

@media (max-width: 980px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }
  .auth-hero {
    min-height: auto;
  }
  .auth-panel .card {
    min-height: auto;
  }
  .rankings-hero {
    flex-direction: column;
  }
  .auth-v2 {
    grid-template-columns: 1fr;
    padding-top: 22px;
  }
  .auth-page .auth-v2 {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: 10px;
    padding-bottom: 10px;
    grid-template-columns: 1fr;
  }
  .auth-v2-showcase {
    min-height: 340px;
  }
  .auth-page .auth-v2-showcase,
  .auth-page .auth-v2-card {
    min-height: auto;
  }
  .auth-v2-head h2 {
    font-size: 32px;
  }
}

@media (max-width: 420px) {
  .app-container {
    padding-left: 10px;
    padding-right: 10px;
  }
  .home-hero-title {
    font-size: 20px;
  }
  .home-hero-subtitle {
    font-size: 13px;
  }
  .fab-switch {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .fab-switch a {
    min-width: 92px;
    padding: 9px 10px;
    font-size: 12px;
  }
  .auth-v2 {
    padding-left: 10px;
    padding-right: 10px;
  }
  .auth-page {
    background-attachment: scroll;
  }
  .watchlist-row {
    grid-template-columns: minmax(0, 1.5fr) minmax(64px, 0.8fr) minmax(64px, 0.6fr) auto;
    gap: 8px;
    padding: 10px 2px;
  }
  .watchlist-table-head {
    grid-template-columns: minmax(0, 1.5fr) minmax(64px, 0.8fr) minmax(64px, 0.6fr) auto;
    gap: 8px;
    padding: 8px 2px 10px;
  }
  .watchlist-hcol {
    font-size: 11px;
  }
  .watchlist-name {
    font-size: 14px;
  }
  .watchlist-col-industry {
    font-size: 12px;
  }
  .watchlist-col-change {
    font-size: 16px;
  }
  .watchlist-sector-name {
    font-size: 11px;
  }
  .watch-delete-btn span {
    display: none;
  }
  .auth-v2-card {
    padding: 18px 16px;
    border-radius: 16px;
  }
  .auth-v2-head h2 {
    font-size: 28px;
  }
}

/* ===== 用户管理后台（admin） ===== */
.admin-shell {
  max-width: 1480px;
  padding-top: 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* 宽屏：左侧用户列表区内滚动，右侧持仓贴顶固定视口内，避免用户多时要滚到页面最底 */
@media (min-width: 981px) {
  .admin-grid {
    align-items: start;
  }

  .admin-pane-users,
  .admin-pane-funds {
    position: sticky;
    top: 76px;
    max-height: calc(100vh - 96px);
    min-height: 0;
    align-self: start;
  }

  .admin-pane-users .card-header,
  .admin-pane-funds .card-header {
    flex-shrink: 0;
  }

  .admin-pane-users .card-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-pane-funds .card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.admin-dashboard {
  grid-column: 1 / -1;
}

.admin-dashboard .card-body {
  padding-top: 8px;
}

.admin-dashboard-stats {
  flex-wrap: wrap;
}

.admin-dashboard-stats .admin-stat-card {
  min-width: 140px;
  flex: 1 1 140px;
}

.admin-stat-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.admin-dashboard-footnote {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.45;
}

.admin-dashboard-section-title {
  margin: 20px 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--foreground, #0f172a);
  border-bottom: 1px solid var(--cardBorder);
  padding-bottom: 8px;
}

html[data-theme="dark"] .admin-dashboard-section-title {
  color: var(--foreground, #f8fafc);
}

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

  .admin-pane-users,
  .admin-pane-funds {
    position: static;
    top: auto;
    max-height: none;
    align-self: stretch;
  }

  .admin-pane-users .card-body {
    max-height: min(52vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-pane-funds .card-body {
    overflow-y: visible;
    max-height: none;
  }
}

.admin-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.admin-pane .card-body {
  flex: 1 1 auto;
  min-height: 0;
}

/* 不要在此加 overflow:visible，会覆盖宽屏下 card-body 的 overflow-y:auto */
.admin-pane-users .card-body {
  padding-top: 10px;
}

.admin-login-card {
  max-width: 560px;
  margin: 0 auto;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 4px;
}

.admin-users-header {
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
}

.admin-users-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--cardBorder);
  background: var(--card);
  border-radius: 12px;
  padding: 6px 10px;
}

.admin-search i {
  color: var(--muted);
}

.admin-search input.input {
  border: none;
  box-shadow: none;
  padding: 6px 0;
  min-width: 220px;
}

.admin-users-list {
  display: grid;
  gap: 10px;
}

.admin-user-row {
  border: 1px solid var(--cardBorder);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 8px;
  align-items: start;
}

html[data-theme="dark"] .admin-user-row {
  background: rgba(15, 23, 42, 0.6);
}

.admin-user-row.is-active {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

.admin-user-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.admin-user-title {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.admin-user-name {
  font-weight: 800;
  color: var(--text);
}

.admin-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.15);
  color: rgb(29, 78, 216);
}

html[data-theme="dark"] .admin-badge {
  background: rgba(96, 165, 250, 0.2);
  color: rgb(147, 197, 253);
}

.admin-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.3;
}

.admin-user-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  align-items: center;
  align-self: center;
}

.admin-mini-btn {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1;
  border-radius: 12px;
  min-width: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  gap: 4px;
}

.admin-mini-danger {
  color: rgb(220, 38, 38);
}

.admin-mini-btn i {
  font-size: 13px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.admin-stat-card {
  border: 1px solid var(--cardBorder);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  padding: 10px 12px;
}

html[data-theme="dark"] .admin-stat-card {
  background: rgba(15, 23, 42, 0.65);
}

.admin-stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.admin-stat-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.admin-stat-value.is-positive {
  color: #dc2626;
}

.admin-stat-value.is-negative {
  color: #16a34a;
}

.admin-summary {
  margin-bottom: 6px;
}

@media (max-width: 980px) {
  .admin-shell {
    max-width: 100%;
  }
  .admin-pane {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .admin-users-header {
    align-items: stretch;
  }
  .admin-users-tools {
    width: 100%;
    justify-content: flex-start;
  }
  .admin-search {
    flex: 1;
    min-width: 0;
  }
  .admin-search input.input {
    min-width: 0;
    width: 100%;
  }
  .admin-user-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .admin-user-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    align-self: auto;
  }
  .admin-mini-btn {
    min-width: 64px;
  }
  .admin-stats {
    grid-template-columns: 1fr;
  }
}

/* ===== 管理员数据看板（独立页 /admin/dashboard）===== */
.dash-page {
  max-width: 1180px;
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

@media (max-width: 900px) {
  .dash-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .dash-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.dash-kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--cardBorder);
  background: var(--card);
  box-shadow: var(--shadow2);
}

.dash-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.dash-kpi-icon--blue {
  background: rgba(37, 99, 235, 0.14);
  color: var(--primary);
}

.dash-kpi-icon--green {
  background: rgba(22, 163, 74, 0.14);
  color: var(--success);
}

.dash-kpi-icon--orange {
  background: rgba(249, 115, 22, 0.16);
  color: var(--warning);
}

.dash-kpi-icon--violet {
  background: rgba(139, 92, 246, 0.16);
  color: #7c3aed;
}

.dash-kpi-value {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--text);
}

.dash-kpi-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}

.dash-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

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

.dash-chart-card .card-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.dash-chart-head {
  width: 100%;
}

.dash-chart-title {
  font-weight: 800;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.dash-chart-title i {
  color: var(--primary);
}

.dash-chart-body {
  position: relative;
  min-height: 240px;
}

.dash-chart-body--doughnut {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-chart-body--doughnut canvas {
  max-width: 280px;
  max-height: 280px;
}

.dash-section-title {
  font-size: 16px;
  font-weight: 800;
  margin: 10px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  border-bottom: 1px solid var(--cardBorder);
  padding-bottom: 10px;
}

.dash-section-title i {
  color: var(--primary);
}

.dash-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dash-detail-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--cardBorder);
  background: var(--card);
  box-shadow: var(--shadow2);
}

.dash-detail-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  font-size: 20px;
  flex-shrink: 0;
}

.dash-detail-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.dash-detail-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}

.dash-footnote {
  font-size: 12px;
  line-height: 1.45;
  margin-top: 8px;
}

