/* Phone layout for v2 pages: bottom tabs 首页/T计划/记账/信号/更多 (no top bar), compact notes. */
@media (max-width: 1023px) {
    .app-shell .pro-sidebar { display: none; }                       /* page titles carry the context */
    .app-shell .pro-mobile-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch; }
    .app-shell .pro-mobile-nav-link { min-height: 52px; font-size: 0.6875rem; }
    .app-shell .pro-mobile-nav-mark { height: 1.5rem; min-width: 1.5rem; }
    .app-shell .pro-mobile-nav-mark svg { width: 1.35rem; height: 1.35rem; }
    .app-shell .pro-mobile-nav-link[data-nav="book"] .pro-mobile-nav-mark {
        width: 2.1rem; height: 2.1rem; margin-top: -0.2rem; border-radius: 999px;
        background: var(--v2-accent-strong, #1e40af); color: #fff; box-shadow: 0 6px 14px rgba(29, 78, 216, .28);
    }
    .app-shell .pro-mobile-nav-link[data-nav="book"] .pro-mobile-nav-mark svg { width: 1.15rem; height: 1.15rem; stroke-width: 2.4; }
    .app-shell .pro-mobile-nav-link[data-nav="book"][aria-current="page"] { background: transparent; }

    /* 更多: the tab opens a bottom sheet above the bar */
    .app-shell .pro-mobile-nav .pro-mobile-more { position: static; display: flex; margin: 0; }
    .app-shell .pro-mobile-nav .pro-mobile-more > summary.pro-mobile-nav-link {
        flex: 1; padding: 0; margin: 0 0.08rem; border: 0; background: transparent; line-height: 1.2;
        color: var(--app-muted); font-size: 0.6875rem; font-weight: 400; list-style: none;
    }
    .app-shell .pro-mobile-nav .pro-mobile-more > summary::-webkit-details-marker { display: none; }
    .app-shell .pro-mobile-more[data-current="true"] > summary.pro-mobile-nav-link,
    .app-shell .pro-mobile-more[open] > summary.pro-mobile-nav-link { background: var(--app-primary-soft); color: var(--app-primary); font-weight: 600; }
    .app-shell .pro-mobile-nav .pro-mobile-more-panel {
        top: auto; right: 0; left: 0; bottom: calc(100% + 0.5rem); width: auto; position: absolute;
        max-height: min(70vh, 560px); padding: 0.75rem 0.75rem 0.5rem; border-radius: 20px;
        background: var(--v2-card, #fff);
    }
    .app-shell .pro-mobile-more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .app-shell .pro-mobile-more-grid .pro-mobile-more-link {
        min-height: 46px; line-height: 46px; padding: 0 0.85rem; border-radius: 12px;
        background: var(--v2-hover, #f8fafc); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .app-shell .pro-mobile-more-section { padding: 0.75rem 0.25rem 0.4rem; text-transform: none; }
    .app-shell .pro-mobile-more-title { padding: 0.15rem 0.25rem 0.1rem; }
    .app-shell .pro-mobile-more-logout { margin-top: 0.75rem; padding: 0 0.25rem; }
}
@media (max-width: 1023px) and (prefers-color-scheme: dark) {
    .app-shell .pro-mobile-nav .pro-mobile-more-panel { background: var(--v2-card, var(--app-surface)); border-color: var(--v2-line, var(--app-border)); }
}

/* 随手笔记 on phones: one line (icon · ticker · 编辑); title and status come back while editing or on errors */
@media (max-width: 760px) {
    .app-shell .notes-banner {
        grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.55rem;
        margin-bottom: 0.9rem; padding: 0.45rem 0.5rem 0.45rem 0.7rem; border-radius: 14px; box-shadow: none;
    }
    .app-shell .notes-banner::before { top: 0.55rem; bottom: 0.55rem; }
    .app-shell .notes-banner__heading { grid-column: 1; grid-row: 1; gap: 0.6rem; }
    .app-shell .notes-banner__heading > .min-w-0 { display: none; }
    .app-shell .notes-banner__icon { width: 2rem; height: 2rem; border-radius: 10px; box-shadow: none; }
    .app-shell .notes-banner__icon svg { width: 1.1rem; height: 1.1rem; }
    .app-shell .notes-banner__marquee-viewport { grid-column: 2; grid-row: 1; height: 2.25rem; }
    .app-shell .notes-banner__edit { grid-column: 3; grid-row: 1; min-height: 2.25rem; padding: 0 0.8rem; }
    .app-shell .notes-banner__editor { grid-column: 1 / -1; grid-row: 2; }
    .app-shell .notes-banner:has(.notes-banner__editor:not([hidden])) .notes-banner__heading,
    .app-shell .notes-banner:has(.notes-banner__status.text-red-600) .notes-banner__heading { grid-column: 1 / 3; }
    .app-shell .notes-banner:has(.notes-banner__editor:not([hidden])) .notes-banner__heading > .min-w-0,
    .app-shell .notes-banner:has(.notes-banner__status.text-red-600) .notes-banner__heading > .min-w-0 { display: block; }
    .app-shell .notes-banner:has(.notes-banner__editor:not([hidden])) .notes-banner__marquee-viewport,
    .app-shell .notes-banner:has(.notes-banner__status.text-red-600) .notes-banner__marquee-viewport { display: none; }
}

/* Phone page headers: title left, actions right on one line */
@media (max-width: 760px) {
    .app-shell .v2-head { flex-direction: row; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
    .app-shell .v2-head > div:first-child { min-width: 0; flex: 1; }
    .app-shell .v2-head-actions { width: auto; flex-shrink: 0; gap: 6px; padding-top: 2px; }
    .app-shell .v2-head-actions .v2-btn { height: 34px; padding: 0 12px; font-size: 13px; }
    .app-shell .v2-head-actions .v2-btn--primary { margin-left: 0; }
    .app-shell .v2-title { font-size: 22px; line-height: 1.25; }
    .app-shell .v2-sub { font-size: 12px; }
    /* home: 记账 is the centre tab, so the header keeps only 刷新 */
    .app-dashboard .v2-head-actions a.v2-btn--primary[href*="book=1"] { display: none; }

    /* home: one summary card. 总市值 on top; 浮动盈亏 · 总成本 · 行情 underneath */
    .app-dashboard .v2-summary {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.25fr) minmax(0, .9fr); gap: 0 10px; margin-bottom: 12px; padding: 14px 16px;
        background: var(--v2-card); border: 1px solid var(--v2-line); border-radius: var(--v2-radius);
    }
    .app-dashboard .v2-stat { padding: 0; border: 0; border-radius: 0; background: none; }
    .app-dashboard .v2-stat:first-child { grid-column: 1 / -1; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--v2-line); }
    .app-dashboard .v2-stat:first-child .v2-stat-value { font-size: 28px; margin-top: 2px; }
    .app-dashboard .v2-stat:first-child .v2-stat-note { display: inline; margin-left: 2px; }
    .app-dashboard .v2-stat--pnl { order: 1; }
    .app-dashboard .v2-stat:nth-child(2) { order: 2; }
    .app-dashboard .v2-stat:nth-child(4) { order: 3; }
    .app-dashboard .v2-stat:not(:first-child) .v2-stat-label { font-size: 12px; gap: 4px; justify-content: flex-start; }
    .app-dashboard .v2-stat:not(:first-child) .v2-stat-value { font-size: 15px; margin-top: 4px; }
    .app-dashboard .v2-stat .v2-stat-value--sm { font-size: 13px; white-space: normal; line-height: 1.3; }
    .app-dashboard .v2-stat:not(:first-child) .v2-stat-note { font-size: 11px; margin-top: 2px; }
    .app-dashboard .v2-eye { padding: 0 7px; font-size: 11px; line-height: 18px; }
}

/* Classic page headers inside v2 pages (T计划, 推荐调仓, 成本历史 …): same one-line layout as v2 headers */
@media (max-width: 760px) {
    .lh-v2 .app-topbar {
        display: flex; flex-direction: row; align-items: flex-start; justify-content: space-between;
        gap: 10px; margin-bottom: 12px; text-align: left;
    }
    .lh-v2 .app-topbar > div:first-child { min-width: 0; flex: 1; }
    .lh-v2 .app-title { font-size: 22px; line-height: 1.25; text-align: left; }
    .lh-v2 .app-subtitle { margin-top: 2px; font-size: 12px; text-align: left; }
    .lh-v2 .app-nav { width: auto; flex: 0 0 auto; flex-wrap: nowrap; gap: 6px; margin: 0; padding-top: 2px; }
    .lh-v2 .app-nav > .app-button, .lh-v2 .app-nav > .app-nav-link, .lh-v2 .app-nav > form { flex: 0 0 auto; }
    .lh-v2 .app-nav .app-button, .lh-v2 .app-nav .app-nav-link { min-height: 34px; height: 34px; padding: 0 12px; font-size: 13px; }
    .lh-v2 .container { padding-top: 16px; }
}

/* offline copy banner and pull-to-refresh indicator (app-shell.js) */
.lh-offline-copy {
    margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5;
    background: var(--v2-warn-soft, #fffaeb); color: var(--v2-warn, #b54708); border: 1px solid rgba(181, 71, 8, .2);
}
.lh-pull {
    position: fixed; z-index: 70; top: 0; left: 50%; transform: translate(-50%, -60px); opacity: 0;
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px;
    background: var(--v2-card, #fff); color: var(--v2-muted, #64748b); font-size: 13px;
    border: 1px solid var(--v2-line, #e6eaf2); box-shadow: 0 6px 18px rgba(15, 35, 70, .14); pointer-events: none;
}
.lh-pull.is-armed, .lh-pull.is-loading { color: var(--v2-accent, #1d4ed8); }
.lh-pull__spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; }
.lh-pull.is-armed .lh-pull__spin { transform: rotate(180deg); }
.lh-pull.is-loading .lh-pull__spin { animation: lh-pull-spin .7s linear infinite; }
@keyframes lh-pull-spin { to { transform: rotate(360deg); } }
.lh-offline-copy.is-online { cursor: pointer; background: var(--v2-accent-soft, #eff6ff); color: var(--v2-accent, #1d4ed8); border-color: var(--v2-accent-line, #bfdbfe); }
.lh-has-offline-copy .lh-network-status { display: none; }
