#mobile-v2-root {
  display: none;
}

@media (max-width: 767px) {
  body.mobile-v2-primary .main,
  body.mobile-v2-primary #mobile-app-bar,
  body.mobile-v2-primary #mobile-bottom-nav,
  body.mobile-v2-primary #mobile-all-sheet,
  body.mobile-v2-primary #mobile-all-backdrop,
  body.mobile-v2-primary #mobile-detail-sheet,
  body.mobile-v2-primary #mobile-detail-backdrop,
  body.mobile-v2-primary > footer {
    display: none !important;
  }

  body.mobile-v2-primary #mobile-v2-root {
    display: block;
    width: 100%;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  }

  .m2-content {
    width: 100%;
    min-width: 0;
    min-height: 100dvh;
    box-sizing: border-box;
  }

  .m2-view {
    min-height: 100dvh;
  }

  .m2-appbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: calc(52px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 14px 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    box-sizing: border-box;
    background: var(--bg-elev-2);
    color: var(--fg);
  }

  .m2-brand {
    color: var(--fg-dim);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
  }

  .m2-session {
    justify-self: end;
    color: var(--green);
    font-size: 11px;
    white-space: nowrap;
  }

  .m2-page-body {
    padding: 12px 12px calc(76px + env(safe-area-inset-bottom));
  }

  .m2-market-hero {
    padding: 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--bg-elev-2), var(--bg-elev-1));
    color: var(--fg);
    box-shadow: var(--shadow-2);
  }

  .m2-hero-label {
    display: block;
    color: var(--fg-dim);
    font-size: 12px;
  }

  .m2-hero-value {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 4px;
  }

  .m2-hero-value strong {
    font-size: 27px;
    letter-spacing: -0.04em;
  }

  .m2-ticker {
    display: flex;
    gap: 7px;
    margin-top: 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .m2-ticker::-webkit-scrollbar {
    display: none;
  }

  .m2-ticker span {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 10px;
    white-space: nowrap;
  }

  .m2-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin: 10px 0 16px;
  }

  .m2-action {
    min-width: 0;
    min-height: 58px;
    padding: 8px 3px;
    border: 0;
    border-radius: 12px;
    background: var(--bg-elev-1);
    color: var(--fg);
    box-shadow: var(--shadow-1);
  }

  .m2-action > span {
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 18px;
  }

  .m2-action small {
    display: block;
    font-size: 10px;
  }

  .m2-section {
    margin-top: 14px;
  }

  .m2-section-head {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .m2-section-head strong {
    font-size: 14px;
  }

  .m2-section-head span,
  .m2-section-head button {
    border: 0;
    background: transparent;
    color: var(--fg-dim);
    font-size: 11px;
    white-space: nowrap;
  }

  .m2-alert-row,
  .m2-watch-row {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev-1);
    color: var(--fg);
    text-align: left;
  }

  .m2-alert-row {
    padding: 0 12px;
    border-left: 3px solid var(--warn);
    border-radius: 10px;
  }

  .m2-watch-list {
    overflow: hidden;
    border-radius: 12px;
    background: var(--bg-elev-1);
  }

  .m2-watch-row {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) 0.8fr 0.7fr;
    align-items: center;
    padding: 0 12px;
    white-space: nowrap;
  }

  .m2-watch-identity {
    display: block;
  }

  .m2-watch-identity strong,
  .m2-watch-identity small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m2-watch-identity small {
    margin-top: 2px;
    color: var(--fg-dim);
    font-size: 9px;
  }

  .m2-watch-row > .m2-num {
    text-align: right;
  }

  .m2-nowrap {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .m2-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .m2-rise {
    color: var(--red);
  }

  .m2-fall {
    color: var(--green);
  }

  .m2-market-hero .m2-rise {
    color: var(--red);
  }

  .m2-market-hero .m2-fall {
    color: var(--green);
  }

  .m2-empty,
  .m2-error {
    padding: 18px 12px;
    border-radius: 12px;
    background: var(--bg-elev-1);
    color: var(--fg-dim);
    font-size: 12px;
  }

  .m2-error {
    margin: 12px;
    display: grid;
    gap: 10px;
  }

  .m2-error strong {
    color: var(--fg);
  }

  .m2-error button {
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: var(--bg-elev-2);
    color: var(--fg);
  }

  .m2-skeleton-home {
    height: 420px;
    margin: 12px;
    border-radius: 16px;
    background: linear-gradient(90deg, var(--bg-elev-1) 25%, var(--bg-elev-2) 37%, var(--bg-elev-1) 63%);
    background-size: 400% 100%;
    animation: m2-shimmer 1.2s ease infinite;
  }

  .m2-refresh {
    justify-self: end;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--fg-muted);
    font-size: 11px;
  }

  .m2-market-body {
    padding: 10px 0 calc(72px + env(safe-area-inset-bottom));
  }

  .m2-search {
    height: 42px;
    margin: 0 12px 10px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 11px;
    background: var(--bg-elev-1);
    color: var(--fg-muted);
  }

  .m2-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--fg);
    font-size: 16px;
  }

  .m2-search-results {
    position: absolute;
    z-index: 30;
    left: 12px;
    right: 12px;
    max-height: 60dvh;
    overflow-y: auto;
    border-radius: 12px;
    background: var(--bg-elev-1);
    box-shadow: var(--shadow-2);
  }

  .m2-search-results > button {
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev-1);
    color: var(--fg);
  }

  .m2-search-results small {
    flex: 0 0 auto;
    color: var(--fg-dim);
  }

  .m2-market-tabs {
    display: flex;
    gap: 7px;
    padding: 0 12px 10px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .m2-market-tabs::-webkit-scrollbar {
    display: none;
  }

  .m2-market-tabs button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 13px;
    border: 0;
    border-radius: 18px;
    background: var(--bg-elev-1);
    color: var(--fg-muted);
    white-space: nowrap;
  }

  .m2-market-tabs button.active {
    background: var(--bg-elev-2);
    color: var(--fg);
  }

  .m2-quote-head,
  .m2-quote-row {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) 0.75fr 0.7fr 0.8fr;
    align-items: center;
  }

  .m2-quote-head {
    height: 28px;
    padding: 0 12px;
    color: var(--fg-dim);
    font-size: 10px;
  }

  .m2-quote-head span:not(:first-child),
  .m2-quote-row > span:not(:first-child) {
    text-align: right;
  }

  .m2-quote-list {
    overflow: hidden auto;
    background: var(--bg-elev-1);
  }

  .m2-quote-row {
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev-1);
    color: var(--fg);
    white-space: nowrap;
  }

  .m2-quote-row > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m2-quote-name strong,
  .m2-quote-name small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m2-quote-name small {
    margin-top: 2px;
    color: var(--fg-dim);
    font-size: 9px;
  }

  .m2-skeleton-list {
    height: 360px;
    background: repeating-linear-gradient(var(--bg-elev-1) 0 47px, var(--border) 47px 48px);
  }

  .m2-stock-appbar {
    min-height: calc(54px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 8px 0;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 54px;
    align-items: center;
    background: var(--bg-elev-2);
    color: var(--fg);
  }

  .m2-stock-appbar > button {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--fg-dim);
    font-size: 12px;
  }

  .m2-stock-appbar > button:first-child {
    font-size: 30px;
  }

  .m2-stock-appbar > div {
    min-width: 0;
    text-align: center;
  }

  .m2-stock-appbar strong,
  .m2-stock-appbar small {
    display: block;
  }

  .m2-stock-appbar small {
    margin-top: 2px;
    color: var(--fg-dim);
    font-size: 9px;
  }

  .m2-stock-body {
    padding: 12px 12px calc(76px + env(safe-area-inset-bottom));
  }

  .m2-stock-head {
    padding: 14px;
    border-radius: 14px;
    background: var(--bg-elev-1);
    box-shadow: var(--shadow-1);
  }

  .m2-stock-price {
    display: flex;
    align-items: baseline;
    gap: 10px;
  }

  .m2-stock-identity {
    min-width: 0;
    margin-bottom: 5px;
  }

  .m2-stock-identity strong,
  .m2-stock-identity small {
    display: block;
  }

  .m2-stock-identity small {
    margin-top: 2px;
    color: var(--fg-dim);
    font-size: 9px;
  }

  .m2-stock-price > strong {
    color: var(--fg);
    font-size: 27px;
  }

  .m2-stock-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

  .m2-stock-metrics span {
    min-width: 0;
  }

  .m2-stock-metrics small,
  .m2-stock-metrics strong {
    display: block;
  }

  .m2-stock-metrics small {
    color: var(--fg-dim);
    font-size: 9px;
  }

  .m2-stock-metrics strong {
    margin-top: 3px;
    font-size: 12px;
  }

  .m2-stock-tabs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 12px 0 8px;
    border-radius: 11px;
    background: var(--bg-elev-1);
  }

  .m2-stock-tabs button {
    min-width: 0;
    min-height: 40px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--fg-muted);
    font-size: 11px;
    white-space: nowrap;
  }

  .m2-stock-tabs button.active {
    background: var(--bg-elev-2);
    color: var(--fg);
  }

  .m2-stock-pane[hidden] {
    display: none;
  }

  .m2-stock-chart {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    background: var(--bg-elev-1);
    overflow: hidden;
  }

  .m2-kline-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }

  .m2-kline-adj-group {
    display: flex;
    gap: 6px;
  }

  .m2-kline-adj-btn {
    min-height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: var(--bg-elev-1);
    color: var(--fg-muted);
    font-size: 11px;
  }

  .m2-kline-adj-btn.active {
    background: var(--accent-bg);
    color: var(--accent);
  }

  .m2-kline-overlay-check {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
    color: var(--fg-dim);
    font-size: 11px;
  }

  .m2-kline-overlay-check input {
    width: 18px;
    height: 18px;
  }

  .m2-chip-stats {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-elev-1);
  }

  .m2-chip-stats[hidden] {
    display: none;
  }

  .m2-ai-toolbar {
    margin-bottom: 10px;
  }

  .m2-ai-run-btn {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
  }

  .m2-stock-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .m2-stock-card {
    min-width: 0;
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-elev-1);
  }

  .m2-stock-card > strong {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
  }

  .m2-book-line {
    min-height: 28px;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 4px;
    font-size: 9px;
  }

  .m2-book-line strong,
  .m2-book-line small {
    text-align: right;
  }

  .m2-profile-list {
    overflow: hidden;
    border-radius: 12px;
    background: var(--bg-elev-1);
  }

  .m2-profile-list > div {
    min-height: 46px;
    padding: 0 12px;
    display: grid;
    grid-template-columns: 1fr minmax(0, 1.5fr);
    align-items: center;
    border-bottom: 1px solid var(--border);
  }

  .m2-profile-list span {
    color: var(--fg-dim);
    font-size: 11px;
  }

  .m2-profile-list strong {
    text-align: right;
    font-size: 12px;
  }

  .m2-stock-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

  .m2-stock-actions button {
    min-height: 54px;
    border: 0;
    border-radius: 11px;
    background: var(--bg-elev-1);
    color: var(--accent);
    font-size: 17px;
  }

  .m2-stock-actions small {
    display: block;
    margin-top: 3px;
    color: var(--fg-muted);
    font-size: 9px;
  }

  @keyframes m2-shimmer {
    from { background-position: 100% 0; }
    to { background-position: 0 0; }
  }

  .m2-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    min-height: 56px;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-elev-1);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-2);
  }

  .m2-nav button {
    min-width: 0;
    min-height: 56px;
    border: 0;
    background: transparent;
    color: var(--fg-dim);
    font-size: 10px;
    white-space: nowrap;
  }

  .m2-nav button::before {
    content: attr(data-icon);
    display: block;
    margin-bottom: 3px;
    color: var(--fg-muted);
    font-size: 17px;
  }

  .m2-nav button.active,
  .m2-nav button.active::before {
    color: var(--accent);
  }

  .m2-secondary-body,
  .m2-more-body {
    padding: 12px 12px calc(76px + env(safe-area-inset-bottom));
  }

  .m2-secondary-summary {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--fg-dim);
    font-size: 10px;
  }

  .m2-secondary-summary strong {
    color: var(--fg);
    font-size: 14px;
  }

  .m2-workbench-list,
  .m2-portfolio-list {
    overflow: hidden;
    border-radius: 12px;
    background: var(--bg-elev-1);
  }

  .m2-workbench-row {
    width: 100%;
    min-height: 50px;
    padding: 0 12px;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) 0.8fr 0.7fr;
    align-items: center;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev-1);
    color: var(--fg);
    white-space: nowrap;
  }

  .m2-workbench-row > span {
    min-width: 0;
    text-align: right;
  }

  .m2-workbench-row > span:first-child {
    text-align: left;
  }

  .m2-workbench-row strong,
  .m2-workbench-row small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m2-workbench-row small {
    margin-top: 2px;
    color: var(--fg-dim);
    font-size: 9px;
  }

  .m2-secondary-link {
    width: 100%;
    min-height: 46px;
    margin-top: 10px;
    border: 0;
    border-radius: 11px;
    background: var(--bg-elev-1);
    color: var(--accent);
  }

  .m2-portfolio-hero {
    padding: 16px;
    margin-bottom: 10px;
    border-radius: 15px;
    background: var(--bg-elev-2);
    color: var(--fg);
  }

  .m2-portfolio-hero > span {
    color: var(--fg-dim);
    font-size: 10px;
  }

  .m2-portfolio-hero > strong {
    display: block;
    margin: 4px 0 10px;
    font-size: 25px;
  }

  .m2-portfolio-hero > div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 10px;
    white-space: nowrap;
  }

  .m2-more-group {
    margin-bottom: 16px;
  }

  .m2-more-group > strong {
    display: block;
    margin: 0 2px 7px;
    color: var(--fg-dim);
    font-size: 11px;
  }

  .m2-more-group > div {
    overflow: hidden;
    border-radius: 12px;
    background: var(--bg-elev-1);
  }

  .m2-more-group button {
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev-1);
    color: var(--fg);
    text-align: left;
  }

  .m2-more-group button small {
    color: var(--fg-muted);
    font-size: 17px;
  }

  @media (prefers-reduced-motion: reduce) {
    .m2-skeleton-home {
      animation: none !important;
    }
  }
}
