:root {
  --bg: #f8fafc;
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(148, 163, 184, 0.22);
  --primary: #3b82f6;
  --primary-d: #2563eb;
  --primary-light: #eff6ff;
  --profit: #dc2626;
  --loss: #16a34a;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  font-size: 14px;
}

body {
  position: relative;
  background: linear-gradient(120deg, #e0f2fe 0%, #f0f9ff 30%, #fdf4ff 60%, #fff7ed 100%);
  background-size: 200% 200%;
  animation: gradientMove 18s ease infinite;
}

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

.bg-mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: float 12s ease-in-out infinite;
}

.orb-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #bfdbfe 0%, transparent 70%);
  top: -120px; right: -120px;
  animation-delay: 0s;
}

.orb-2 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #e9d5ff 0%, transparent 70%);
  bottom: 10%; left: -80px;
  animation-delay: -4s;
}

.orb-3 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #bbf7d0 0%, transparent 70%);
  bottom: -60px; right: 20%;
  animation-delay: -8s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

/* header */
.app-header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px;
  gap: 12px;
  position: relative;
  z-index: 5;
}
.topbar-menu-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
}
.topbar-menu-toggle .chevron { font-size: 10px; color: var(--muted); }

.brand { display: flex; align-items: center; gap: 14px; }

.logo-ring {
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.28);
}

.logo { font-size: 26px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }

.brand h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.brand .sub { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); font-weight: 500; }

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

