@import "tailwindcss";
@import "tw-animate-css";
@import "shadcn/tailwind.css";

@custom-variant dark (&:is(.dark *));

:root {
  --bg: #0f172a;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #22d3ee;
  --accent: #60a5fa;
  --success: #34d399;
  --danger: #f87171;
  --border: #1f2937;
  --table-pinned-header-bg: #2a394b;
  --table-row-hover-bg: #2a394b;
  --radius: 0.625rem;
  --background: #0f172a;
  --foreground: #e5e7eb;
  --card-foreground: #e5e7eb;
  --popover: #111827;
  --popover-foreground: #e5e7eb;
  --primary-foreground: #0f172a;
  --secondary: #0b1220;
  --secondary-foreground: #e5e7eb;
  --muted-foreground: #9ca3af;
  --accent-foreground: #e5e7eb;
  --destructive: #f87171;
  --input: #0b1220;
  --ring: #22d3ee;
  --chart-1: #22d3ee;
  --chart-2: #60a5fa;
  --chart-3: #34d399;
  --chart-4: #f472b6;
  --chart-5: #fbbf24;
  --sidebar: #111827;
  --sidebar-foreground: #e5e7eb;
  --sidebar-primary: #22d3ee;
  --sidebar-primary-foreground: #0f172a;
  --sidebar-accent: #1f2937;
  --sidebar-accent-foreground: #e5e7eb;
  --sidebar-border: #1f2937;
  --sidebar-ring: #22d3ee;
  --drawer-overlay: rgba(2, 6, 23, 0.5);
  --dialog-overlay: rgba(2, 6, 23, 0.6);
  --tabs-list-bg: rgba(255, 255, 255, 0.04);
  --tabs-list-border: transparent;
  --tabs-trigger-active-bg: rgba(34, 211, 238, 0.12);
  --tabs-trigger-active-text: var(--primary);
  --switch-thumb: var(--foreground);
}

/* 亮色主题：ui-ux-pro-max 规范 - 正文 #0F172A、弱化 #475569、玻璃 bg-white/80+、边框可见 */
[data-theme="light"] {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --primary: #0891b2;
  --accent: #2563eb;
  --success: #059669;
  --danger: #dc2626;
  --border: #e2e8f0;
  --table-pinned-header-bg: #e2e8f0;
  --table-row-hover-bg: #e2e8f0;
  --background: #ffffff;
  --foreground: #0f172a;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f9;
  --secondary-foreground: #0f172a;
  --muted-foreground: #475569;
  --accent-foreground: #ffffff;
  --destructive: #dc2626;
  --input: #f1f5f9;
  --ring: #0891b2;
  --chart-1: #0891b2;
  --chart-2: #2563eb;
  --chart-3: #059669;
  --chart-4: #db2777;
  --chart-5: #ca8a04;
  --sidebar: #f8fafc;
  --sidebar-foreground: #0f172a;
  --sidebar-primary: #0891b2;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #f1f5f9;
  --sidebar-accent-foreground: #0f172a;
  --sidebar-border: #e2e8f0;
  --sidebar-ring: #0891b2;
  --drawer-overlay: rgba(15, 23, 42, 0.25);
  --dialog-overlay: rgba(15, 23, 42, 0.35);
  --tabs-list-bg: rgba(0, 0, 0, 0.04);
  --tabs-list-border: var(--border);
  --tabs-trigger-active-bg: rgba(8, 145, 178, 0.15);
  --tabs-trigger-active-text: var(--primary);
  --switch-thumb: var(--background);
}

* {
  box-sizing: border-box;
}

html,
body {
  overscroll-behavior-y: none;
  height: 100%;
  overflow-x: clip;
  will-change: auto; /* 或者移除任何 will-change: transform */
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  position: relative;
}

/* 渐变层固定为视口大小，随宽高变化自动重绘，保证任意尺寸下都连贯 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  /* 降低顶部光晕强度，上方颜色更深 */
  background:
    radial-gradient(
      ellipse 140% 140% at 10% -10%,
      rgba(96, 165, 250, 0.08) 0%,
      rgba(96, 165, 250, 0.035) 35%,
      rgba(96, 165, 250, 0.01) 55%,
      transparent 72%
    ),
    radial-gradient(
      ellipse 140% 140% at 90% 0%,
      rgba(34, 211, 238, 0.07) 0%,
      rgba(34, 211, 238, 0.03) 38%,
      rgba(34, 211, 238, 0.008) 58%,
      transparent 75%
    );
}

[data-theme="light"] body::before {
  background:
    radial-gradient(
      ellipse 120% 120% at 10% -10%,
      rgba(59, 130, 246, 0.06) 0%,
      rgba(59, 130, 246, 0.02) 40%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 120% 120% at 90% 0%,
      rgba(8, 145, 178, 0.05) 0%,
      rgba(8, 145, 178, 0.015) 45%,
      transparent 70%
    );
}

.container {
  max-width: 100%;
  width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.page-width-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.4);
  outline: none;
}

.page-width-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}

.page-width-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.page-width-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}

[data-theme="light"] .glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.85));
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(12px);
}

/* 亮色主题：按钮样式适配 */
[data-theme="light"] .button {
  border-color: rgba(8, 145, 178, 0.4);
  background: linear-gradient(180deg, #0ea5e9, #0891b2);
  color: #fff;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.2);
}

[data-theme="light"] .button:hover {
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.35);
}

[data-theme="light"] .button.secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .button.secondary:hover {
  background: #f1f5f9;
  border-color: var(--muted);
}

[data-theme="light"] .icon-button {
  background: #fff;
  border-color: var(--border);
  color: var(--muted);
}

[data-theme="light"] .icon-button:hover {
  border-color: var(--accent);
  color: var(--text);
  background: #f8fafc;
}

[data-theme="light"] .icon-button.danger {
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #fff;
  border-color: rgba(220, 38, 38, 0.4);
}

[data-theme="light"] .icon-button.danger:hover {
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.25);
}

/* 亮色主题：GitHub 图标加深，提升在浅色背景上的可见度 */
[data-theme="light"] .github-icon-wrap img {
  filter: brightness(0.4);
}

