/* LH v2 design tokens and building blocks, shared by all v2 pages. Red = gain, green = loss. */
.lh-v2 {
    --v2-bg: #f5f7fb;
    --v2-card: #ffffff;
    --v2-line: #e6eaf2;
    --v2-text: #0f172a;
    --v2-muted: #64748b;
    --v2-faint: #94a3b8;
    --v2-accent: #1d4ed8;
    --v2-up: #d92d20;
    --v2-down: #079455;
    --v2-warn: #b54708;
    --v2-radius: 14px;
    --v2-line-strong: #cbd5e1;
    --v2-hover: #f8fafc;              /* row hover, quiet fills */
    --v2-subtle: #fbfcfe;             /* nested panels */
    --v2-track: #eef2f7;              /* bars, meters */
    --v2-accent-strong: #1e40af;      /* primary button hover */
    --v2-accent-soft: #eff6ff;
    --v2-accent-line: #bfdbfe;
    --v2-up-soft: #fef3f2;
    --v2-down-soft: #ecfdf3;
    --v2-warn-soft: #fffaeb;
    --v2-buy: #15803d;                /* plan buy / reduce colours (classic plan cards) */
    --v2-sell: #b91c1c;
    --v2-teal: #0f766e;
    --v2-teal-soft: #f0fdfa;
    --v2-teal-line: #99f6e4;
    --v2-backdrop: rgba(15, 23, 42, .35);
    font-variant-numeric: tabular-nums;
}
/* Dark scheme follows the phone/computer setting. Red = gain, green = loss in both. */
@media (prefers-color-scheme: dark) {
    .lh-v2 {
        --v2-bg: #0b1220;
        --v2-card: #121b2d;
        --v2-line: rgba(148, 163, 184, .18);
        --v2-line-strong: rgba(148, 163, 184, .34);
        --v2-text: #e6edf7;
        --v2-muted: #9aa9c3;
        --v2-faint: #6f7f99;
        --v2-accent: #6aa6ff;
        --v2-accent-strong: #2f6fe0;
        --v2-up: #ff6b61;
        --v2-down: #3ccf8e;
        --v2-warn: #f5ad42;
        --v2-hover: rgba(148, 163, 184, .08);
        --v2-subtle: #0f1828;
        --v2-track: rgba(148, 163, 184, .18);
        --v2-accent-soft: rgba(106, 166, 255, .14);
        --v2-accent-line: rgba(106, 166, 255, .42);
        --v2-up-soft: rgba(255, 107, 97, .14);
        --v2-down-soft: rgba(60, 207, 142, .14);
        --v2-warn-soft: rgba(245, 173, 66, .14);
        --v2-buy: #3ccf8e;
        --v2-sell: #ff6b61;
        --v2-teal: #4fd1c5;
        --v2-teal-soft: rgba(79, 209, 197, .13);
        --v2-teal-line: rgba(79, 209, 197, .4);
        --v2-backdrop: rgba(0, 0, 0, .55);
        color-scheme: dark;
    }
    .lh-v2 .v2-btn--primary { background: var(--v2-accent-strong); border-color: var(--v2-accent-strong); }
    .lh-v2 .v2-btn--primary:hover { background: #3b7bea; }
    .lh-v2 .app-button--primary, .lh-v2 .app-nav-link--primary { background: var(--v2-accent-strong); }
    .lh-v2 .app-button--primary:hover, .lh-v2 .app-nav-link--primary:hover { background: #3b7bea; }
    .lh-v2 .ledger-chart-svg text[data-value-label] { stroke: var(--v2-card); }
    .lh-v2 .ledger-chart-svg text[data-value-label="cost"] { fill: var(--v2-accent); }
    .lh-v2 .ledger-chart-svg text[data-value-label="shares"] { fill: var(--v2-teal); }
    /* utility colours the shared dark block in app.css does not cover */
    .app-shell .bg-gray-200 { background-color: var(--v2-track); }
    .app-shell .bg-emerald-50 { background-color: var(--v2-down-soft); }
    .app-shell .text-emerald-700 { color: var(--v2-down); }
    .app-shell .text-red-500 { color: var(--v2-up); }
    .app-shell .border-red-100, .app-shell .border-red-200 { border-color: rgba(255, 107, 97, .3); }
    .app-shell .border-green-100, .app-shell .border-emerald-200 { border-color: rgba(60, 207, 142, .3); }
    .app-shell .border-amber-200 { border-color: rgba(245, 173, 66, .32); }
    .app-shell .border-blue-100 { border-color: var(--v2-accent-line); }
    .app-shell .app-surface { background: var(--v2-card); border-color: var(--v2-line); }
    .lh-v2 input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), .lh-v2 select, .lh-v2 textarea {
        background-color: var(--v2-subtle); color: var(--v2-text); border-color: var(--v2-line-strong);
    }
    .lh-v2 input::placeholder, .lh-v2 textarea::placeholder { color: var(--v2-faint); }
}
.lh-v2 .pro-main { background: var(--v2-bg); }
.v2-page { max-width: 1320px; margin: 0 auto; padding: 28px 28px 48px; color: var(--v2-text); }
.v2-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.v2-title { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.v2-sub { margin: 4px 0 0; color: var(--v2-muted); font-size: 13px; }
.v2-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.v2-btn {
    display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 10px;
    border: 1px solid var(--v2-line); background: var(--v2-card); color: var(--v2-text);
    font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.v2-btn:hover { border-color: var(--v2-line-strong); }
.v2-btn--primary { background: var(--v2-accent); border-color: var(--v2-accent); color: #fff; }
.v2-btn--primary:hover { background: var(--v2-accent-strong); }
.v2-btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.v2-link { color: var(--v2-accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.v2-link:hover { text-decoration: underline; }
.v2-card { background: var(--v2-card); border: 1px solid var(--v2-line); border-radius: var(--v2-radius); padding: 18px; min-width: 0; }
.v2-card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.v2-card-head { flex-wrap: wrap; gap: 4px 12px; }
.v2-card-head h2 { white-space: nowrap; }
.v2-card-head h2 { font-size: 16px; font-weight: 700; margin: 0; }
.v2-hint { color: var(--v2-faint); font-size: 12px; margin: 10px 2px 0; }
.v2-empty { color: var(--v2-faint); font-size: 14px; padding: 18px 4px; list-style: none; }
.up { color: var(--v2-up); }
.down { color: var(--v2-down); }
@media (max-width: 760px) {
    .v2-page { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
    .v2-head { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 14px; }
    .v2-head-actions { width: 100%; }
    .v2-head-actions .v2-btn--primary { margin-left: auto; }
    .v2-title { font-size: 24px; }
    .v2-card { padding: 14px; }
}

/* classic page headers inside the v2 frame: keep actions and the 经典版 link on one line */
.lh-v2 .app-topbar { align-items: center; }

/* Skeleton rows shown until the data for a list arrives (the page script replaces them) */
.v2-skel { display: grid; gap: 14px; padding: 12px 4px; list-style: none; }
.v2-skel i {
    display: block; height: 12px; border-radius: 6px;
    background: linear-gradient(90deg, var(--v2-track) 25%, var(--v2-hover) 50%, var(--v2-track) 75%);
    background-size: 200% 100%; animation: v2-shimmer 1.3s linear infinite;
}
.v2-skel i:nth-child(3n+2) { width: 82%; }
.v2-skel i:nth-child(3n+3) { width: 64%; }
@keyframes v2-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .v2-skel i { animation: none; } }