.status-dot { color: #22c55e; font-size: 18px; margin-right: 4px; }
.status-dot.off { color: #ef4444; }
.badge { display:inline-flex; align-items:center; padding:4px 10px; border-radius:999px; background:rgba(59,130,246,.12); color:var(--primary-d); font-size:12px; font-weight:700; }
.badge.ok { background: rgba(22,163,74,.14); color: #15803d; }
.badge.warn { background: rgba(245,158,11,.16); color: #b45309; }
.badge.err { background: rgba(220,38,38,.14); color: #b91c1c; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; background: rgba(15,23,42,.42); backdrop-filter: blur(4px); padding: 20px; }
.modal-box { width: min(520px, 100%); max-height: 88vh; overflow-y: auto; background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 24px 70px rgba(15,23,42,.3); animation: popIn .25s ease; }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.modal-box .steps { margin: 10px 0 16px; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.modal-box .steps a { color: var(--primary-d); font-weight: 700; }
.modal-box label.full { grid-column: 1 / -1; margin-bottom: 12px; }

/* tabs */
.tabs {
  display: flex; gap: 8px;
  padding: 18px 26px 0;
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.tab {
  border: none; background: transparent; cursor: pointer;
  padding: 11px 20px; font-size: 14.5px; font-weight: 700;
  color: var(--muted); border-radius: 14px 14px 0 0;
  border-bottom: 3px solid transparent;
  display: flex; align-items: center; gap: 8px;
  transition: .2s;
}

.tab:hover { background: rgba(255,255,255,0.5); color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--card); }

.tab-icon { font-size: 16px; }

/* main */
main { padding: 20px 26px 80px; }

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .35s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: stretch; }
@media (max-width: 1020px) { .grid-2 { grid-template-columns: 1fr; } }

.chart-grid { grid-template-columns: 1.6fr 0.9fr; align-items: start; }
@media (max-width: 1100px) { .chart-grid { grid-template-columns: 1fr; } }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transition: transform .2s, box-shadow .2s;
}

/* 卡片顶部渐变装饰线：现代、克制，提升整体质感 */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #38bdf8);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  opacity: .9;
}

.card:hover { box-shadow: 0 14px 48px rgba(15, 23, 42, 0.1); }

.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title h2 { margin: 0; font-size: 16px; font-weight: 800; }

/* 可折叠卡片：所有屏幕（手机/平板/桌面）默认收起大表单，让买卖记录明细直接可见；表单标题始终置顶显眼，点标题或 ▾ 展开 */
.collapsible-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; user-select: none; }
.collapsible-head .card-title { margin-bottom: 0; }
.collapse-toggle {
  border: none; background: var(--primary-light); color: var(--primary-d);
  width: 44px; height: 44px; border-radius: 12px; font-size: 20px; line-height: 1;
  display: grid; place-items: center;
  cursor: pointer; transition: transform .2s, background .2s; flex: 0 0 auto;
}
.collapse-toggle:hover { background: #dbeafe; }
.collapsible.collapsed .collapse-toggle { transform: rotate(-90deg); }
.collapsible.collapsed .collapsible-body { display: none; }

.icon-pill {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--primary-light);
  font-size: 15px;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head .card-title { margin-bottom: 0; }

.pending { color: #b45309; background: #fef3c7; border-radius: 4px; padding: 1px 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.muted { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.hint { color: var(--muted); font-size: 12px; }
/* 表单内联提示（关联钱包等） */
.hint-label { display: flex; align-items: center; }
.hint-inline { color: var(--muted); font-size: 12px; line-height: 1.4; }
/* 记录表“钱包”列的关联标签 */
.wallet-tag { display: inline-block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #0369a1; background: #e0f2fe; border-radius: 4px; padding: 1px 7px; vertical-align: middle; }
/* 持仓统计：行情未回显时的占位（骨架先出，行情并行回填） */
.loading { color: var(--muted); font-size: 12px; opacity: .75; }
@keyframes sfw-pulse { 0%,100% { opacity: .4; } 50% { opacity: .85; } }
.loading { animation: sfw-pulse 1.1s ease-in-out infinite; }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.form.compact { gap: 12px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 700; }
label.full { grid-column: 1 / -1; }

input, select {
  font: inherit; padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.9);
  color: var(--text); font-weight: 600;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.03);
  transition: .15s;
}

input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }

.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.backend-box { margin-top: 14px; padding: 14px 16px; border: 1px dashed var(--border); border-radius: 14px; background: linear-gradient(135deg, rgba(59,130,246,.06), rgba(139,92,246,.06)); }
.backend-box .muted { margin-bottom: 10px; }
.backend-box code { background: rgba(15,23,42,.06); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.backend-box input[readonly] { background: #f8fafc; cursor: text; color: var(--text); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* buttons */
.btn {
  border: none; cursor: pointer; padding: 10px 18px; border-radius: 12px;
  font-weight: 700; font-size: 13.5px; transition: .15s;
}

.btn.primary { background: linear-gradient(135deg, var(--primary), #6366f1); color: #fff; box-shadow: 0 6px 18px rgba(59,130,246,.28); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(59,130,246,.36); }

.btn.ghost { background: rgba(241, 245, 249, 0.8); color: var(--text); }
.btn.ghost:hover { background: #e2e8f0; }

.btn.outline { background: rgba(255,255,255,0.8); border: 1px solid var(--primary); color: var(--primary); }
.btn.outline:hover { background: var(--primary-light); }

.btn-mini {
  background: var(--primary-light); color: var(--primary-d);
  border: none; border-radius: 10px; padding: 9px 12px;
  cursor: pointer; font-weight: 700; font-size: 12.5px;
  white-space: nowrap; transition: .15s;
}

.btn-mini:hover { background: #dbeafe; transform: translateY(-1px); }
.btn-mini.danger { background: #fef2f2; color: #dc2626; }
.btn-mini.danger:hover { background: #fee2e2; }
.btn-mini.ghost { background: rgba(255,255,255,0.6); color: var(--muted); }
.btn-mini.ghost:hover { background: rgba(255,255,255,0.9); color: var(--text); }

/* tables */
.table-wrap { overflow-x: auto; margin-top: 4px; position: relative; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }

th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }

th { background: rgba(248, 250, 252, 0.85); color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; position: sticky; top: 0; z-index: 1; }

th:first-child { border-radius: 10px 0 0 10px; }
th:last-child { border-radius: 0 10px 10px 0; }

/* 资产配置参考与计划表：固定列宽，防止电脑端标题与数据列错位 */
#classicCompareTable,
#allocPlanTable { table-layout: fixed; min-width: 640px; }
#classicCompareTable col:first-child,
#allocPlanTable col:first-child { width: 92px; }
#classicCompareTable col:not(:first-child):not(:last-child),
#allocPlanTable col:not(:first-child) { width: 90px; }
#classicCompareTable col:last-child { width: 88px; }
#classicCompareTable th, #classicCompareTable td,
#allocPlanTable th, #allocPlanTable td { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#classicCompareTable td:first-child,
#allocPlanTable td:first-child { text-align: left; }

tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(239, 246, 255, 0.55); }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800;
}

.tag.fund { background: #ede9fe; color: #6d28d9; }
.tag.stock { background: #e0f2fe; color: #0369a1; }
.tag.buy { background: #fee2e2; color: #b91c1c; }
.tag.sell { background: #dcfce7; color: #15803d; }
.tag.auto { background: #fef3c7; color: #b45309; }
.tag.manual { background: #f1f5f9; color: #475569; }

.num { font-variant-numeric: tabular-nums; text-align: right; }
.pos { color: var(--profit); font-weight: 800; }
.neg { color: var(--loss); font-weight: 800; }
.flat { color: var(--muted); }

/* filters */
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters input, .filters select { padding: 8px 12px; font-size: 13px; }
.auto { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; }
.auto input { width: auto; accent-color: var(--primary); }

/* plan list */
.plan-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

.plan-item {
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  transition: .15s;
}

.plan-item:hover { background: rgba(255,255,255,0.9); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.04); }

.plan-item .pi-main { font-weight: 800; }
.plan-item .pi-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.plan-item .pi-sub.pending { color: #b45309; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 4px 8px; margin-top: 6px; display: inline-block; }
.plan-item .pi-actions { display: flex; gap: 8px; align-items: center; }

/* 钱包列表：名称(左) | 余额(中间，左对齐) | 编辑/删除(右，左对齐) */
.wallet-item {
  background: rgba(255,255,255,0.62);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  align-items: center;
  gap: 14px;
  transition: .15s;
}
.wallet-item:hover { background: rgba(255,255,255,0.94); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(15,23,42,.06); }
/* 钱包拖拽排序手柄（桌面/手机通用，基于指针事件） */
.wallet-item .wi-handle { cursor: grab; color: var(--muted); font-size: 18px; line-height: 1; align-self: center; touch-action: none; user-select: none; }
.wallet-item .wi-handle:active { cursor: grabbing; }
.wallet-item.wallet-dragging { opacity: 0; }
.wallet-item.wallet-drag-clone { position: fixed; z-index: 9999; margin: 0; pointer-events: none; opacity: 1 !important; box-shadow: 0 12px 30px rgba(15,23,42,.18); }
.wallet-item .wi-name { font-weight: 800; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-item .wi-balance {
  text-align: left;
  font-weight: 800;
  font-size: 19px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wallet-item .wi-balance .cur { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 1px; }
.wallet-item .wi-actions { display: flex; gap: 8px; justify-content: flex-start; }
@media (max-width: 560px) {
  .wallet-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }
  .wallet-item .wi-handle { order: 1; }
  .wallet-item .wi-name {
    order: 2;
    flex: 1 1 0;
    font-size: 14px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.35;
  }
  .wallet-item .wi-actions { order: 3; }
  .wallet-item .wi-balance {
    order: 4;
    width: 100%;
    padding-left: 26px;
    font-size: 17px;
    text-align: left;
    margin-top: 2px;
  }
}

.switch { position: relative; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; cursor: pointer; }
.slider:before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(18px); }

/* summary cards */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 880px) { .summary { grid-template-columns: repeat(2, 1fr); } }

.sc {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.75));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(15,23,42,.05);
  display: flex; flex-direction: column; gap: 6px;
}

.sc .sc-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.sc .sc-sub { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 600; color: var(--muted); background: rgba(99,102,241,.1); border-radius: 6px; padding: 1px 6px; vertical-align: middle; }
.sc .sc-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.sc .sc-value.pos { color: var(--profit); }
.sc .sc-value.neg { color: var(--loss); }

/* chart */
.chart-card {
  background: rgba(255,255,255,0.6);
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

.chart-card h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.92);
  color: #fff; padding: 12px 22px;
  border-radius: 14px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s;
  z-index: 99; backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(185, 28, 28, 0.95); }

/* plan count + wallet summary */
.plan-count { font-size: 13px; font-weight: 700; color: var(--primary); margin: 4px 0 2px; }
.wallet-summary {
  padding: 14px 16px;
  background: rgba(255,255,255,0.6); border: 1px solid var(--border);
  border-radius: 14px; display: flex; flex-direction: column; gap: 8px;
}
.ws-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.ws-row small { color: var(--muted); font-weight: 400; }
.ws-row.total { border-top: 1px dashed var(--border); padding-top: 8px; margin-top: 2px; font-size: 17px; font-weight: 800; }
.ws-row.total span:last-child { color: var(--primary); }

/* 模块三布局：左侧钱包列表，右侧汇总 */
.wallet-layout { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 22px; margin-top: 18px; align-items: start; }
.sub-h { font-size: 15px; font-weight: 800; margin: 0 0 12px; color: var(--text); }
.alloc-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; margin-top: 12px; }
.alloc-legend .legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; max-width: 150px; }
.alloc-legend .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.alloc-legend .lg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alloc-legend .lg-pct { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.export-group { display: inline-flex; gap: 6px; }
@media (max-width: 860px) {
  .wallet-layout { grid-template-columns: 1fr; }
}

/* 记录筛选统计条 */
.filter-stat { margin: 12px 2px 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-stat b { color: var(--primary-d); font-size: 15px; font-variant-numeric: tabular-nums; }
.filter-stat .sep { color: var(--border); }
@media (max-width: 640px) {
  .filters { gap: 8px; }
  .filters select, .filters input { flex: 1 1 auto; min-width: 110px; }
}

/* ============ 模块四：资产配置分析 ============ */
.alloc-settings { background: rgba(59,130,246,.05); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; margin: 14px 0; }
.alloc-inputs { margin-top: 12px; }
.alloc-inputs input { font-weight: 800; text-align: center; }

.nasdaq-card { border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; margin: 14px 0; background: rgba(255,255,255,.5); transition: background .25s, border-color .25s; }
.nasdaq-card.over { border-color: #fca5a5; background: linear-gradient(135deg, rgba(254,242,242,.92), rgba(255,237,237,.7)); }
.nc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nc-title { font-weight: 800; font-size: 15px; }
.nc-pct { font-weight: 800; font-size: 22px; color: var(--primary-d); font-variant-numeric: tabular-nums; }
.nasdaq-card.over .nc-pct { color: #dc2626; }
.nc-cap { font-size: 12px; color: var(--muted); font-weight: 600; }
.nc-bar { height: 12px; border-radius: 999px; background: rgba(148,163,184,.18); overflow: hidden; margin: 10px 0 8px; }
.nc-bar-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #10b981, #f59e0b); transition: width .4s ease; }
.nasdaq-card.over .nc-bar-fill { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.nc-detail { margin-top: 2px; }
.nasdaq-warn { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: #dc2626; color: #fff; font-weight: 800; font-size: 13.5px; box-shadow: 0 6px 18px rgba(220,38,38,.28); animation: nasdaqFlash 1.2s ease-in-out infinite; }
@keyframes nasdaqFlash { 0%,100% { box-shadow: 0 6px 18px rgba(220,38,38,.28); } 50% { box-shadow: 0 6px 26px rgba(220,38,38,.5); } }

#allocPlanTable th, #allocPlanTable td { white-space: nowrap; font-size: 13px; }
#allocPlanTable .dev-pos { color: var(--profit); font-weight: 800; }
#allocPlanTable .dev-neg { color: var(--loss); font-weight: 800; }
#allocPlanTable .dev-zero { color: var(--muted); }
#allocPlanTable tr.plan-out td { color: var(--muted); }

.alloc-detail { margin-top: 18px; border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; background: rgba(255,255,255,.5); }
.alloc-detail summary { cursor: pointer; font-weight: 800; font-size: 14px; }
.alloc-class-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.acl-row { display: grid; grid-template-columns: 1.6fr 1fr auto; align-items: center; gap: 12px; padding: 8px 10px; background: rgba(255,255,255,.7); border: 1px solid var(--border); border-radius: 12px; }
.acl-row .acl-name { font-weight: 700; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acl-row .acl-code { color: var(--muted); font-size: 11px; margin-top: 2px; }
.acl-row select { padding: 7px 10px; font-size: 12.5px; font-weight: 700; }
.acl-row .acl-ndx { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; cursor: pointer; }
.acl-row .acl-ndx input { width: auto; accent-color: #ef4444; }
@media (max-width: 560px) {
  .acl-row { grid-template-columns: 1fr; gap: 6px; }
  .acl-row .acl-ndx { justify-content: flex-start; }
}

/* 经典配置参考 */
.classic-ref { background: rgba(99,102,241,.05); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; margin: 14px 0; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.preset-btn { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700; cursor: pointer; transition: .15s; color: var(--text); }
.preset-btn:hover { border-color: var(--primary); color: var(--primary); }
.preset-btn.preset-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.age-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-size: 13px; }
.classic-desc { margin-top: 8px; font-size: 13px; color: var(--text); background: rgba(255,255,255,.65); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; line-height: 1.6; }
#classicCompareTable th, #classicCompareTable td { font-size: 12.5px; padding: 7px 8px; }
#classicCompareTable .actual { font-weight: 800; color: var(--primary-d); }
.alloc-inputs.five { flex-wrap: wrap; }
.alloc-inputs.five label { flex: 1 1 96px; font-size: 12px; }
.alloc-inputs.five input { width: 100%; }

/* ============ 分类分组（模块二持仓 / 模块三钱包）============ */
/* 模块二：持仓统计的分类表头行 */
#statsTable .cat-header td {
  background: linear-gradient(90deg, rgba(59,130,246,.10), rgba(59,130,246,.03));
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
  font-size: 13px;
}
#statsTable .cat-header .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
#statsTable .cat-header strong { font-size: 14px; margin-right: 8px; }
#statsTable .cat-header .cat-count { color: var(--muted); margin-right: 10px; font-weight: 600; }
#statsTable .cat-header .cat-sum { color: var(--primary-d); font-weight: 800; }
/* 模块三：钱包分组 */
.wallet-group { margin-bottom: 10px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: rgba(255,255,255,.55); }
.wallet-group .wg-header {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; background: rgba(59,130,246,.07); border-bottom: 1px solid var(--border); font-size: 13px;
}
.wallet-group .wg-header .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.wallet-group .wg-header strong { font-size: 14px; }
.wallet-group .wg-header .cat-count { color: var(--muted); font-weight: 600; margin-left: 2px; }
.wallet-group .wg-header .cat-sum { margin-left: auto; color: var(--primary-d); font-weight: 800; }
.wallet-group .wallet-item { border: none; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; margin: 0; }
.wallet-group .wallet-item:last-child { border-bottom: none; }
.wallet-group .wallet-item:hover { background: rgba(255,255,255,.94); transform: none; box-shadow: none; }
/* 钱包名称后的资产类别小标签 */
.wi-cat {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.6; border: 1px solid; vertical-align: middle;
  background: rgba(255,255,255,.7);
}

/* 手机端：压缩顶部抬头，减少屏幕占用 */
@media (max-width: 640px) {
  .app-header { border-bottom: none; }
  .topbar {
    flex-wrap: nowrap;
    align-items: center;
    padding: 9px 14px;
    gap: 8px;
  }
  .brand { gap: 10px; min-width: 0; }
  .logo-ring {
    width: 38px; height: 38px;
    border-radius: 12px;
    box-shadow: 0 5px 14px rgba(59, 130, 246, .22);
  }
  .logo { font-size: 18px; }
  .brand h1 { font-size: 15px; letter-spacing: -0.2px; line-height: 1.15; }
  /* 移动端隐藏副标题长句，下方标签栏已涵盖各模块 */
  .brand .sub { display: none; }

  /* 操作菜单按钮 */
  .topbar-menu-toggle { display: inline-flex; flex: 0 0 auto; }

  /* 顶部操作区默认收起，点击后下拉展开 */
  .top-actions {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 14px;
    right: 14px;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.14);
    z-index: 10;
    overflow: visible;
  }
  .top-actions.open { display: flex; animation: fadeIn .18s ease; }
  .top-actions .export-group { display: flex; flex-wrap: wrap; gap: 8px; }
  .top-actions .btn-mini { flex: 1 1 auto; padding: 8px 10px; font-size: 12px; white-space: nowrap; }
  .top-actions #syncStatus { align-self: flex-start; }

  .badge { font-size: 11px; padding: 3px 8px; }
  .tabs { padding: 8px 14px 0; gap: 6px; background: rgba(255,255,255,0.65); }
  .tab { padding: 9px 12px; font-size: 13px; gap: 5px; }
  main { padding: 14px 14px 60px; }
}

/* 模块五：纳指ETF溢价监控 */
.premium-settings { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 4px 0 14px; padding: 12px; background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.18); border-radius: 12px; }
.premium-settings label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.premium-input { width: 88px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; text-align: right; }
#premiumTable th:nth-child(5), #premiumTable td:nth-child(5) { text-align: center; }
#premiumTable .muted { color: var(--muted); }