[data-theme="light"] .icon-button[aria-busy="true"] {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

[data-theme="light"] .badge {
  background: #fff;
  border-color: var(--border);
}

[data-theme="light"] .badge-v {
  background: #fff;
  border-color: var(--border);
}

[data-theme="light"] .sticky-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .user-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .user-menu-item.danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

[data-theme="light"] .fund-chip {
  background: rgba(8, 145, 178, 0.12);
  border-color: rgba(8, 145, 178, 0.35);
}

[data-theme="light"] .remove-chip:hover {
  background: rgba(8, 145, 178, 0.18);
}

/* 亮色主题：搜索输入框与下拉 */
[data-theme="light"] .input {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

[data-theme="light"] .navbar-add-fund .input {
  background: rgba(255, 255, 255, 0.95);
  border: none;
}

[data-theme="light"] .navbar-input-field {
  color: var(--text);
}

[data-theme="light"] .search-dropdown {
  background: rgba(255, 255, 255, 0.98) !important;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .search-item:hover:not(.added) {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .search-item.selected {
  background: rgba(8, 145, 178, 0.12);
  border: 1px solid rgba(8, 145, 178, 0.3);
}

[data-theme="light"] .search-spinner {
  border-color: rgba(0, 0, 0, 0.1);
  border-top-color: var(--primary);
}

/* 亮色主题：filter-bar 区域 */
[data-theme="light"] .filter-bar {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .tab {
  color: var(--muted);
}

[data-theme="light"] .tab:hover {
  color: var(--primary);
  background: rgba(8, 145, 178, 0.1);
}

[data-theme="light"] .tab.active {
  background: rgba(8, 145, 178, 0.15);
  color: var(--primary);
}

[data-theme="light"] .tabs-nav-btn {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--border);
  color: var(--muted);
}

[data-theme="light"] .tabs-nav-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: #fff;
}

[data-theme="light"] .group-summary-sticky {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
}

[data-theme="light"] .group-selector-popup {
  background: rgba(255, 255, 255, 0.98) !important;
  border: 1px solid var(--border);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
}

@media (max-width: 640px) {
  [data-theme="light"] .filter-bar {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: var(--border);
  }

  [data-theme="light"] .group-summary-sticky {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: var(--border);
  }
}

/* 亮色主题：sort-group 区域（视图切换 + 排序芯片） */
[data-theme="light"] .view-toggle {
  background: rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .view-toggle .icon-button.active {
  color: #fff !important;
}

[data-theme="light"] .chip {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .chip:hover {
  border-color: var(--accent);
}

[data-theme="light"] .chip.active {
  background: linear-gradient(180deg, #0ea5e9, #0891b2);
  color: #fff;
  border-color: transparent;
}

/* 亮色主题：表格表头与行悬浮高亮 */
[data-theme="light"] .table-header-row {
  background: #e2e8f0;
  border-bottom-color: var(--border);
}

[data-theme="light"] .table-header-row-scroll {
  background: rgba(0, 0, 0, 0.04);
  border-bottom-color: var(--border);
}

[data-theme="light"] .table-header-cell-fixed {
  background: rgba(0, 0, 0, 0.04);
  border-bottom-color: var(--border);
}

[data-theme="light"] .table-row:hover {
  background: #e2e8f0;
}

[data-theme="light"] .table-row-scroll:hover,
[data-theme="light"] .table-row-scroll.row-hovered {
  background: #e2e8f0;
}

[data-theme="light"] .table-fixed-row.row-hovered {
  background: #e2e8f0;
}

/* 亮色主题：PcFundTable 专用 */
[data-theme="light"] .pc-fund-table .table-header-row-scroll {
  background: #cbd5e1;
}

[data-theme="light"] .pc-fund-table .table-header-row-scroll .table-header-cell {
  background: #cbd5e1 !important;
  color: #0f172a;
}

[data-theme="light"] .pc-fund-table .resizer:hover::after {
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.25);
}

[data-theme="light"] .pc-fund-table .table-row.empty-row {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border);
}

/* 亮色主题：前10重仓股票展开展示 */
[data-theme="light"] .list .item {
  background: #fff;
  border-color: var(--border);
}

[data-theme="light"] .list .item .name {
  color: var(--text);
}

[data-theme="light"] .list .item .weight {
  color: var(--accent);
}

/* 亮色主题：业绩走势下方筛选区域 */
[data-theme="light"] .trend-range-bar {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
}

[data-theme="light"] .trend-range-btn {
  color: var(--muted);
}

[data-theme="light"] .trend-range-btn:hover {
  color: var(--primary);
  background: rgba(8, 145, 178, 0.08);
}

[data-theme="light"] .trend-range-btn.active {
  background: rgba(8, 145, 178, 0.15);
  color: var(--primary);
}

/* 折线图区域：加载/空状态遮罩（暗色默认，亮色主题覆盖） */
.chart-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  z-index: 10;
}

[data-theme="light"] .chart-overlay {
  background: rgba(0, 0, 0, 0.03);
}

/* 主题切换时屏幕中心动画 */
.theme-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.theme-transition-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.5;
  transform-origin: center;
}

.card .title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.card .title span:first-child {
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.col-12 {
  grid-column: span 12;
}

.col-6 {
  grid-column: span 6;
}

.col-4 {
  grid-column: span 4;
}

.col-3 {
  grid-column: span 3;
}

@media (max-width: 1024px) {

  .col-6,
  .col-4,
  .col-3 {
    grid-column: span 12;
  }
}

.navbar {
  position: fixed;
  top: 0;
  left: 16px;
  right: 16px;
  z-index: 50;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  /* PC 端固定高度，避免聚焦搜索时展开动画导致导航栏高度跳动 */
  min-height: 68px;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  transition: flex 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand.search-focused-sibling {
  flex: 0 0 auto;
}

.navbar-add-fund {
  flex: 0 1 auto;
  width: 100%;
  min-width: 260px;
  max-width: 280px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  transition: max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar-add-fund.search-focused {
  max-width: 800px;
  min-width: 320px;
  flex: 1;
}

.navbar-add-fund .form {
  width: 100%;
}

.navbar-add-fund .search-input-wrapper {
  position: relative;
  flex: 1;
}

.navbar-add-fund .input {
  width: 100%;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.9);
}

.navbar-search-icon {
  position: absolute;
  left: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  pointer-events: none;
  z-index: 2;
}

.navbar-input-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 40px;
  padding-right: 12px;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  min-height: 44px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
  height: auto;
}

/* PC 端聚焦搜索时禁止换行，避免导航栏高度变化 */
@media (min-width: 641px) {
  .navbar-add-fund.search-focused .search-input-wrapper {
    flex-wrap: nowrap !important;
  }
  .navbar-add-fund.search-focused .navbar-input-shell {
    flex-wrap: nowrap !important;
    min-width: 0;
  }
}

/* Mobile Search Logic */
@media (max-width: 640px) {
  /* Default: Search hidden, Trigger visible */
  .navbar-add-fund {
    display: flex;
    width: 0 !important;
    min-width: 0 !important;
    flex: 0 0 0 !important;
    opacity: 0;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
  }

  .mobile-search-btn {
    display: inline-flex !important;
  }

  /* When search focused/active */
  .brand {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateX(0);
    width: auto;
    white-space: nowrap;
  }

  .brand.search-focused-sibling {
    width: 0 !important;
    opacity: 0;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    transform: translateX(-20px);
    pointer-events: none;
  }

  .actions {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateX(0);
    width: auto;
    white-space: nowrap;
  }

  .actions.search-focused-sibling {
    width: 0 !important;
    opacity: 0;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    transform: translateX(20px);
    pointer-events: none;
  }

  .navbar-add-fund.search-focused {
    display: flex !important;
    max-width: 100% !important;
    width: 100% !important;
    flex: 1 !important;
    margin-top: 0 !important;
    opacity: 1;
    pointer-events: auto;
    overflow: visible !important;
  }
}

/* Desktop: Trigger hidden */
.mobile-search-btn {
  display: none;
}

.navbar-input-field {
  flex: 1;
  min-width: 120px;
  height: 24px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  margin-left: 20px;
}

.navbar-input-field::placeholder {
  color: var(--muted);
}

.navbar-add-fund .button {
  display: none;
}

.content {
  /*padding-top: 100px;*/
}

@media (max-width: 640px) {
  .content {
    padding-top: 140px;
    overflow-x: clip;
  }

  .navbar {
    top: 0;
    left: 0;
    right: 0;
    padding-left: 12px;
    padding-right: 4px;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    flex-wrap: wrap;
    gap: 12px;
  }

  .navbar-add-fund {
    order: 3;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-top: 8px;
  }

  .navbar-add-fund .button {
    display: inline-flex;
  }
}

.form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.input {
  flex: 1;
  min-height: 44px;
  height: auto;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  outline: none;
  font-size: 14px;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

/* 美化并隐藏原生数字输入的上下按钮，使用自定义按钮 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

.button {
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #0ea5e9, #22d3ee);
  color: #05263b;
  font-weight: 600;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 200ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(34, 211, 238, 0.25);
}

.button:active {
  transform: translateY(0);
}

.card {
  padding: 16px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #0b1220;
  font-size: 12px;
}

.badge-v {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  font-size: 12px;
}

.badge-v span {
  font-size: 10px;
  color: var(--muted);
}

.badge-v strong {
  font-size: 11px;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

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

.stat .value {
  font-size: 20px;
  font-weight: 700;
}

.stat .badge {
  padding: 4px 8px;
  font-size: 12px;
}

@media (max-width: 640px) {
  .input {
    font-size: 16px;
    /* 防止 iOS 在输入时自动放大 */
  }

  .navbar-input-field {
    font-size: 16px;
    /* 防止 iOS 在输入时自动放大 */
  }

  .container {
    padding: 12px;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  .grid {
    gap: 12px;
  }

  .card {
    padding: 12px;
  }

  .stat {
    flex-direction: column;
    gap: 4px;
    min-width: 0;
  }

  .stat .label {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stat .value {
    font-size: 15px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .stat .badge {
    padding: 2px 6px;
    font-size: 13px;
    width: fit-content;
  }

  .card .title {
    flex-wrap: wrap;
  }

  .item .name {
    max-width: 100px;
    font-size: 14px;
  }

  .item .badge {
    padding: 2px 4px;
    font-size: 14px;
  }
}

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

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

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

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

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b1220;
}

.item .name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.modal .item .name {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  word-break: break-word;
}

.item .weight {
  font-weight: 600;
  color: var(--accent);
}

/* 业绩走势下方筛选区域（近1月/3月/6月/1年/3年） */
.trend-range-bar {
  display: flex;
  gap: 4px;
  margin-top: 12px;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 8px;
}

.trend-range-btn {
  flex: 1;
  padding: 6px 0;
  font-size: 11px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 400;
}

.trend-range-btn:hover {
  color: var(--primary);
}

.trend-range-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.error-text {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
}

.feedback-modal {
  max-width: 420px !important;
}

.link-button:hover {
  color: var(--accent) !important;
  opacity: 0.8;
}

.footer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding-bottom: 60px;
}

.actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
  transition: flex 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.actions.search-focused-sibling {
  flex: 0 0 auto;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--muted);
  cursor: pointer;
  transition: box-shadow 200ms ease, border-color 200ms ease, transform 150ms ease, color 200ms ease;
}

.icon-button:hover {
  color: var(--text);
  transform: translateY(-1px);
  border-color: var(--accent);
}

/* 不需要 hover 高亮的图标按钮（例如 PC 表格模式中的“编辑持仓”） */
.icon-button.no-hover:hover {
  color: inherit;
  transform: none;
  border-color: var(--border);
}

.icon-button:active {
  transform: translateY(0);
}

.sticky-toggle-btn {
  display: inline-flex !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sticky-toggle-btn:hover {
  opacity: 1 !important;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.icon-button.danger {
  background: linear-gradient(180deg, #ef4444, #f87171);
  color: #2b0b0b;
}

.icon-button.danger:hover {
  box-shadow: 0 10px 20px rgba(248, 113, 113, 0.25);
}

.fav-button {
  padding: 4px;
  margin-right: 4px;
  color: var(--muted);
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  width: auto;
  height: auto;
}

.fav-button:hover {
  color: var(--accent);
}

.fav-button.active {
  color: var(--accent);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px 0;
  background: transparent;
  border-radius: 0;
  width: fit-content;
  backdrop-filter: none;
}

.card.list-mode {
  padding: 12px 16px;
  position: relative;
}

.table-container {
  padding: 0;
  overflow: hidden;
  grid-column: span 12;
}

/* PC 列表：左右分块，左侧可横向滚动，右侧操作列固定不参与滚动 */
.table-pc-wrap {
  display: flex;
  flex-direction: row;
  width: 100%;
  min-width: 0;
}

.table-scroll-area {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  /* 横向滚动条样式与项目整体规范一致：深色背景、边框色、圆角、hover 高亮 */
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}

.table-scroll-area::-webkit-scrollbar {
  height: 8px;
}

.table-scroll-area::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 8px;
}

.table-scroll-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

.table-scroll-area::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.table-scroll-area::-webkit-scrollbar-thumb:active {
  background: var(--primary);
}

/* PC 表头固定时的 portal 容器：与 table-scroll-area 横向滚动同步，但隐藏自身滚动条 */
.pc-fund-table-portal-header {
  scrollbar-width: none;         /* Firefox */
  -ms-overflow-style: none;      /* IE / Edge legacy */
}

.pc-fund-table-portal-header::-webkit-scrollbar {
  display: none;                 /* Chrome / Safari */
}

/* 纵向滚动条通用样式（与项目整体规范一致，供弹窗、列表等使用） */
.scrollbar-y-styled {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}

.scrollbar-y-styled::-webkit-scrollbar {
  width: 8px;
}

.scrollbar-y-styled::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 8px;
}

.scrollbar-y-styled::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

.scrollbar-y-styled::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.scrollbar-y-styled::-webkit-scrollbar-thumb:active {
  background: var(--primary);
}

/* 固定像素列宽，避免初始在视口外的列滚入后布局错误、内容不展示；不依赖 fr/内容测量 */
.table-scroll-area-inner {
  /*width: 1192px;*/
  min-width: 900px;
}

/* 基金名称 净值 涨跌幅 估值涨幅 估值时间 持仓金额 当日收益 持有收益（三列同宽） */
.table-header-row-scroll,
.table-row-scroll {
  display: grid;
  grid-template-columns: 220px 100px 100px 100px 140px 140px 140px;
  align-items: center;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.table-header-row-scroll {
  padding: 16px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--border);
}

.table-header-row-scroll .table-header-cell {
  white-space: nowrap;
}

/* 表格行内容不换行，单行显示 */
.table-row-scroll .table-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* 当日收益、持有收益列：约束内容不溢出到相邻列，过长显示省略号 */
.table-row-scroll .profit-cell,
.table-row-scroll .holding-cell {
  min-width: 0;
}
.table-row-scroll .profit-cell > *,
.table-row-scroll .holding-cell > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-row-scroll .name-cell .name-text {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
}

.table-row-scroll .name-cell .name-cell-content {
  min-width: 0;
  width: 100%;
}

.table-row-scroll .name-cell .title-text {
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
}

.table-row-scroll .name-cell .name-text.show-full {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-all;
}

.table-row-scroll {
  padding: 12px 24px !important;
  min-height: 52px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
}

.table-row-scroll:hover,
.table-row-scroll.row-hovered {
  background: rgba(255, 255, 255, 0.08);
}

.table-fixed-row.row-hovered {
  background: rgba(255, 255, 255, 0.08);
}

.table-fixed-col {
  width: 60px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--border);
}

.table-header-cell-fixed {
  padding: 16px 12px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
}

.table-fixed-row {
  min-height: 59px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-bottom: none;
}

.table-fixed-row .table-cell {
  border: none;
}

.table-row-wrapper {
  width: 100%;
}

.table-row {
  display: grid;
  grid-template-columns: 2.2fr 0.8fr 1fr 1fr 1.2fr 1.2fr 1.2fr 0.5fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--border);
}

.table-row:hover {
  background: #2a394b;
}

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

.table-header-row {
  display: grid;
  grid-template-columns: 2.2fr 0.8fr 1fr 1fr 1.2fr 1.2fr 1.2fr 0.5fr;
  gap: 12px;
  padding: 16px 14px;
  background: #2a394b;
  border-bottom: 1px solid var(--border);
}

.table-header-cell {
  font-size: 13px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.table-cell {
  display: flex;
  align-items: center;
}

.text-right {
  text-align: right;
  justify-content: flex-end;
}

.text-center {
  text-align: center;
  justify-content: center;
}

.name-cell {
  gap: 8px;
}

.title-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.name-text {
  font-size: 14px;
  font-weight: 600;
  white-space: normal;
  word-break: break-all;
  line-height: 1.4;
}

.updated-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  font-size: 10px;
  margin-left: 6px;
  vertical-align: middle;
  transform: translateY(-1px);
}

.dca-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.15);
  color: #22d3ee;
  font-size: 10px;
  font-weight: 500;
  margin-left: 6px;
  vertical-align: middle;
  transform: translateY(-1px);
}

