  /* ============================================================
     CSS 设计令牌系统
     ============================================================ */
  :root {
    color-scheme: dark light;
    /* 背景分层 */
    --bg: #0a0e17;
    --bg2: #111827;
    --bg3: #1a2236;
    --bg4: #243044;
    /* 文字色 */
    --t1: #e8f0fe;
    --t2: #94a3b8;
    --t3: #64748b;
    /* 边框 */
    --bd: rgba(255,255,255,0.06);
    --bd2: rgba(255,255,255,0.1);
    /* 主题/语义色 */
    --accent: #60a5fa;
    --accent2: #60a5fa;
    --danger: #ff4757;
    --warn: #ffa502;
    /* 涨跌方向色 */
    --up: #f04444;
    --up-bg: rgba(240,68,68,0.12);
    --up-bd: rgba(240,68,68,0.3);
    --up-dim: rgba(240,68,68,0.04);
    --dn: #22c55e;
    --dn-bd: rgba(34,197,94,0.3);
    --dn-dim: rgba(34,197,94,0.04);
    /* 买卖语义色 */
    --buy: #60a5fa;
    --buy-bg: rgba(59,130,246,0.08);
    --buy-bd: rgba(59,130,246,0.25);
    --buy-dim: rgba(59,130,246,0.15);
    --sell: #f59e0b;
    --sell-bg: rgba(245,158,11,0.08);
    --sell-bd: rgba(245,158,11,0.25);
    --sell-dim: rgba(245,158,11,0.15);
    /* 专用字体 */
    --f-num: "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, monospace;
    --f-zh: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    /* 安全区 */
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
    /* 顶部栏/概览区专用色（深色模式默认值） */
    --topbar-bg: rgba(17,24,39,0.72);
    --overview-bg: linear-gradient(135deg, #1a1f2e 0%, #141820 100%);
    --overview-cash: var(--t1);
    /* 顶部栏标题：醒目暖白，避免纯白眩光 */
    --topbar-title: #f5f7fa;
    /* logo 渐变端色 */
    --logo-from: #60a5fa;
    --logo-to: #3b82f6;
    /* 阴影系统（深色默认值：更深更柔，模拟真实光照） */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.18);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.28), 0 1px 3px rgba(0,0,0,0.2);
    --shadow-lg: 0 12px 36px rgba(0,0,0,0.36), 0 2px 8px rgba(0,0,0,0.22);
    --shadow-glow: 0 0 0 1px rgba(96,165,250,0.08), 0 8px 28px rgba(96,165,250,0.06);
    /* 卡片内高光（顶部一道极细的亮边，模拟玻璃质感） */
    --inset-hl: inset 0 1px 0 rgba(255,255,255,0.04);
  }

  /* 浅色模式 */
  @media (prefers-color-scheme: light) {
    :root {
      --bg: #f8f8fa;
      --bg2: #ffffff;
      --bg3: #f0f1f4;
      --bg4: #e4e5ea;
      --t1: #111827;
      --t2: #4b5563;
      --t3: #6b7280;
      --bd: rgba(0,0,0,0.08);
      --bd2: rgba(0,0,0,0.12);
      --accent: #2563eb;
      --accent2: #2563eb;
      --danger: #bb0000;
      --warn: #c47000;
      --up: #dd3333;
      --dn: #1a9955;
      /* 顶部栏/概览区专用：浅色模式下使用浅色玻璃底 */
      --topbar-bg: rgba(244,244,246,0.82);
      --overview-bg: linear-gradient(135deg, #f4f5f8 0%, #eef0f4 100%);
      --overview-cash: var(--t1);
      --topbar-title: #0f0f20;
      --logo-from: #2563eb;
      --logo-to: #1d4ed8;
      --shadow-sm: 0 1px 2px rgba(20,30,50,0.06);
      --shadow-md: 0 4px 14px rgba(20,30,50,0.08), 0 1px 3px rgba(20,30,50,0.05);
      --shadow-lg: 0 12px 32px rgba(20,30,50,0.12), 0 2px 6px rgba(20,30,50,0.06);
      --shadow-glow: 0 0 0 1px rgba(37,99,235,0.06), 0 8px 24px rgba(37,99,235,0.05);
      --inset-hl: inset 0 1px 0 rgba(255,255,255,0.6);
    }
  }

  /* ════════ 全局基础 ════════ */
  *, *::before, *::after {
    box-sizing: border-box; margin: 0; padding: 0;
    -webkit-tap-highlight-color: transparent;
  }

  body {
    background:
      radial-gradient(900px 480px at 12% -8%, rgba(120,140,180,0.05), transparent 60%),
      radial-gradient(700px 420px at 88% 0%, rgba(100,120,160,0.04), transparent 55%),
      var(--bg);
    background-attachment: fixed;
    color: var(--t1);
    font-family: var(--f-zh);
    font-size: 14px;
    min-height: 100vh;
    padding: 0 0 80px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  @media (prefers-color-scheme: light) {
    body {
      background:
        radial-gradient(900px 480px at 12% -8%, rgba(100,120,160,0.04), transparent 60%),
        radial-gradient(700px 420px at 88% 0%, rgba(80,100,140,0.03), transparent 55%),
        var(--bg);
      background-attachment: fixed;
    }
  }
  ::selection { background: rgba(96,165,250,0.25); color: var(--t1); }
  @media (prefers-color-scheme: light) { ::selection { background: rgba(37,99,235,0.18); } }
  ::-webkit-scrollbar { width: 9px; height: 9px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--bd2);
    border-radius: 20px;
    border: 2px solid var(--bg);
    background-clip: padding-box;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--t3); background-clip: padding-box; }
  html { scrollbar-color: var(--bd2) transparent; scrollbar-width: thin; }

  /* ════════ 顶部栏 (毛玻璃) ════════ */
  .topbar {
    background: var(--topbar-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--bd);
    padding: calc(14px + var(--sat)) calc(20px + var(--sar)) 14px calc(20px + var(--sal));
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
  }
  .topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .topbar-logo {
    width: 28px; height: 28px;
    border-radius: 7px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18), 0 0 0 1px rgba(255,255,255,0.06);
  }
  .topbar-title {
    font-family: var(--f-num);
    font-size: 14px;
    color: var(--topbar-title);
    letter-spacing: 0.1em;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.18);
  }
  .topbar-version {
    font-family: var(--f-num);
    font-size: 10px;
    color: var(--accent);
    border: 1px solid var(--bd2);
    border-radius: 999px;
    padding: 2px 6px;
  }
  .topbar-status {
    font-family: var(--f-num);
    font-size: 11px;
    color: var(--t2);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.25s ease;
  }
  .topbar-actions { display: flex; align-items: center; gap: 10px; }
  .topbar-clear {
    min-height: 36px;
    border: 1px solid var(--bd);
    border-radius: 8px;
    background: transparent;
    color: var(--t3);
    font-size: 11px;
    padding: 6px 9px;
  }
  .topbar-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--t3);
    flex-shrink: 0;
    transition: background 0.25s ease, box-shadow 0.25s ease;
  }
  .topbar-status.ok { color: var(--accent); }
  .topbar-status.ok::before { background: var(--accent); box-shadow: 0 0 6px rgba(96,165,250,0.6); animation: dot-breathe 2.4s ease-in-out infinite; }
  .topbar-status.err { color: var(--danger); }
  .topbar-status.err::before { background: var(--danger); box-shadow: 0 0 6px rgba(255,71,87,0.6); }
  @keyframes dot-breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
  }

  /* ════════ 认证区 ════════ */
  #auth-screen {
    padding: 40px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 420px;
    margin: 0 auto;
  }
  .auth-logo {
    font-family: var(--f-num);
    font-size: 11px;
    color: var(--t2);
    letter-spacing: 0.24em;
    text-align: center;
    margin-bottom: 8px;
    opacity: 0.85;
  }
  .auth-title {
    font-size: 23px;
    font-weight: 700;
    color: var(--t1);
    text-align: center;
    letter-spacing: -0.01em;
  }
  .auth-sub {
    font-size: 13px;
    color: var(--t2);
    text-align: center;
    line-height: 1.6;
  }

  /* ════════ 表单元素 ════════ */
  .field-label {
    font-size: 11px;
    color: var(--t2);
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    font-family: var(--f-num);
  }
  input, select {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--bd);
    border-radius: 8px;
    color: var(--t1);
    font-family: var(--f-num);
    font-size: 14px;
    padding: 12px 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
  }
  select {
    padding-right: 42px;
    background-image:
      linear-gradient(45deg, transparent 50%, var(--t2) 50%),
      linear-gradient(135deg, var(--t2) 50%, transparent 50%);
    background-position:
      calc(100% - 18px) 50%,
      calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
  }
  select:disabled {
    color: var(--t3);
    opacity: 0.78;
    cursor: not-allowed;
  }
  input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(96,165,250,0.12);
  }
  input::placeholder { color: var(--t3); }
  /* iOS Safari 圆角/阴影/内边距归零 */
  input[type="text"], input[type="password"], input[type="number"],
  input[type="date"], input[type="search"], select, textarea {
    -webkit-border-radius: 8px;
    border-radius: 8px;
    -webkit-box-shadow: none;
    box-shadow: none;
  }
  /* iOS date 输入框占位文字色 */
  input[type="date"]::-webkit-date-and-time-value {
    color: var(--t1);
    text-align: left;
  }
  /* iOS select 去除默认箭头（保留自定义外观） */
  select::-ms-expand { display: none; }
  /* iOS 输入框自动放大修正：字号 ≥16px */
  @supports (-webkit-touch-callout: none) {
    input, select, textarea {
      font-size: 16px;
    }
    /* 但桌面端不受影响，仅 iOS Safari 生效 */
  }

  .btn {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    border: none;
    font-family: var(--f-num);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.12s ease, background 0.18s ease, box-shadow 0.18s ease;
  }
  .btn:active { transform: scale(0.97); }
  .btn-primary {
    background: var(--accent);
    color: #000;
    box-shadow: 0 4px 14px rgba(96,165,250,0.22), inset 0 1px 0 rgba(255,255,255,0.25);
  }
  .btn-primary:active { opacity: 0.82; }
  @media (hover: hover) {
    .btn-primary:hover { box-shadow: 0 6px 18px rgba(96,165,250,0.3), inset 0 1px 0 rgba(255,255,255,0.3); }
  }
  .btn-ghost {
    background: transparent;
    color: var(--t2);
    border: 1px solid var(--bd);
  }
  .btn-ghost:active { background: var(--bg3); opacity: 0.85; }

  .auth-error {
    display: none;
    color: var(--danger);
    font-size: 12px;
    text-align: center;
  }

  .btn-cash-save {
    width: auto;
    padding: 8px 16px;
    font-size: 12px;
  }

  .btn-cash-cancel {
    width: auto;
    padding: 8px 12px;
    font-size: 12px;
  }

  .section-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .json-download-btn {
    background: transparent;
    border: 1px solid var(--bd);
    border-radius: 6px;
    color: var(--t2);
    cursor: pointer;
    font-family: var(--f-num);
    font-size: 10px;
    letter-spacing: 0.05em;
    padding: 3px 9px;
  }

  .drawer-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
  }

  .drawer-confirm-btn {
    flex: 1;
  }

  .drawer-cancel-btn {
    width: auto;
    padding: 14px 20px;
  }

  .operation-preview {
    color: var(--t2);
    background: var(--bg3);
    border: 1px solid var(--bd);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.6;
    padding: 10px 12px;
  }

  .operation-dialog {
    width: min(92vw, 440px);
    max-height: min(90dvh, 760px);
    overflow-y: auto;
    border: 1px solid var(--bd2);
    border-radius: 14px;
    background: var(--bg2);
    color: var(--t1);
    padding: 20px 20px calc(20px + var(--sab));
    margin: auto;
    box-shadow: var(--shadow-lg);
  }
  .operation-dialog::backdrop {
    background: rgba(0,0,0,0.62);
    backdrop-filter: blur(4px);
  }
  .operation-dialog form {
    display: grid;
    gap: 14px;
  }
  .reason-control {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-top: 7px;
  }
  .reason-status {
    color: var(--t2);
    font-size: 11px;
    line-height: 1.5;
    min-width: 0;
  }
  .reason-status-ok { color: var(--accent); }
  .reason-status-error { color: var(--danger); }
  .reason-status-manual { color: var(--warn); }
  .reason-manual-btn {
    flex: 0 0 auto;
    border: 1px solid var(--bd2);
    border-radius: 7px;
    background: transparent;
    color: var(--t2);
    cursor: pointer;
    font-size: 11px;
    padding: 5px 8px;
  }

  .execution-panel {
    margin: 8px 12px 12px;
    background: var(--bg2);
    border: 1px solid var(--bd);
    border-radius: 10px;
    box-shadow: var(--inset-hl), var(--shadow-sm);
    overflow: hidden;
  }
  .execution-head {
    display: flex;
    justify-content: space-between;
    padding: 14px;
    border-bottom: 1px solid var(--bd);
  }
  .execution-title {
    font-size: 14px;
    font-weight: 700;
  }
  .execution-meta {
    color: var(--t2);
    font-size: 11px;
    margin-top: 4px;
  }
  .execution-list {
    display: grid;
  }
  .execution-row {
    padding: 12px 14px;
    border-bottom: 1px solid var(--bd);
  }
  .execution-row:last-child { border-bottom: 0; }
  .execution-row-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-family: var(--f-num);
    font-size: 12px;
  }
  .execution-action {
    color: var(--accent);
    font-weight: 700;
  }
  .execution-status {
    margin-left: auto;
    color: var(--t2);
    font-size: 10px;
  }
  .execution-reason {
    color: var(--t2);
    font-size: 12px;
    line-height: 1.5;
    margin-top: 6px;
  }
  .execution-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--t3);
    font-size: 10px;
    margin-top: 8px;
  }
  .execution-buttons {
    display: flex;
    gap: 6px;
  }
  .execution-buttons button {
    border: 1px solid var(--bd2);
    background: transparent;
    color: var(--t2);
    border-radius: 6px;
    padding: 4px 7px;
    cursor: pointer;
    font-size: 10px;
  }
  .execution-buttons button.danger { color: var(--danger); }
  .execution-reversed { opacity: 0.55; }
  .execution-corrected .execution-status { color: var(--warn); }

  /* ════════ 主界面 ════════ */
  #main-screen { display: none; }

  /* ════════ 资产概览 ════════ */
  .overview {
    background: rgba(17,24,39,0.56);
    border: 1px solid var(--bd);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 12px 12px 8px;
    box-shadow: var(--inset-hl), var(--shadow-sm);
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
  }
  @media (prefers-color-scheme: light) {
    .overview {
      background: rgba(255,255,255,0.88);
    }
  }
  .overview-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  .overview-label {
    font-family: var(--f-num);
    font-size: 10px;
    color: var(--t2);
    letter-spacing: 0.08em;
    margin-bottom: 3px;
  }
  .overview-cash {
    font-family: var(--f-num);
    font-size: 21px;
    font-weight: 700;
    color: var(--overview-cash);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
  }
  .overview-cash-edit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .cash-edit-btn {
    background: none;
    border: none;
    color: var(--t2);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
  }
  .cash-input-row {
    display: none;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
  }
  .cash-input-row[style*="flex"] { animation: fadeInUp 0.22s ease-out both; }
  .cash-input-row input { font-size: 16px; padding: 8px 12px; }
  .cash-input-row .btn {
    width: auto;
    padding: 8px 16px;
    white-space: nowrap;
  }
  .overview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .overview-sub {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    align-self: center;
  }
  .overview-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
  }
  .overview-stat-label {
    font-size: 10px;
    color: var(--t2);
    font-family: var(--f-num);
    letter-spacing: 0.04em;
    order: 1;
  }
  .overview-stat-val {
    font-family: var(--f-num);
    font-size: 12px;
    font-weight: 600;
    color: var(--t2);
    font-variant-numeric: tabular-nums;
    order: 2;
  }

  .section-header {
    padding: 16px 16px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .section-title {
    font-family: var(--f-num);
    font-size: 12px;
    color: var(--t2);
    letter-spacing: 0.12em;
    font-weight: 600;
  }
  .badge {
    font-family: var(--f-num);
    font-size: 10px;
    font-weight: 600;
    background: var(--bg3);
    border: 1px solid var(--bd);
    color: var(--t2);
    padding: 2px 9px;
    border-radius: 20px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  }

  /* 桌面列表头（默认隐藏） */
  .holdings-table-header {
    display: none;
  }

  /* ════════ 持仓卡片 + 左沿彩色边条 ════════ */
  .holding-card {
    position: relative;
    margin: 0 12px 10px;
    background: var(--bg2);
    border: 1px solid var(--bd);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--inset-hl), var(--shadow-sm);
    transition: border-color 0.2s, transform 0.2s, opacity 0.2s, box-shadow 0.25s ease;
    animation: fadeInUp 0.32s ease-out both;
  }
  .holding-card.is-open {
    border-color: var(--bd2);
    box-shadow: var(--inset-hl), var(--shadow-md);
  }
  .holding-card::before {
    content: '';
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--accent);
    opacity: 0.5;
    transition: opacity 0.3s;
  }
  .holding-card:hover::before {
    opacity: 0.8;
  }
  .holding-card:active {
    border-color: var(--accent);
    transform: scale(0.99);
    box-shadow: var(--inset-hl), var(--shadow-glow);
  }

  .card-main {
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
  }
  .card-recommendation {
    display: flex;
    grid-column: 2 / -1;
    align-items: baseline;
    gap: 7px;
    min-width: 0;
    margin-top: 2px;
    color: var(--accent);
    font-family: var(--f-num);
    font-size: 11px;
  }
  .card-recommendation strong { color: var(--t1); font-size: 12px; }
  .card-recommendation small { color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .card-recommendation.is-muted { color: var(--t3); }
  .card-code-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
  }
  .card-code {
    font-family: var(--f-num);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: var(--buy-bg);
    border: 1px solid var(--buy-bd);
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
    min-width: 56px;
    text-align: center;
    letter-spacing: 0.02em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  }
  .card-exch {
    font-size: 9px;
    color: var(--t2);
    font-family: var(--f-num);
    letter-spacing: 0.06em;
  }
  .card-info { flex: 1; min-width: 0; }
  .card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--t1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
  }
  .holding-flag {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    font-family: var(--f-num);
    font-size: 10px;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }
  .holding-flag-reduced {
    color: var(--warn);
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.18);
  }
  .card-meta {
    font-family: var(--f-num);
    font-size: 12px;
    color: var(--t2);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
  }
  .card-col { display: none; }
  .card-expand-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid var(--bd);
    background: var(--bg3);
    color: var(--t2);
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  }
  .holding-card.is-open .card-expand-indicator {
    color: var(--accent);
    border-color: var(--buy-bd);
    transform: rotate(180deg);
  }
  .card-btn {
    border: none;
    border-radius: 8px;
    font-family: var(--f-num);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.02em;
    transition: transform 0.12s ease, opacity 0.12s ease, background 0.18s ease, box-shadow 0.18s ease;
  }
  .card-btn:active { transform: scale(0.94); opacity: 0.85; }
  .card-btn-add {
    background: var(--buy-bg);
    color: var(--accent);
    border: 1px solid var(--buy-bd);
  }
  .card-btn-reduce {
    background: var(--bg3);
    color: var(--t3);
    border: 1px solid var(--bd2);
  }
  .card-btn-reduce:active { background: var(--bg4); opacity: 0.85; }
  .card-btn-close {
    background: rgba(255,71,87,0.05);
    color: var(--danger);
    border: 1px solid rgba(255,71,87,0.15);
  }
  /* ════════ 展开编辑区 ════════ */
  .card-edit {
    display: none;
    padding: 0 14px 14px;
    border-top: 1px solid var(--bd);
    padding-top: 12px;
    gap: 10px;
    flex-direction: column;
  }
  .card-edit.open { display: flex; animation: fadeIn 0.22s ease-out both; }
  .edit-correction-note {
    color: var(--warn);
    font-size: 11px;
    line-height: 1.5;
  }
  .edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .edit-field { display: flex; flex-direction: column; gap: 4px; }
  .edit-save-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
  }
  .edit-save-row .btn { padding: 10px; font-size: 12px; }
  .edit-save-btn { flex: 1; }
  .edit-cancel-btn {
    width: auto;
    padding: 10px 14px;
  }
  .edit-action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .edit-action-row .card-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
  }
  .card-primary-action {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--buy-bd);
    border-radius: 9px;
    background: var(--buy-bg);
    color: var(--accent);
    font-family: var(--f-num);
    font-size: 12px;
    font-weight: 700;
  }
  .card-primary-action.is-sell {
    background: rgba(255,71,87,0.10);
    border-color: rgba(255,71,87,0.32);
    color: var(--danger);
  }

  /* ════════ 加载骨架 ════════ */
  .loading-skeleton {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .sk-card {
    background: var(--bg2);
    border: 1px solid var(--bd);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--inset-hl), var(--shadow-sm);
  }
  .sk-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255,255,255,0.04) 50%,
      transparent 100%
    );
    transform: translateX(-100%);
    animation: sk-shimmer 1.6s ease-in-out infinite;
  }
  .sk-block { background: var(--bg3); border-radius: 6px; }
  .sk-code { width: 56px; height: 28px; }
  .sk-name { flex: 1; height: 16px; }
  .sk-btn { width: 48px; height: 28px; }
  @keyframes sk-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.65; }
  }
  @keyframes sk-shimmer {
    100% { transform: translateX(100%); }
  }
  .loading-spinner {
    text-align: center;
    padding: 12px;
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 12px;
  }

  /* ════════ 空状态（大图标 + 文字） ════════ */
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 20px;
    color: var(--t2);
    font-size: 13px;
    font-family: var(--f-num);
    text-align: center;
    gap: 12px;
  }
  .empty-state .empty-icon {
    font-size: 44px;
    color: var(--t3);
    opacity: 0.7;
    line-height: 1;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
  }
  .empty-state .empty-hint {
    font-size: 11px;
    color: var(--t3);
    letter-spacing: 0.04em;
  }

  /* ════════ 数据更新闪烁 ════════ */
  @keyframes flash-refresh {
    0% { background: rgba(96,165,250,0.12); }
    100% { background: transparent; }
  }
  .flash-refresh {
    animation: flash-refresh 1s cubic-bezier(0.22, 0.61, 0.36, 1);
    border-radius: 12px;
  }

  /* ════════ 数据过期视觉 ════════ */
  .is-stale {
    filter: grayscale(0.8);
    opacity: 0.55;
  }
  .is-stale .card-code { color: var(--t2); }

  /* 数据新鲜：summary 左侧低饱和蓝色标记 */
  .is-fresh > summary::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent2);
    box-shadow: 0 0 0 1px rgba(96,165,250,0.18);
    margin-right: 4px;
    flex-shrink: 0;
  }

  /* ════════ 入场动画 ════════ */
  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* ════════ 底部 FAB（毛玻璃） ════════ */
  .fab-area {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    padding: 0 max(16px, var(--sal)) calc(18px + var(--sab)) max(16px, var(--sar));
    pointer-events: none;
  }
  .fab {
    width: 46px;
    height: 46px;
    margin: 0 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg2);
    border: 1px solid var(--bd);
    color: var(--accent);
    border-radius: 50%;
    padding: 0;
    font-family: var(--f-num);
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
    box-shadow: var(--shadow-sm);
  }
  .fab:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
  }
  .fab:active { transform: scale(0.97); opacity: 0.85; }

  /* ════════ 新建持仓抽屉 ════════ */
  .drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  .drawer-overlay.open { display: block; opacity: 1; }
  .drawer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg2);
    border-radius: 20px 20px 0 0;
    border-top: 1px solid var(--bd);
    padding: 20px 16px calc(40px + var(--sab));
    z-index: 201;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: min(90dvh, 760px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-lg), var(--inset-hl);
  }
  .drawer.open { transform: translateY(0); }
  .drawer-handle {
    width: 36px; height: 4px;
    background: var(--bd2);
    border-radius: 2px;
    margin: 0 auto 20px;
  }
  .drawer-title {
    font-family: var(--f-num);
    font-size: 13px;
    color: var(--accent);
    letter-spacing: 0.12em;
    margin-bottom: 20px;
    font-weight: 700;
  }
  .drawer-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  /* ════════ 代码建议 ════════ */
  .suggest-list {
    display: none;
    flex-direction: column;
    border: 1px solid var(--bd);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 4px;
    box-shadow: var(--shadow-md);
  }
  .suggest-list.open { display: flex; }
  .suggest-item {
    width: 100%;
    border: 0;
    padding: 10px 14px;
    background: var(--bg3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--bd);
    transition: background 0.1s;
  }
  .suggest-item:last-child { border-bottom: none; }
  .suggest-item:active, .suggest-item:hover { background: var(--bg4); }
  .suggest-code {
    font-family: var(--f-num);
    font-size: 12px;
    color: var(--accent);
    min-width: 70px;
  }
  .suggest-name { font-size: 13px; color: var(--t1); }

  /* ════════ Toast ════════ */
  .toast {
    position: fixed;
    top: calc(70px + var(--sat));
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--bg3);
    border: 1px solid var(--bd);
    border-radius: 8px;
    padding: 10px 20px;
    font-family: var(--f-num);
    font-size: 12px;
    font-weight: 500;
    color: var(--t1);
    z-index: 999;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  .toast.success { border-color: var(--dn); color: var(--dn); }
  .toast.error { border-color: var(--danger); color: var(--danger); }

  /* ════════ 页面开太久提示条 ════════ */
  .stale-banner {
    position: fixed;
    top: var(--sat);
    left: 0; right: 0;
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 16px;
    background: var(--bg3);
    border-bottom: 1px solid var(--danger);
    color: var(--danger);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .stale-banner button {
    border: 1px solid var(--danger);
    background: transparent;
    color: var(--danger);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
  }
  .stale-banner button:active { background: var(--danger); color: var(--bg2); }
  .stale-banner[hidden] { display: none; }

  /* ════════ 加载动画 ════════ */
  .spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid var(--bd);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  .max-w { max-width: 480px; margin: 0 auto; }

  /* ════════ 快速操作指引 ════════ */
  .quick-guide {
    margin: 8px 12px 12px;
    background: var(--bg2);
    border: 1px solid var(--bd);
    border-radius: 12px;
    box-shadow: var(--inset-hl), var(--shadow-sm);
    overflow: hidden;
  }
  .quick-guide[hidden] { display: none; }
  .quick-guide-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg3);
    border-bottom: 1px solid var(--bd);
  }
  .quick-guide-title {
    color: var(--accent);
    font-family: var(--f-num);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    white-space: nowrap;
  }
  .quick-guide-meta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 11px;
    white-space: nowrap;
  }
  .quick-guide-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px 12px;
  }
  .quick-window {
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 12px;
    line-height: 1.5;
  }
  .quick-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .quick-action {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg3);
    border: 1px solid var(--bd);
    border-left: 3px solid var(--t3);
    border-radius: 8px;
  }
  .quick-action-sell { border-left-color: var(--danger); background: rgba(255,71,87,0.05); }
  .quick-action-buy,
  .quick-action-add { border-left-color: var(--accent); background: var(--buy-bg); }
  .quick-action-hold { border-left-color: var(--t2); }
  .quick-action-skip { border-left-color: var(--t3); }
  .quick-type {
    min-width: 42px;
    color: var(--t1);
    font-family: var(--f-num);
    font-size: 11px;
    font-weight: 700;
  }
  .quick-main {
    min-width: 0;
    color: var(--t1);
    font-size: 13px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .quick-qty {
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 11px;
    white-space: nowrap;
  }
  .quick-note {
    grid-column: 2 / -1;
    color: var(--t2);
    font-size: 12px;
    line-height: 1.5;
  }


  /* ════════ 政策旁路观察 ════════ */
  .topbar-left[role="button"] {
    cursor: pointer;
    border-radius: 9px;
    padding: 3px 5px 3px 3px;
    margin: -3px 0 -3px -3px;
    transition: background 0.18s ease, opacity 0.16s ease;
  }
  .topbar-left[role="button"]:active { opacity: 0.78; }
  @media (hover: hover) {
    .topbar-left[role="button"]:hover { background: rgba(96,165,250,0.08); }
  }
  .policy-watch {
    margin: 0 12px 12px;
    background: var(--bg2);
    border: 1px solid var(--bd);
    border-radius: 12px;
    box-shadow: var(--inset-hl), var(--shadow-sm);
    overflow: hidden;
  }
  .policy-watch[hidden] { display: none; }
  .policy-watch-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    background: var(--bg3);
    border-bottom: 1px solid var(--bd);
  }
  .policy-watch-title-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
  }
  .policy-watch-title {
    color: var(--accent);
    font-family: var(--f-num);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    flex-shrink: 0;
  }
  .policy-watch-meta {
    color: var(--t3);
    font-size: 11px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .policy-watch-badge {
    flex-shrink: 0;
    color: var(--accent);
    background: var(--buy-bg);
    border: 1px solid var(--buy-bd);
    border-radius: 999px;
    font-family: var(--f-num);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    white-space: nowrap;
  }
  .policy-watch-body {
    display: grid;
    gap: 10px;
    padding: 10px 12px 12px;
  }
  .policy-watch-summary {
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 11px;
    line-height: 1.45;
  }
  .policy-watch-group {
    display: grid;
    gap: 6px;
  }
  .policy-watch-group-title {
    color: var(--t2);
    font-size: 11px;
    font-weight: 700;
  }
  .policy-watch-row {
    border: 1px solid var(--bd);
    border-left: 3px solid var(--t3);
    border-radius: 8px;
    background: var(--bg3);
    padding: 8px 9px;
  }
  .policy-watch-risk { border-left-color: var(--danger); background: rgba(255,71,87,0.05); }
  .policy-watch-trigger { border-left-color: var(--accent); background: var(--buy-bg); }
  .policy-watch-row-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 7px;
    align-items: center;
  }
  .policy-watch-symbol,
  .policy-watch-action {
    font-family: var(--f-num);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }
  .policy-watch-symbol { color: var(--accent); }
  .policy-watch-name {
    min-width: 0;
    color: var(--t1);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .policy-watch-action { color: var(--t1); }
  .policy-watch-row-sub,
  .policy-watch-event {
    margin-top: 5px;
    color: var(--t2);
    font-size: 11px;
    line-height: 1.45;
  }
  .policy-watch-event {
    color: var(--t3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .policy-delta-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .policy-delta {
    border: 1px solid var(--bd);
    border-radius: 999px;
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 10px;
    padding: 3px 7px;
  }
  .policy-delta.is-pos { color: var(--up); border-color: var(--up-bd); background: var(--up-bg); }
  .policy-delta.is-neg { color: var(--dn); border-color: var(--dn-bd); background: var(--dn-dim); }
  .policy-watch-empty {
    color: var(--t2);
    font-size: 12px;
    line-height: 1.6;
  }

  /* ════════ 量化观察面板 ════════ */
  .observer-panel {
    margin: 0 12px 12px;
    background: var(--bg2);
    border: 1px solid var(--bd);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--inset-hl), var(--shadow-sm);
  }
  .observer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    background: var(--bg3);
    border-bottom: 1px solid var(--bd);
  }
  .observer-title {
    color: var(--accent);
    font-family: var(--f-num);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
  }
  .observer-meta {
    margin-top: 3px;
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 11px;
    line-height: 1.3;
  }
  .observer-confirm-btn {
    width: auto;
    flex-shrink: 0;
    border: 1px solid var(--buy-bd);
    border-radius: 8px;
    background: var(--buy-bg);
    color: var(--accent);
    cursor: pointer;
    font-family: var(--f-num);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 8px 11px;
    transition: opacity 0.16s ease, transform 0.12s ease, background 0.16s ease;
  }
  .observer-confirm-btn:active { transform: scale(0.97); opacity: 0.85; }
  .observer-confirm-btn:disabled { opacity: 0.45; cursor: wait; }
  .observer-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1px;
    background: var(--bd);
    border-bottom: 1px solid var(--bd);
  }
  .observer-kpi {
    min-width: 0;
    background: var(--bg2);
    padding: 10px 8px;
  }
  .observer-kpi-label {
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 10px;
    white-space: nowrap;
  }
  .observer-kpi-val {
    margin-top: 4px;
    color: var(--t1);
    font-family: var(--f-num);
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }
  .observer-kpi.is-pos .observer-kpi-val { color: var(--up); }
  .observer-kpi.is-neg .observer-kpi-val { color: var(--dn); }
  .observer-chart {
    position: relative;
    min-height: 170px;
    padding: 10px 10px 0;
  }
  .observer-chart svg {
    display: block;
    width: 100%;
    height: auto;
  }
  .observer-chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 12px;
  }
  .observer-grid {
    stroke: var(--bd2);
    stroke-width: 1;
  }
  .observer-axis {
    fill: var(--t3);
    font-family: var(--f-num);
    font-size: 10px;
  }
  .observer-line {
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .observer-line-xplan { stroke: var(--accent); stroke-width: 3; }
  .observer-line-hs300 { stroke: var(--warn); }
  .observer-line-csi500 { stroke: var(--dn); }
  .observer-line-enhanced_ref { stroke: var(--t2); }
  .observer-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 0 12px 10px;
  }
  .observer-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 10px;
    white-space: nowrap;
  }
  .observer-legend-item span {
    display: inline-block;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: var(--t2);
  }
  .observer-legend-xplan span { background: var(--accent); height: 3px; }
  .observer-legend-hs300 span { background: var(--warn); }
  .observer-legend-csi500 span { background: var(--dn); }
  .observer-hit {
    fill: transparent;
    cursor: crosshair;
  }
  .observer-hover-line {
    stroke: var(--t3);
    stroke-width: 1;
    stroke-dasharray: 4 4;
    pointer-events: none;
  }
  .observer-tooltip {
    position: absolute;
    z-index: 3;
    width: max-content;
    max-width: 230px;
    padding: 8px 10px;
    border: 1px solid var(--bd);
    border-radius: 8px;
    background: var(--bg);
    color: var(--t1);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    font-family: var(--f-num);
    font-size: 11px;
    line-height: 1.45;
    pointer-events: none;
  }
  .observer-tooltip-date {
    margin-bottom: 5px;
    color: var(--t2);
    font-weight: 700;
  }
  .observer-tooltip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
  .observer-tooltip-row strong {
    font-variant-numeric: tabular-nums;
  }
  .observer-tooltip-xplan strong { color: var(--accent); }
  .observer-tooltip-hs300 strong { color: var(--warn); }
  .observer-tooltip-csi500 strong { color: var(--dn); }
  .observer-tooltip-enhanced_ref strong { color: var(--t2); }
  .observer-tooltip-note {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--bd);
    color: var(--t2);
  }
  .observer-insight {
    padding: 0 12px 12px;
    color: var(--t2);
    font-size: 11px;
    line-height: 1.45;
  }
  .observer-insight strong {
    color: var(--t1);
  }
  .observer-progress {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--bd);
  }
  .observer-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--t1);
    font-family: var(--f-num);
    font-size: 11px;
  }
  .observer-bar {
    height: 6px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bg3);
    border: 1px solid var(--bd);
  }
  .observer-bar div {
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
  }
  .observer-progress-note {
    margin-top: 5px;
    color: var(--t2);
    font-size: 11px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .observer-quality {
    border-top: 1px solid var(--bd);
    padding: 9px 12px 11px;
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 11px;
    line-height: 1.45;
  }

  /* ════════ AI分析 / 原始扫描数据 折叠区（借鉴基金看板柔和配色） ════════ */
  .info-section {
    margin: 0 12px 10px;
    background: var(--bg2);
    border: 1px solid var(--bd);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--inset-hl), var(--shadow-sm);
    transition: box-shadow 0.25s ease;
  }
  .info-section-primary {
    margin-top: 6px;
  }
  .info-section[open] {
    box-shadow: var(--inset-hl), var(--shadow-md);
  }
  .info-section summary {
    list-style: none;
    cursor: pointer;
    min-height: 42px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--f-num);
    font-size: 12px;
    letter-spacing: 0.09em;
    font-weight: 600;
    color: var(--accent);
    background: var(--bg3);
    transition: background 0.18s ease;
  }
  .info-section summary:active { background: var(--bg4); }
  .info-section summary::-webkit-details-marker { display: none; }
  .info-section summary::after {
    content: '▾';
    color: var(--t2);
    transition: transform 0.2s;
    flex-shrink: 0;
  }
  .info-section[open] summary::after { transform: rotate(180deg); }
  .info-section .info-meta {
    font-size: 11px;
    color: var(--t2);
    font-weight: 400;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 1;
    margin-left: auto;
    text-align: right;
  }
  .info-section .info-body {
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--t1);
    animation: fadeIn 0.28s ease-out both;
  }
  .info-section.ai-err summary { color: var(--danger); }

  @media (max-width: 420px) {
    .overview-row {
      align-items: flex-start;
    }
    .overview-cash {
      font-size: 19px;
    }
    .info-section summary {
      align-items: center;
      flex-wrap: nowrap;
    }
    .info-section .info-meta {
      max-width: 52%;
      margin-left: auto;
      text-align: right;
    }
    .observer-head {
      align-items: flex-start;
    }
    .observer-kpis {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .observer-kpi:last-child {
      grid-column: 1 / -1;
    }
    .observer-progress {
      grid-template-columns: 1fr;
    }
    .edit-save-row,
    .edit-action-row {
      flex-wrap: wrap;
    }
    .edit-save-row .btn,
    .edit-action-row .card-btn {
      width: 100%;
    }
  }

  /* ════════ Markdown 渲染（柔和、护眼、带细节样式） ════════ */
  .markdown-body { color: var(--t1); }
  .markdown-body h1, .markdown-body h2, .markdown-body h3 {
    color: var(--accent);
    margin: 18px 0 10px;
    line-height: 1.5;
    font-weight: 600;
  }
  .markdown-body h1 { font-size: 18px; }
  .markdown-body h2 { font-size: 16px; border-bottom: 1px solid var(--bd); padding-bottom: 6px; }
  .markdown-body h3 { font-size: 14px; }
  .markdown-body p { margin: 14px 0; }
  .markdown-body strong { color: var(--t1); font-weight: 600; }
  .markdown-body em { color: var(--t2); font-style: italic; }
  .markdown-body ul, .markdown-body ol { margin: 8px 0 10px 20px; }
  .markdown-body li { margin: 6px 0; line-height: 1.8; }
  .markdown-body li::marker { color: var(--t3); }
  .markdown-body hr {
    border: none;
    border-top: 1px solid var(--bd);
    margin: 14px 0;
  }
  .markdown-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed rgba(96,165,250,0.4);
  }
  .markdown-body a:hover { border-bottom-style: solid; }
  .markdown-body code {
    font-family: var(--f-num);
    background: var(--bg3);
    border: 1px solid var(--bd);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 12px;
    color: var(--accent2);
  }
  .markdown-body pre {
    background: var(--bg);
    border: 1px solid var(--bd);
    border-radius: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    margin: 8px 0;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.15);
  }
  .markdown-body pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--t1);
    font-size: 12px;
  }
  .markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 14px;
    font-size: 12px;
    font-family: var(--f-num);
    border-radius: 8px;
    overflow: hidden;
  }
  .markdown-body th, .markdown-body td {
    border: 1px solid var(--bd);
    padding: 6px 10px;
    text-align: left;
    white-space: nowrap;
  }
  .markdown-body th {
    background: var(--bg3);
    color: var(--t2);
    font-weight: 600;
    letter-spacing: 0.04em;
  }
  /* 表格 zebra 斑马纹 */
  .markdown-body tbody tr:nth-child(even) td {
    background: rgba(255,255,255,0.015);
  }
  .markdown-body tbody tr:hover td {
    background: rgba(96,165,250,0.04);
  }
  .markdown-body blockquote {
    border-left: 3px solid var(--accent);
    background: rgba(96,165,250,0.04);
    padding: 8px 12px;
    color: var(--t2);
    margin: 8px 0;
    border-radius: 0 6px 6px 0;
    font-size: 12.5px;
  }
  .markdown-body blockquote p { margin: 4px 0; }
  .error-box {
    color: var(--danger);
    font-family: var(--f-num);
    font-size: 12px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
    background: rgba(255,71,87,0.05);
    border: 1px solid rgba(255,71,87,0.2);
    border-radius: 8px;
    padding: 10px 12px;
  }

  /* ════════ 响应式桌面版 (>=768px) ════════ */
  @media (min-width: 768px) {
    body {
      padding-bottom: 100px;
      /* 桌面表格列宽，表头和卡片行共用一个变量，改一处两边同步，不会再走偏。
         “操作”列此前留了140px但行内只有一个小圆形展开箭头（真正的减仓/清仓按钮在展开面板里），
         白白挤占“名称”列的1fr空间，导致标的名称在桌面端被截断（手机版是纵向堆叠布局不受影响）。
         这里把code/qty/cost/date/action几列收紧，并给名称列一个minmax保底宽度。
         “实仓→目标”列按实测最长内容定宽：“实仓 100.00% → 目标 100.00%”在12px等宽字体下约182px，
         之前只给106px，连常规的“实仓 10.20% → 目标 10.00%”（约168px）都放不下，
         之前误以为只有“仓位待今日扫描确认”这个占位文案（约108px）超宽——实际这一列本身就没给够，
         从qty/cost/date几个明显有富余的定宽列（原72/84/100px，实际内容只需约42/35/70px）挪出空间补给它。 */
      --holdings-grid-cols: 92px minmax(130px, 1fr) 60px 195px 56px 86px 40px;
    }

    /* 桌面列表头 */
    .holdings-table-header {
      display: grid;
      grid-template-columns: var(--holdings-grid-cols);
      gap: 12px;
      padding: 10px 16px;
      margin: 0 12px;
      font-family: var(--f-num);
      font-size: 10px;
      color: var(--t3);
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    /* 卡片重构为表格行 */
    .holding-card .card-main {
      display: grid;
      grid-template-columns: var(--holdings-grid-cols);
      gap: 12px;
      align-items: center;
      padding: 12px 14px;
    }

    /* 桌面下显示列数据，隐藏移动端 meta */
    .card-col { display: flex; align-items: center; }
    .card-col-qty { font-family: var(--f-num); font-size: 13px; color: var(--t2); font-weight: 500; font-variant-numeric: tabular-nums; }
    .card-col-position { font-family: var(--f-num); font-size: 12px; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .card-col-cost { font-family: var(--f-num); font-size: 12px; color: var(--t3); font-variant-numeric: tabular-nums; }
    .card-col-date { font-family: var(--f-num); font-size: 12px; color: var(--t2); }
    .card-meta { display: none; }
    .card-code-cell { flex-direction: row; gap: 6px; }

    /* 抽屉居中限宽 */
    .drawer {
      left: 50%;
      right: auto;
      max-width: 480px;
      border-radius: 20px;
      transform: translate(-50%, 100%);
    }
    .drawer.open { transform: translate(-50%, 0); }
    .drawer-overlay { padding: 0; }

    /* max-w 放宽 */
    .max-w { max-width: 720px; }

    /* 卡片悬停 */
    .holding-card:hover {
      border-color: var(--bd2);
      box-shadow: var(--inset-hl), var(--shadow-md);
      transform: translateY(-1px);
    }
    .card-btn-add:hover { border-color: var(--accent); }
    .card-btn-reduce:hover { background: var(--bg4); }
    .card-btn-close:hover { background: rgba(255,71,87,0.1); }

    /* 桌面端按钮 hover 反馈 */
    .btn-primary:hover { opacity: 0.9; }
    .btn-ghost:hover { background: var(--bg3); }

    /* 折叠区桌面悬停 */
    .info-section summary:hover { background: var(--bg4); }
  }

  /* ════════ 执行 / 洞察分层与 iOS 触控优化 ════════ */
  .view-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 10px;
    padding: 4px;
    border: 1px solid var(--bd);
    border-radius: 11px;
    background: var(--bg2);
    box-shadow: var(--inset-hl), var(--shadow-sm);
  }
  .view-switch-btn {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
  }
  .view-switch-btn.is-active { background: var(--buy-bg); color: var(--accent); box-shadow: inset 0 0 0 1px var(--buy-bd); }
  .app-view:not([hidden]) { animation: view-enter 180ms ease-out both; }
  @keyframes view-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
  .recent-execution {
    margin: 8px 12px 16px;
    border: 1px solid var(--bd);
    border-radius: 10px;
    background: var(--bg2);
    overflow: hidden;
  }
  .recent-execution-head {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid var(--bd);
    color: var(--t2);
    font-family: var(--f-num);
    font-size: 11px;
  }
  .recent-execution-head button { min-height: 36px; border: 0; background: transparent; color: var(--accent); font: inherit; }
  .recent-execution-list { color: var(--t3); font-size: 12px; }
  .recent-execution-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--bd); }
  .recent-execution-row:last-child { border-bottom: 0; }
  .recent-execution-row strong { color: var(--accent); font-family: var(--f-num); font-size: 11px; }
  .recent-execution-row span { color: var(--t1); font-family: var(--f-num); font-size: 12px; }
  .recent-execution-row small { color: var(--t3); font-family: var(--f-num); font-size: 10px; }
  .operation-dialog, .drawer { scrollbar-gutter: stable; }
  .operation-dialog { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  button, [role="button"], select { min-height: 36px; }
  .btn, .card-btn, .reason-manual-btn, .json-download-btn { min-height: 40px; }

  @media (max-width: 767px) {
    body { padding-bottom: calc(88px + var(--sab)); }
    .topbar { padding-left: max(14px, var(--sal)); padding-right: max(14px, var(--sar)); }
    .topbar-clear { font-size: 10px; padding: 5px 7px; }
    .topbar-status { font-size: 10px; }
    .card-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; }
    .card-recommendation { grid-column: 2 / -1; flex-wrap: wrap; margin-top: 2px; }
    .card-recommendation small { max-width: 100%; }
    .operation-dialog { width: calc(100vw - max(24px, var(--sal)) - max(24px, var(--sar))); max-height: calc(100dvh - var(--sat) - var(--sab) - 24px); }
    .drawer { max-height: calc(100dvh - var(--sat) - 8px); padding-bottom: calc(28px + var(--sab)); }
    .drawer-actions { position: sticky; bottom: calc(-28px - var(--sab)); padding: 10px 0 calc(8px + var(--sab)); background: var(--bg2); }
    .fab { width: 52px; height: 52px; }
  }

  @media (min-width: 768px) {
    .view-switch { max-width: 720px; }
    .card-recommendation { display: none; }
    .recent-execution { max-width: 696px; margin-left: auto; margin-right: auto; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
  }