[data-theme="light"] .dca-indicator {
  background: rgba(6, 182, 212, 0.15);
  color: #0891b2;
}

.code-text {
  font-size: 11px;
}

@media (max-width: 768px) {
  .table-header-row {
    display: none;
  }

  /* 移动端基金表格：横向滚动容器，基金名称与操作列固定 */
  .mobile-fund-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-fund-table-scroll {
    /* min-width 由 MobileFundTable 根据 columns meta.width 动态设置 */
  }

  .mobile-fund-table-portal-header {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    left: 13px;
    right: 13px;
    box-sizing: border-box;
  }
  .mobile-fund-table-portal-header::-webkit-scrollbar {
    display: none;
  }
  .mobile-fund-table-portal-header .mobile-fund-table-scroll {
    padding: 0;
  }

  .mobile-fund-table .table-header-row {
    display: grid;
    /* grid-template-columns 由 MobileFundTable 根据当前列顺序动态设置 */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
  }

  .mobile-fund-table .table-header-row .table-header-cell {
    padding-top: 8px;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
  }

  .mobile-fund-table .table-row {
    grid-template-areas: unset;
    gap: 12px;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    /* 长按拖拽时禁止触发文字选择 */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  .mobile-fund-table .table-header-row {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }
  [data-theme="light"] .mobile-fund-table .table-row,
  [data-theme="light"] .mobile-fund-table .table-header-row {
    border-bottom-color: rgba(0, 0, 0, 0.06);
  }

  .mobile-fund-table .table-row .table-cell {
    padding-top: 12px;
    padding-bottom: 12px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 基金名称列固定左侧：右侧阴影突出固定列，覆盖行 border-bottom */
  .mobile-fund-table .table-header-cell-pin-left,
  .mobile-fund-table .table-cell-pin-left {
    position: sticky;
    left: 0;
    z-index: 2;
    border-bottom: none;
  }

  .mobile-fund-table .is-scrolled,
  .mobile-fund-table .is-scrolled {
    box-shadow: 4px 0 10px -2px rgba(0, 0, 0, 0.12);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
  }

  [data-theme="light"] .mobile-fund-table .is-scrolled,
  [data-theme="light"] .mobile-fund-table .is-scrolled {
    box-shadow: 4px 0 10px -2px rgba(0, 0, 0, 0.08);
    border-right-color: rgba(0, 0, 0, 0.06);
  }

  .mobile-fund-table .table-header-cell-pin-left {
    background: var(--table-pinned-header-bg);
  }

  .mobile-fund-table .table-cell-pin-left {
    background: var(--bg);
  }

  /* 移动端表格取消行悬停高亮 */
  .mobile-fund-table .table-row:hover {
    background: var(--bg);
  }

  .mobile-fund-table .table-row:hover .table-cell-pin-left {
    background: var(--bg);
  }

  /* 固定列右侧：同上，保证竖向分隔连续 */
  .mobile-fund-table .table-header-cell-pin-right,
  .mobile-fund-table .table-cell-pin-right {
    position: sticky;
    right: 0;
    z-index: 2;
    box-shadow: -4px 0 24px -4px rgba(0, 0, 0, 0.12);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
  }

  [data-theme="light"] .mobile-fund-table .table-header-cell-pin-right,
  [data-theme="light"] .mobile-fund-table .table-cell-pin-right {
    border-left-color: rgba(0, 0, 0, 0.06);
  }

  .mobile-fund-table .table-header-cell-pin-right {
    background: var(--table-pinned-header-bg);
  }

  .mobile-fund-table .table-cell-pin-right {
    background: var(--bg);
  }

  .mobile-fund-table .table-row:hover .table-cell-pin-right {
    background: var(--bg);
  }

  .mobile-fund-table .name-cell {
    grid-area: unset;
    align-self: stretch;
    padding-left: 12px;
  }

  .mobile-fund-table .table-header-row .table-header-cell-pin-left {
    padding-left: 12px;
  }

  /* 基金名称表头排序按钮在排序模式下的高亮 */
  .mobile-fund-table .mobile-fund-table-header .icon-button.active {
    color: var(--primary);
  }

  .mobile-fund-table .table-row .name-cell .name-cell-content {
    min-height: 100%;
  }

  /* 移动端表格表体基金名称字体缩小 */
  .mobile-fund-table .table-row .name-cell .name-text {
    font-size: 12px;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-fund-table .table-row .name-cell .name-text.show-full {
    -webkit-line-clamp: unset;
    overflow: visible;
    text-overflow: clip;
  }

  .mobile-fund-table .table-row .name-cell .code-text {
    font-size: 10px;
  }

  .mobile-fund-table .value-cell {
    grid-area: unset;
  }

  .mobile-fund-table .change-cell {
    grid-area: unset;
  }

  .mobile-fund-table .est-change-cell,
  .mobile-fund-table .profit-cell,
  .mobile-fund-table .time-cell {
    grid-area: unset;
    justify-content: flex-end;
  }

  .table-row {
    grid-template-columns: 1fr 80px 100px;
    grid-template-areas:
      "name value change"
      "name time profit";
    gap: 4px 12px;
    padding: 12px !important;
  }

  .name-cell {
    grid-area: name;
  }

  .value-cell {
    grid-area: value;
  }

  .change-cell {
    grid-area: change;
  }

  .profit-cell {
    grid-area: profit;
  }

  .time-cell {
    grid-area: time;
    justify-content: flex-end;
  }

  .action-cell {
    display: none;
  }

  .holding-cell {
    display: none;
  }

  .holding-amount-cell {
    display: none;
  }

  /* 移动端表格内保留持仓、收益、操作列显示 */
  .mobile-fund-table .holding-amount-cell,
  .mobile-fund-table .holding-cell,
  .mobile-fund-table .action-cell {
    display: flex;
  }

  /* 操作列删除按钮在移动端表格内需显示（避免被 .action-cell .danger 隐藏） */
  .mobile-fund-table .action-cell .icon-button.danger {
    display: inline-flex;
  }

  .table-cell.time-cell span {
    font-size: 10px !important;
  }
}

.stat-compact .up {
  color: var(--danger);
}

@media (max-width: 768px) {
  /* 非 mobile-fund-table 下的操作列删除按钮隐藏（如旧列表布局）；mobile-fund-table 内由上面覆盖为显示 */
  .action-cell .danger {
    display: none;
  }

  .mobile-fund-table .action-cell .danger {
    display: inline-flex;
  }
}

.swipe-action-bg {
  position: absolute;
  top: 1px;
  /* 留出一点缝隙，或者与 border 对齐 */
  bottom: 1px;
  right: 0;
  width: 80px;
  background: linear-gradient(180deg, #ef4444, #f87171);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #2b0b0b;
  z-index: 0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 10px 0 20px -10px rgba(0,0,0,0.2); /* 增加一点内阴影，增加层次感 */
}

.stat-compact .down {
  color: var(--success);
}

.filter-bar {
  transition: all 0.3s ease;
  position: sticky;
  z-index: 40;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.group-summary-sticky {
  position: sticky;
  z-index: 35;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  border-radius: 12px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .filter-bar {
    position: sticky;
    top: 60px; /* Navbar height */
    z-index: 40;
    width: calc(100% + 32px);
    background: rgba(15, 23, 42, 0.9);
    margin: 0 -16px 16px -16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    align-items: center !important;
  }

  .tabs {
    width: 100%;
    justify-content: flex-start;
    /* 移动端改为左对齐 */
    background: transparent;
    border-radius: 0;
    backdrop-filter: none;
    padding: 0;
  }

  .group-summary-sticky {
    top: 175px;
    width: calc(100% + 32px);
    margin: 0 -16px 16px -16px;
    padding: 8px 16px;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
  }

  .group-summary-sticky .group-summary-card {
    margin-bottom: 0;
  }
}

/* 禁止移动端输入框自动缩放 */
@media (max-width: 640px) {
  .input.no-zoom {
    font-size: 16px !important;
  }
}

.tab {
  padding: 0 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 32px;
  line-height: 32px;
  display: inline-flex;
  align-items: center;
}

.tab:hover {
  color: var(--primary);
  background: rgba(34, 211, 238, 0.08);
}

.tab.active {
  background: rgba(34, 211, 238, 0.15);
  color: var(--primary);
  box-shadow: none;
}

@media (hover: none) {
  .tab:hover {
    color: var(--muted);
    background: transparent;
  }
  .tab.active,
  .tab.active:hover {
    background: rgba(34, 211, 238, 0.15);
    color: var(--primary);
    box-shadow: none;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  transition: background 0.2s ease, backdrop-filter 0.2s ease;
}

.modal-overlay-translucent {
  background: rgba(2, 6, 23, 0.15);
  backdrop-filter: blur(1px);
}

.modal {
  width: 560px;
  max-width: 92vw;
  padding: 16px;
}

/* PC 表格设置侧弹框 */
.pc-table-setting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}

.pc-table-setting-drawer {
  width: 360px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  border-radius: 16px 0 0 16px;
  border: 1px solid var(--border);
  border-right: none;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}

.pc-table-setting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
}

.pc-table-setting-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.pc-table-setting-subtitle {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.pc-table-setting-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.pc-table-setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  cursor: grab;
}

.pc-table-setting-item:active {
  cursor: grabbing;
}

.pc-table-setting-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary);
}

.pc-table-column-switch .dca-toggle-track {
  flex-shrink: 0;
}

[data-theme="light"] .pc-table-setting-drawer .dca-toggle-thumb {
  background: #fff;
}

/* 移动端表格设置底部抽屉 */
.mobile-setting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* shadcn Drawer：符合项目规范，适配亮/暗主题 */
.drawer-shadow-bottom {
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
}
.drawer-shadow-top {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .drawer-shadow-bottom {
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.12);
}
[data-theme="light"] .drawer-shadow-top {
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
}

/* Drawer 内容玻璃拟态：与 Dialog 统一的毛玻璃效果（更通透） */
.drawer-content-theme {
  background: rgba(15, 23, 42, 0);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(148, 163, 184, 0.45);
}

[data-theme="light"] .drawer-content-theme {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(148, 163, 184, 0.6);
}

/* shadcn Dialog：符合项目规范(ui-ux-pro-max)，适配亮/暗主题，略微玻璃拟态 */
[data-slot="dialog-content"] {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

[data-theme="light"] [data-slot="dialog-content"] {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dialog-content-shadow {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .dialog-content-shadow {
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

[data-slot="dialog-content"] [data-slot="dialog-close"] {
  cursor: pointer;
  color: var(--muted-foreground);
  transition: color 0.2s ease, opacity 0.2s ease;
}

[data-slot="dialog-content"] [data-slot="dialog-close"]:hover {
  color: var(--foreground);
  opacity: 1;
}

[data-slot="dialog-content"] [data-slot="dialog-close"]:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

[data-slot="dialog-title"] {
  color: var(--foreground);
}

[data-slot="dialog-description"] {
  color: var(--muted-foreground);
}

.mobile-setting-drawer {
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
}

.mobile-setting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
}

.mobile-setting-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

.mobile-setting-subtitle {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.mobile-setting-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.mobile-setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  cursor: grab;
}

.mobile-setting-item:active {
  cursor: grabbing;
}

.mobile-setting-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary);
}

[data-theme="light"] .mobile-setting-drawer .dca-toggle-thumb {
  background: #fff;
}

/* 定投按钮：暗色主题 */
.dca-btn {
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.85);
  color: #fff;
}

.dca-btn:hover {
  background: rgba(34, 211, 238, 0.2);
  border-color: rgba(255, 255, 255, 0.95);
}

/* 亮色主题：定投按钮（使用 accent 蓝区分加仓的 primary 青） */
[data-theme="light"] .dca-btn {
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid var(--accent);
  color: var(--accent);
}

[data-theme="light"] .dca-btn:hover {
  background: rgba(37, 99, 235, 0.16);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

/* TradeModal 基础样式 */
.trade-pending-alert {
  margin-bottom: 16px;
  background: rgba(230, 162, 60, 0.1);
  border: 1px solid rgba(230, 162, 60, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #e6a23c;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.trade-pending-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(6px);
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.trade-pending-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.trade-confirm-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.trade-confirm-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.trade-preview-card {
  padding: 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.trade-back-btn,
.trade-cancel-btn,
.trade-revoke-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text) !important;
}

[data-theme="light"] .trade-modal .queue-button {
  color: #ffffff !important;
}

.trade-time-slot {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 4px;
}

.trade-time-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  padding: 6px 8px;
}

.trade-time-btn.active {
  background: var(--primary);
  color: #05263b;
}

.trade-amount-btn {
  flex: 1;
  padding: 4px 8px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
}

/* 亮色主题：TradeModal */
[data-theme="light"] .trade-modal .trade-pending-alert {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.35);
  color: #b45309;
}

/* 亮色主题：TradeModal */
[data-theme="light"] .trade-pending-alert {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.35);
  color: #b45309;
}

[data-theme="light"] .trade-modal .trade-pending-header {
  background: rgba(255, 255, 255, 0.98);
  border-bottom-color: var(--border);
}

[data-theme="light"] .trade-modal .trade-pending-item {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .trade-modal .trade-confirm-card {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .trade-modal .trade-confirm-divider {
  border-top-color: var(--border);
}

[data-theme="light"] .trade-modal .trade-preview-card {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .trade-modal .trade-back-btn,
[data-theme="light"] .trade-modal .trade-cancel-btn,
[data-theme="light"] .trade-modal .trade-revoke-btn {
  background: rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .trade-modal .trade-time-slot {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .trade-modal .trade-time-btn.active {
  color: #fff;
}

[data-theme="light"] .trade-modal .trade-amount-btn {
  background: rgba(0, 0, 0, 0.06);
}

.trade-pending-status {
  color: #e6a23c;
}

[data-theme="light"] .trade-modal .trade-pending-status {
  color: #b45309;
}

/* DatePicker 基础样式 */
.date-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 40px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.date-picker-dropdown {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.date-picker-cell {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  font-weight: 400;
}

.date-picker-cell.selected {
  background: var(--primary);
  color: #000;
  font-weight: 600;
}

.date-picker-cell.today {
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.date-picker-cell.future {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.3;
}

.date-picker-cell:not(.selected):not(.future):hover {
  background: rgba(255, 255, 255, 0.1);
}

.date-picker-cell.today:not(.selected):not(.future):hover {
  background: rgba(255, 255, 255, 0.1);
}

/* 亮色主题：DatePicker */
[data-theme="light"] .date-picker-trigger {
  background: rgba(0, 0, 0, 0.06);
  border-color: var(--border);
}

[data-theme="light"] .date-picker-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border-color: var(--border);
}

[data-theme="light"] .date-picker-cell.selected {
  color: #fff;
}

[data-theme="light"] .date-picker-cell.today {
  background: rgba(8, 145, 178, 0.15);
}

[data-theme="light"] .date-picker-cell:not(.selected):not(.future):hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .date-picker-cell.today:not(.selected):not(.future):hover {
  background: rgba(8, 145, 178, 0.2);
}

/* DcaModal 基础样式 */
.dca-toggle-track {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.6);
  position: relative;
  transition: background 0.2s;
}

.dca-toggle-track.enabled {
  background: var(--primary);
}

.dca-toggle-thumb {
  position: absolute;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0f172a;
  transition: left 0.2s;
}

.dca-option-group {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 4px;
}

.dca-option-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 6px;
  white-space: nowrap;
}

.dca-option-btn.active {
  background: var(--primary);
  color: #05263b;
}

.dca-weekday-btn {
  font-size: 12px;
  padding: 6px 4px;
}

.dca-monthly-day-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 4px;
  max-height: 140px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.dca-monthly-btn {
  flex: 0 0 calc(25% - 4px);
  padding: 4px 0;
}

.dca-first-date-display {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 14px;
  background: rgba(15, 23, 42, 0.6);
}

.dca-cancel-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text) !important;
}

/* 亮色主题：DcaModal */
[data-theme="light"] .dca-modal .dca-toggle-thumb {
  background: #fff;
}

[data-theme="light"] .dca-modal .dca-option-group {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .dca-modal .dca-option-btn.active {
  color: #fff;
}

[data-theme="light"] .dca-modal .dca-monthly-day-group {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .dca-modal .dca-first-date-display {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .dca-modal .dca-cancel-btn {
  background: rgba(0, 0, 0, 0.06) !important;
}

/* ScanPickModal 拖拽区域 */
.scan-pick-dropzone {
  border: 2px dashed var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.scan-pick-dropzone.dragging {
  border-color: var(--primary);
  background: rgba(34, 211, 238, 0.08);
}

/* 亮色主题：ScanPickModal 拖拽区域边框更明显 */
[data-theme="light"] .scan-pick-modal .scan-pick-dropzone {
  border-color: rgba(0, 0, 0, 0.25);
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .scan-pick-modal .scan-pick-dropzone.dragging {
  border-color: var(--primary);
  background: rgba(8, 145, 178, 0.12);
}

/* TransactionHistoryModal 基础样式 */
.tx-history-pending-item {
  background: rgba(230, 162, 60, 0.1);
  border: 1px solid rgba(230, 162, 60, 0.2);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.tx-history-dca-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.tx-history-pending-status {
  color: #e6a23c;
}

.tx-history-action-btn {
  background: rgba(255, 255, 255, 0.1) !important;
  color: var(--text) !important;
}

.tx-history-record-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

/* 亮色主题：TransactionHistoryModal */
[data-theme="light"] .tx-history-modal .tx-history-pending-item {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.35);
}

[data-theme="light"] .tx-history-modal .tx-history-dca-badge {
  background: rgba(5, 150, 105, 0.15);
  color: #059669;
}

[data-theme="light"] .tx-history-modal .tx-history-pending-status {
  color: #b45309;
}

[data-theme="light"] .tx-history-modal .tx-history-action-btn {
  background: rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .tx-history-modal .tx-history-record-item {
  background: rgba(0, 0, 0, 0.04);
}

.pending-list {
  scrollbar-width: none;
}

.pending-list::-webkit-scrollbar {
  display: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  cursor: pointer;
  transition: border-color 200ms ease, transform 150ms ease;
}
.chip:hover { transform: translateY(-1px); border-color: var(--accent); }
.chip.active { background: linear-gradient(180deg, #0ea5e9, #22d3ee); color: #05263b; border-color: transparent; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin {
  animation: spin 0.8s linear infinite;
}
.icon-button[aria-busy="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(96,165,250,0.15);
  cursor: default;
}

/* 刷新按钮外圈进度条 */
.refresh-btn-wrap {
  --progress: 0;
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.refresh-btn-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 1.5px;
  background: conic-gradient(
    var(--primary) 0deg,
    var(--primary) calc(var(--progress) * 360deg),
    var(--border) calc(var(--progress) * 360deg)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.refresh-btn-wrap .icon-button {
  position: relative;
  z-index: 1;
}
@media (prefers-reduced-motion: reduce) {
  .spin {
    animation: none;
  }
}

.loading-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  width: 100%;
  animation: loading 1.5s infinite;
  z-index: 100;
  border-radius: 16px 16px 0 0;
}

@keyframes loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* 搜索相关样式 */
.search-container {
  position: relative;
  width: 100%;
  z-index: 45;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.search-spinner {
  position: absolute;
  right: 12px;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  z-index: 46;
  padding: 8px;
  background: rgba(15, 23, 42, 0.95) !important;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-item:hover:not(.added) {
  background: rgba(255, 255, 255, 0.08);
}

.search-item.selected {
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.search-item.added {
  cursor: not-allowed;
  opacity: 0.6;
}

.fund-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fund-name {
  font-size: 14px;
  font-weight: 600;
}

.fund-code {
  font-size: 11px;
}

.checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.search-item.selected .checkbox {
  background: var(--primary);
  border-color: var(--primary);
}

.checked-mark {
  width: 10px;
  height: 6px;
  border-left: 2px solid #05263b;
  border-bottom: 2px solid #05263b;
  transform: rotate(-45deg) translateY(-1px);
}

/* 亮色主题：checkbox 边框更明显，选中时勾为白色 */
[data-theme="light"] .checkbox {
  border-color: rgba(0, 0, 0, 0.28);
}

[data-theme="light"] .search-item.selected .checkbox .checked-mark,
[data-theme="light"] .group-manage-item.selected .checkbox .checked-mark {
  border-left-color: #fff;
  border-bottom-color: #fff;
}

.added-label {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--muted);
}

.ocr-warning {
  padding: 8px 12px;
  background: rgba(251, 191, 36, 0.15);
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.ocr-warning span {
  font-size: 13px;
  color: #fbbf24;
  line-height: 1.5;
}

[data-theme="light"] .ocr-warning {
  background: rgba(180, 130, 30, 0.1);
  border-color: rgba(180, 130, 30, 0.25);
}

[data-theme="light"] .ocr-warning span {
  color: #b4821e;
}

.no-results {
  padding: 20px;
  text-align: center;
  font-size: 14px;
}

.selected-funds-bar {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selected-inline-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: 24px;
}

.fund-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 8px;
  font-size: 12px;
  color: var(--primary);
}

.remove-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
}

.remove-chip:hover {
  background: rgba(34, 211, 238, 0.2);
}

.batch-add-button {
  width: 100%;
}

/* 提升添加基金区域的层级，避免父级 stacking context 影响 */
.add-fund-section {
  position: relative;
  z-index: 41;
}

.group-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.group-item.selected {
  background: rgba(34, 211, 238, 0.1);
  color: var(--primary);
}

.tabs-container {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  max-width: 100%;
  flex: 1;
  min-width: 0;
}

.tabs-scroll-area {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  /* 动态遮罩，通过 data-mask-* 属性控制 */
  mask-image: none;
  -webkit-mask-image: none;
}

.tabs-scroll-area[data-mask-left="true"][data-mask-right="true"] {
  mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
}

.tabs-scroll-area[data-mask-left="true"][data-mask-right="false"] {
  mask-image: linear-gradient(to right, transparent, black 40px, black);
  -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black);
}

.tabs-scroll-area[data-mask-left="false"][data-mask-right="true"] {
  mask-image: linear-gradient(to right, black, black calc(100% - 40px), transparent);
  -webkit-mask-image: linear-gradient(to right, black, black calc(100% - 40px), transparent);
}

.tabs {
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  gap: 4px;
  padding: 4px 0; /* 移除左右内边距，由 mask 和 scroll 行为控制 */
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
  cursor: grab;
  user-select: none;
}

.tabs::after {
  content: "";
  flex: 0 0 16px; /* 末尾留一点空隙，避免贴边 */
}

.tabs:active {
  cursor: grabbing;
}

.tabs::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* 管理分组弹窗列表 */
.group-manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.group-manage-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  /* 移除全局 transition，避免与 Framer Motion 冲突 */
}

.group-manage-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary);
}

.group-manage-item.selected {
  background: rgba(34, 211, 238, 0.1);
  border-color: var(--primary);
}

.group-manage-item.selected .checkbox {
  background: var(--primary);
  border-color: var(--primary);
}

.group-rename-input {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  font-weight: 500;
}

.group-rename-input:focus {
  background: rgba(255, 255, 255, 0.05) !important;
}

.drag-handle:active {
  cursor: grabbing;
}

.add-group-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.add-group-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.add-group-row-btn:hover {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  background: rgba(255,255,255,0.05) !important;
}

.tabs-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.tabs-nav-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.tabs-nav-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.tabs-fixed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.group-selector-popup {
  background: rgba(15, 23, 42, 0.95) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .tabs-container {
    width: 100%;
    margin-bottom: 8px;
  }

  .tabs {
    max-width: none !important;
  }
}

/* ========== 用户菜单样式 ========== */
.user-menu-container {
  position: relative;
}

.user-menu-trigger {
  position: relative;
}

.user-menu-trigger.logged-in {
  /*border-color: var(--primary);*/
  /*background: rgba(34, 211, 238, 0.1);*/
}

.user-avatar-small {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #05263b;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-menu-dropdown {
  position: fixed;
  right: 0;
  min-width: 200px;
  padding: 8px;
  z-index: 100;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
}

.user-avatar-large {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #05263b;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-email {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-status {
  font-size: 11px;
  color: var(--success);
}

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.user-menu-item.danger {
  color: var(--danger);
}

.user-menu-item.danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

/* ========== 登录模态框样式 ========== */
.login-modal {
  max-width: 400px !important;
}

.login-message {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-message.error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

.login-message.success {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--success);
}

.button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.button.secondary:hover {
  border-color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.button.danger {
  background: linear-gradient(180deg, #ef4444, #f87171);
  color: #2b0b0b;
  border-color: rgba(248, 113, 113, 0.4);
}

.button.danger:hover {
  box-shadow: 0 10px 20px rgba(248, 113, 113, 0.25);
}

[data-theme="light"] .button.danger {
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #fff;
  border-color: rgba(220, 38, 38, 0.4);
}

[data-theme="light"] .button.danger:hover {
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.25);
}

/* ========== 移动端响应式 ========== */
@media (max-width: 640px) {

  .user-menu-header {
    padding: 16px 8px;
  }

  .user-menu-item {
    padding: 14px 12px;
    font-size: 15px;
  }

  .login-modal {
    max-width: 100% !important;
    margin: 16px;
  }
}

/* ========== 下拉选择框样式 ========== */
.select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.9);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.select:hover {
  border-color: var(--accent);
}

.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.select option {
  background: var(--card);
  color: var(--text);
  padding: 8px;
}

.select option:hover,
.select option:checked {
  background: rgba(34, 211, 238, 0.15);
  color: var(--primary);
}

/* 亮色主题：下拉选择框 */
[data-theme="light"] .select {
  background-color: rgba(255, 255, 255, 0.95);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  border-color: var(--border);
}

[data-theme="light"] .select:hover {
  border-color: var(--accent);
  background: linear-gradient(180deg, #fff, #f8fafc);
}

[data-theme="light"] .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

[data-theme="light"] .select option {
  background: #fff;
  color: var(--text);
}

[data-theme="light"] .select option {
  background: #fff;
  color: var(--text);
}

[data-theme="light"] .select option:hover,
[data-theme="light"] .select option:checked {
  background: rgba(8, 145, 178, 0.12);
  color: var(--primary);
}

@theme inline {
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);
  --radius-3xl: calc(var(--radius) + 12px);
  --radius-4xl: calc(var(--radius) + 16px);
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);
}

.dark {
  --background: #020617;
  --foreground: #f8fafc;
  --card: #0f172a;
  --card-foreground: #f8fafc;
  --popover: #0f172a;
  --popover-foreground: #f8fafc;
  --primary: #22d3ee;
  --primary-foreground: #0f172a;
  --secondary: #1e293b;
  --secondary-foreground: #f8fafc;
  --muted: #1e293b;
  --muted-foreground: #94a3af;
  --accent: #60a5fa;
  --accent-foreground: #f8fafc;
  --destructive: #f87171;
  --border: #1f2937;
  --input: #0b1220;
  --ring: #22d3ee;
  --chart-1: #22d3ee;
  --chart-2: #60a5fa;
  --chart-3: #34d399;
  --chart-4: #f472b6;
  --chart-5: #fbbf24;
  --sidebar: #0f172a;
  --sidebar-foreground: #f8fafc;
  --sidebar-primary: #22d3ee;
  --sidebar-primary-foreground: #0f172a;
  --sidebar-accent: #1e293b;
  --sidebar-accent-foreground: #f8fafc;
  --sidebar-border: #1f2937;
  --sidebar-ring: #22d3ee;
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
}
