/* Mobile APP shell — loaded only for app; rules scoped under html.is-mobile where needed */

/* ===== Base shell ===== */
html.is-mobile {
  --header-h: 48px;
  --header-main-h: 48px;
  --announcement-h: 0px;
  --m-tabbar-h: 56px;
}

html.is-mobile .th-full { display: none; }
html.is-mobile .th-short { display: inline; }

html.is-mobile .header {
  height: auto;
  min-height: var(--header-main-h);
  padding: 0;
  gap: 0;
  overflow: visible;
}

html.is-mobile .header-main {
  height: var(--header-main-h);
  padding: 0 10px 0 12px;
  gap: 8px;
}

html.is-mobile .header .tabs { display: none; }

html.is-mobile .header-controls {
  gap: 6px;
  width: 100%;
  justify-content: flex-end;
}

html.is-mobile .header-controls::before {
  content: "量化复盘系统";
  margin-right: auto;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}

html.is-mobile .theme-picker,
html.is-mobile #btnRedeem,
html.is-mobile #btnAdmin,
html.is-mobile #btnLogout,
html.is-mobile .user-bar-status,
html.is-mobile .date-picker-label,
html.is-mobile .theme-picker-label,
html.is-mobile .user-menu-toggle,
html.is-mobile .user-menu {
  display: none !important;
}

html.is-mobile .user-bar {
  display: none !important;
}

html.is-mobile .date-picker-trigger {
  min-width: 0;
  padding: 4px 8px;
  font-size: 13px;
}

html.is-mobile .panel {
  padding: 0 8px;
}

html.is-mobile .auth-card {
  max-width: 100%;
  border-radius: 16px;
  padding: 28px 20px;
}

html.is-mobile .kline-stock-list {
  display: none !important;
}

html.is-mobile .rank-dock,
html.is-mobile .rank-dock-split {
  display: none !important;
}

/* ===== Legacy toolbar hosts (filters live in .m-filter-sheet) ===== */
html.is-mobile .m-panel-tools {
  display: none !important;
}

html.is-mobile .m-tool-btn {
  flex: 1 1 calc(50% - 8px);
  height: 34px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  border-radius: 8px;
  font-size: 13px;
}

html.is-mobile .m-tool-btn.is-on {
  border-color: var(--accent);
  color: var(--accent2);
  background: rgba(82, 65, 159, 0.18);
}

html.is-mobile #stockToolbarToggle,
html.is-mobile #intradayToolbarToggle { display: none; }

html.is-mobile #priceViewHost,
html.is-mobile #specialFactorHost,
html.is-mobile #colTogglesHost,
html.is-mobile #intradayPriceViewHost,
html.is-mobile #intradaySpecialFactorHost,
html.is-mobile #intradayColTogglesHost {
  display: none;
}

html.is-mobile .th-filter-trigger {
  display: none;
}

html.is-mobile #stockToolbarBody,
html.is-mobile #intradayToolbarBody {
  display: none;
}

html.is-mobile .m-sub-panel,
html.is-mobile .m-cols-panel {
  display: none;
}

/* ===== Toolbar / filters inside sheets ===== */
html.is-mobile .toolbar {
  padding: 0 0 8px;
  gap: 8px;
}

html.is-mobile #panel-environment .toolbar,
html.is-mobile #panel-direction .toolbar,
html.is-mobile #panel-mode .toolbar {
  flex-direction: column;
  align-items: stretch;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 0 10px;
  margin: 0;
  gap: 8px;
}

html.is-mobile .dataset-chips {
  display: flex;
  width: 100%;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

html.is-mobile .dataset-chips::-webkit-scrollbar {
  display: none;
}

html.is-mobile .dataset-chip {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  padding: 8px 12px;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--muted);
  text-align: center;
}

html.is-mobile .dataset-chip.is-active {
  color: var(--text);
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(82, 65, 159, 0.28);
  font-weight: 600;
}

html.is-mobile #envSearch,
html.is-mobile #directionSearch,
html.is-mobile #modeSearch {
  width: 100%;
  min-width: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 8px 4px;
  box-shadow: none;
}

html.is-mobile .toolbar-row,
html.is-mobile .toolbar-row-content,
html.is-mobile .board-filters {
  flex-wrap: wrap;
  overflow: visible;
  width: 100%;
}

html.is-mobile .toolbar-row-content {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

html.is-mobile #stockSearch.input,
html.is-mobile #intradaySearch.input {
  width: 100%;
  min-width: 0;
  flex: none;
}

html.is-mobile .board-filters {
  gap: 8px 12px;
}

html.is-mobile .toolbar-menu-wrap {
  display: none;
}

html.is-mobile .board-toggle-divider {
  padding-left: 0;
  border-left: none;
}

html.is-mobile .price-view-filter {
  padding: 8px;
}

html.is-mobile .price-view-filter-line,
html.is-mobile .special-factor-filter .price-view-filter-line {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

html.is-mobile .price-view-filter-head-row {
  flex-wrap: wrap;
}

html.is-mobile .filter-current-hint {
  flex: 1 1 100%;
  order: 3;
  white-space: normal;
}

html.is-mobile .price-view-filter-groups {
  flex-direction: column;
  align-items: stretch;
  overflow: visible;
  gap: 8px;
}

html.is-mobile .price-view-filter-group {
  flex-wrap: wrap;
  flex-shrink: 1;
  width: 100%;
  align-items: flex-start;
}

html.is-mobile .price-view-filter-label {
  width: 100%;
}

html.is-mobile .price-view-filter-tags {
  flex-wrap: wrap;
  flex-shrink: 1;
  gap: 6px;
}

html.is-mobile .price-view-filter-sep {
  display: none;
}

html.is-mobile .price-view-reset {
  padding: 6px 12px;
  font-size: 13px;
  min-height: 32px;
}

html.is-mobile .col-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

html.is-mobile .col-toggles-title {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

html.is-mobile .col-toggle {
  font-size: 13px;
  min-height: 28px;
}

/* ===== Selection / intraday layout ===== */
/* 锁定视口：只让 table-wrap 纵向滚动，表头才能 sticky */
html.is-mobile body:has(#mainApp:not(.hidden)) {
  height: 100%;
  overflow: hidden;
  padding-bottom: 0;
}

html.is-mobile main {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--header-h) - var(--m-tabbar-h) - env(safe-area-inset-bottom, 0px));
  max-height: calc(100dvh - var(--header-h) - var(--m-tabbar-h) - env(safe-area-inset-bottom, 0px));
  padding: 6px 0 0;
  overflow: hidden;
  box-sizing: border-box;
}

html.is-mobile #mMarketChrome,
html.is-mobile #mRankChrome {
  flex-shrink: 0;
  padding-left: 8px;
  padding-right: 8px;
}

/* 非行情页：在 main 内滚动 */
html.is-mobile #panel-jingsuan.active,
html.is-mobile #panel-environment.active,
html.is-mobile #panel-direction.active,
html.is-mobile #panel-mode.active,
html.is-mobile #panel-greentrack.active,
html.is-mobile #panel-jwtrack.active,
html.is-mobile #panel-hpqbtrack.active,
html.is-mobile #panel-yxtrack.active,
html.is-mobile #panel-livechannel.active,
html.is-mobile #panel-monthlytrack.active,
html.is-mobile #panel-m-track.active,
html.is-mobile #panel-m-mine.active {
  flex: 1 1 0%;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

html.is-mobile #panel-selection.active,
html.is-mobile #panel-intraday.active {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 8px;
}

html.is-mobile #panel-selection .selection-layout {
  flex: 1 1 0%;
  flex-direction: column;
  height: auto;
  min-height: 0;
  max-height: none;
  gap: 6px;
  overflow: hidden;
}

html.is-mobile #panel-selection .sidebar.selection-sidebar {
  display: none;
}

html.is-mobile #panel-selection .content,
html.is-mobile #panel-intraday .content {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

html.is-mobile #panel-selection .toolbar,
html.is-mobile #panel-intraday .toolbar,
html.is-mobile #blockFilterBar,
html.is-mobile #tagFilterBar,
html.is-mobile #intradayBlockFilterBar,
html.is-mobile #intradayTagFilterBar,
html.is-mobile #stockScrollStatus,
html.is-mobile #intradayScrollStatus {
  flex-shrink: 0;
}

/* 筛选已进 Sheet，空工具栏不要留圆角黑框 */
html.is-mobile #stockToolbar,
html.is-mobile #intradayToolbar {
  display: none !important;
}

html.is-mobile #panel-selection .table-wrap,
html.is-mobile #panel-intraday .table-wrap {
  flex: 1 1 0%;
  height: auto;
  max-height: none;
  min-height: 160px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

html.is-mobile #panel-intraday .pz-warning-table-wrap.table-wrap,
html.is-mobile #panel-intraday .pz-warning-table-wrap {
  flex: 0 0 auto;
  max-height: min(110px, 16vh);
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2, #1a1a1a);
}

html.is-mobile .pz-warning-panel {
  max-height: min(180px, 26vh);
  margin: 4px 8px;
  padding: 4px 8px 6px;
}

html.is-mobile .table-wrap {
  border-radius: 0;
  -webkit-overflow-scrolling: touch;
}

/* ===== Compact tables + sticky name column ===== */
html.is-mobile #stockTable,
html.is-mobile #intradayTable {
  font-size: 13px;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

/* 避免 thead + th 双 sticky 冲突，只让 th 吸顶 */
html.is-mobile #stockTable thead,
html.is-mobile #intradayTable thead {
  position: static;
}

html.is-mobile #stockTable thead th,
html.is-mobile #intradayTable thead th {
  padding: 8px 8px;
  font-size: 11px;
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: var(--table-head-bg);
}

html.is-mobile #stockTable tbody td,
html.is-mobile #intradayTable tbody td {
  padding: 10px 8px;
  height: 56px;
}

/* 隐藏排序/独立代码列，名称列 left:0，避免原先 left:26px 留空 */
html.is-mobile #stockTable [data-col="idx"],
html.is-mobile #intradayTable [data-col="idx"],
html.is-mobile #stockTable [data-col="stock_code"],
html.is-mobile #intradayTable [data-col="stock_code"] {
  display: none !important;
}

/* 表体名称列：仅左右吸边 */
html.is-mobile #stockTable tbody .cell-name,
html.is-mobile #intradayTable tbody .cell-name {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  padding: 10px 6px;
  overflow: hidden;
  background-color: var(--table-row-bg);
  background-clip: padding-box;
  box-shadow:
    1px 0 0 0 var(--table-row-bg),
    8px 0 10px -4px rgba(0, 0, 0, 0.35);
}

html.is-mobile #stockTable tbody tr:nth-child(even) .cell-name,
html.is-mobile #intradayTable tbody tr:nth-child(even) .cell-name {
  background-color: var(--table-row-alt);
  box-shadow:
    1px 0 0 0 var(--table-row-alt),
    8px 0 10px -4px rgba(0, 0, 0, 0.35);
}

/* 表头名称列：左上角双 sticky，上拉不丢列名 */
html.is-mobile #stockTable thead th[data-col="stock_name"],
html.is-mobile #intradayTable thead th[data-col="stock_name"] {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 10;
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  padding: 8px 6px;
  overflow: hidden;
  background-color: var(--table-head-bg);
  box-shadow:
    1px 0 0 0 var(--table-head-bg),
    8px 0 10px -4px rgba(0, 0, 0, 0.35);
}

html.is-mobile #stockTable .xc-stock-cell,
html.is-mobile #intradayTable .xc-stock-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

html.is-mobile #stockTable .xc-stock-name,
html.is-mobile #intradayTable .xc-stock-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.is-mobile #stockTable .xc-stock-code,
html.is-mobile #intradayTable .xc-stock-code {
  display: block;
  font-size: 10px;
  color: var(--muted, #8a8784);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.is-mobile #stockTable .cell-metric,
html.is-mobile #stockTable .cell-pct,
html.is-mobile #intradayTable .cell-metric,
html.is-mobile #intradayTable .cell-pct {
  min-width: 72px;
  font-size: 14px;
}

html.is-mobile #panel-selection .table-wrap,
html.is-mobile #panel-intraday .table-wrap {
  display: block;
  flex: 1 1 0%;
  min-height: 0;
}

html.is-mobile .m-stock-cards {
  display: none !important;
}

/* ===== Bottom tabbar (5 tabs) + safe area ===== */
html.is-mobile .m-tabbar {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  height: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 4px 2px env(safe-area-inset-bottom, 0px);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  box-sizing: border-box;
}

html.is-mobile .m-tabbar-item {
  flex: 1 1 0;
  min-width: 0;
  border: none;
  background: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  line-height: 1.15;
  padding: 4px 1px;
  position: relative;
}

html.is-mobile .m-tabbar-item .live-tab-update-badge {
  left: auto;
  right: 0;
  top: 1px;
  transform: none;
  font-size: 8px;
  font-weight: 600;
  padding: 0 3px;
  line-height: 1.35;
}

html.is-mobile .m-tabbar-item.active .live-tab-update-badge {
  background: #dc2626;
  color: #fff;
}

html.is-mobile .m-tabbar-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.is-mobile .m-tabbar-item svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}

html.is-mobile .m-tabbar-item.active {
  color: var(--accent2);
}

html.is-mobile #authGate:not(.hidden) ~ .m-tabbar,
html.is-mobile #authGate:not(.hidden) ~ .m-sheet,
html.is-mobile #authGate:not(.hidden) ~ .m-filter-sheet {
  display: none !important;
}

/* ===== Legacy more sheet (kept for compatibility) ===== */
html.is-mobile .m-sheet {
  display: block;
}

html.is-mobile .m-sheet.hidden { display: none; }

html.is-mobile .m-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(0, 0, 0, 0.45);
}

html.is-mobile .m-sheet-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 141;
  background: var(--bg2);
  border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

html.is-mobile .m-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 6px auto 12px;
}

html.is-mobile .m-sheet-title {
  font-size: 16px;
  margin-bottom: 12px;
}

html.is-mobile .m-sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

html.is-mobile .m-sheet-item {
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  border-radius: 10px;
  padding: 14px 10px;
  font-size: 14px;
}

html.is-mobile .m-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

html.is-mobile .m-sheet-link {
  color: var(--accent2);
  background: none;
  border: none;
  font-size: 14px;
  text-decoration: none;
}

/* ===== Shared segment / chrome controls ===== */
html.is-mobile .m-seg {
  display: flex;
  gap: 0;
  padding: 2px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
}

html.is-mobile .m-seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 6px;
  min-height: 32px;
}

html.is-mobile .m-seg-btn.active {
  background: var(--bg2);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

html.is-mobile .m-chrome-btn {
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px;
  min-height: 34px;
  white-space: nowrap;
}

html.is-mobile .m-chrome-btn.is-on,
html.is-mobile .m-chrome-btn.active {
  border-color: var(--accent);
  color: var(--accent2);
  background: rgba(82, 65, 159, 0.18);
}

/* ===== Market chrome: 竞价/盘中 + filter + TOP5 ===== */
html.is-mobile .m-market-chrome {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0 2px 8px;
}

html.is-mobile .m-market-chrome-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

html.is-mobile .m-market-chrome .m-seg {
  flex: 1;
  min-width: 0;
}

html.is-mobile .m-snapshot-chrome {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 2px 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

html.is-mobile .m-snapshot-chrome.hidden {
  display: none !important;
}

html.is-mobile .m-snapshot-chrome-label {
  white-space: nowrap;
}

html.is-mobile .m-snapshot-chrome .snapshot-select {
  min-width: 72px;
  max-width: 96px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 2px;
  min-height: 30px;
}

html.is-mobile .m-snapshot-chrome .snapshot-latest {
  margin-left: 4px;
  font-size: 11px;
  color: #ea580c;
}

html.is-mobile .m-view-toggle {
  display: none !important;
}

html.is-mobile .m-top5-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

html.is-mobile .m-top5-strip::-webkit-scrollbar {
  display: none;
}

html.is-mobile .m-top5-strip.hidden,
html.is-mobile.m-top5-off .m-top5-strip {
  display: none !important;
}

html.is-mobile .m-top5-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
  width: max-content;
  min-width: 132px;
  max-width: none;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  text-align: left;
  line-height: 1.35;
  font-size: 13px;
  font-weight: 400;
  white-space: normal;
}

html.is-mobile .m-top5-chip-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

html.is-mobile .m-top5-chip-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 14em;
}

html.is-mobile .m-top5-chip-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}

html.is-mobile .m-top5-chip-pct {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ===== Rank chrome: 环境/方向/模式 fullscreen ===== */
html.is-mobile .m-rank-chrome {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0 2px;
}

html.is-mobile #panel-environment,
html.is-mobile #panel-direction,
html.is-mobile #panel-mode {
  min-height: calc(100dvh - var(--header-h) - var(--m-tabbar-h) - env(safe-area-inset-bottom, 0px) - 16px);
  padding: 0 0 12px;
}

html.is-mobile #panel-environment .table-wrap,
html.is-mobile #panel-direction .table-wrap,
html.is-mobile #panel-mode .table-wrap,
html.is-mobile #panel-environment .dataset-tables,
html.is-mobile #panel-direction .dataset-tables,
html.is-mobile #panel-mode .dataset-tables,
html.is-mobile #envTableWrap,
html.is-mobile #directionTableWrap,
html.is-mobile #modeTableWrap {
  max-height: none;
  height: auto;
  min-height: 240px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  cursor: default;
  border: none;
  border-radius: 0;
  background: transparent;
  /* 隐藏粗滚动条，右侧不挤一坨灰条 */
  scrollbar-width: none;
}

html.is-mobile #envTableWrap::-webkit-scrollbar,
html.is-mobile #directionTableWrap::-webkit-scrollbar,
html.is-mobile #modeTableWrap::-webkit-scrollbar,
html.is-mobile .dataset-block-table::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* 手机排名：一标签只显示一列，占满宽度 */
html.is-mobile #envTablesContainer,
html.is-mobile #directionTablesContainer,
html.is-mobile #modeTablesContainer {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 0;
  padding-bottom: 0;
}

html.is-mobile .dataset-block {
  width: 100%;
  min-width: 0;
  max-width: none;
  flex: none;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

html.is-mobile .dataset-block-label {
  display: none;
}

html.is-mobile .dataset-block-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border: none;
}

html.is-mobile .dataset-block table {
  width: 100%;
  min-width: 0;
}

html.is-mobile .dataset-block th,
html.is-mobile .dataset-block td {
  padding-left: 8px;
  padding-right: 8px;
}

html.is-mobile .dataset-block th:last-child,
html.is-mobile .dataset-block td:last-child {
  padding-right: 14px;
}

/* ===== Mobile-only panels ===== */
html.is-mobile #panel-m-track.active,
html.is-mobile #panel-m-mine.active {
  display: block;
}

/* ===== Track hub ===== */
html.is-mobile .m-track-hub {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 4px 16px;
}

html.is-mobile .m-track-hub.hidden { display: none; }

html.is-mobile .m-track-hub-title {
  margin: 4px 0 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

html.is-mobile .m-track-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg3);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}

html.is-mobile .m-track-entry::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-top: 2px solid var(--muted);
  transform: rotate(45deg);
  opacity: 0.7;
}

html.is-mobile .m-track-entry-desc {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

/* ===== Mine panel ===== */
html.is-mobile .m-mine-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 4px 24px;
}

html.is-mobile .m-mine-panel.hidden { display: none; }

html.is-mobile .m-mine-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg2);
}

html.is-mobile .m-mine-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}

html.is-mobile .m-mine-row:hover {
  background: color-mix(in srgb, var(--bg3) 80%, transparent);
}

html.is-mobile .m-mine-row-static {
  cursor: default;
}

html.is-mobile .m-mine-row-static:hover {
  background: transparent;
}

html.is-mobile .m-mine-row:last-child {
  border-bottom: none;
}

html.is-mobile .m-mine-row-label {
  font-weight: 600;
}

html.is-mobile .m-mine-row-value,
html.is-mobile .m-mine-row-hint {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

html.is-mobile .m-mine-switch {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  border: none;
  background: var(--bg3);
  flex-shrink: 0;
  padding: 0;
}

html.is-mobile .m-mine-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.15s ease;
}

html.is-mobile .m-mine-switch.is-on {
  background: var(--accent);
}

html.is-mobile .m-mine-switch.is-on::after {
  transform: translateX(18px);
  background: #fff;
}

html.is-mobile .m-mine-danger {
  color: #f07178;
}

/* ===== Filter fullscreen sheet ===== */
html.is-mobile .m-filter-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 145;
}

html.is-mobile .m-filter-sheet:not(.hidden) {
  display: flex;
  flex-direction: column;
}

html.is-mobile .m-filter-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

html.is-mobile .m-filter-sheet-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100%;
  background: var(--bg);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

html.is-mobile .m-filter-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

html.is-mobile .m-filter-sheet-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

html.is-mobile .m-filter-sheet-close {
  border: none;
  background: none;
  color: var(--accent2);
  font-size: 15px;
  font-weight: 600;
  padding: 6px 4px;
  min-height: 36px;
}

html.is-mobile .m-filter-sheet-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

html.is-mobile .m-filter-sheet-body .price-view-filter,
html.is-mobile .m-filter-sheet-body .special-factor-filter,
html.is-mobile .m-filter-sheet-body .col-toggles,
html.is-mobile .m-filter-sheet-body .board-filters,
html.is-mobile .m-filter-sheet-body #stockToolbarBody,
html.is-mobile .m-filter-sheet-body #intradayToolbarBody,
html.is-mobile .m-filter-sheet-body .m-sub-panel,
html.is-mobile .m-filter-sheet-body .m-cols-panel {
  display: block;
  max-height: none;
  overflow: visible;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg2);
}

html.is-mobile .m-filter-sheet-body .m-sub-panel,
html.is-mobile .m-filter-sheet-body .m-cols-panel {
  display: block !important;
}

html.is-mobile .m-filter-sheet-body #stockToolbarBody,
html.is-mobile .m-filter-sheet-body #intradayToolbarBody {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
}

/* ===== Track / compare tables ===== */
html.is-mobile .green-track-table,
html.is-mobile .monthly-compare-table,
html.is-mobile .sim-day-table,
html.is-mobile #positionTable {
  min-width: 720px;
}

html.is-mobile .green-track-summary {
  overflow-x: auto;
  flex-wrap: nowrap;
}

html.is-mobile .green-track-stat {
  min-width: 150px;
  flex: 0 0 160px;
}

html.is-mobile .sim-track-months {
  overflow-x: visible;
}

html.is-mobile .sim-month-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
  font-size: 12px;
}

html.is-mobile .sim-month-table th,
html.is-mobile .sim-month-table td {
  padding: 8px 4px;
  white-space: nowrap;
}

html.is-mobile .sim-month-table th:nth-child(1),
html.is-mobile .sim-month-table td:nth-child(1) {
  width: 22%;
  text-align: left;
}

html.is-mobile .sim-month-table th:nth-child(2),
html.is-mobile .sim-month-table td:nth-child(2),
html.is-mobile .sim-month-table th:nth-child(3),
html.is-mobile .sim-month-table td:nth-child(3) {
  width: 16%;
}

html.is-mobile .sim-month-table .sim-month-wide {
  display: none;
}

html.is-mobile .sim-month-sub {
  display: table-row;
}

html.is-mobile .sim-month-sub td {
  text-align: left;
  white-space: normal;
  font-size: 11px;
  color: var(--muted);
  padding: 0 4px 8px;
  border-top: none;
  line-height: 1.45;
}

html.is-mobile .sim-month-table .monthly-total-row td {
  border-top: 1px solid var(--border);
}

/* ===== K-line / date picker ===== */
html.is-mobile .kline-panel .modal-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title actions"
    "sub sub"
    "view view"
    "controls controls";
  align-items: center;
  gap: 6px 8px;
  padding: 10px 12px;
}

html.is-mobile .kline-title-wrap {
  grid-area: title;
  display: block;
  min-width: 0;
  overflow: hidden;
}

html.is-mobile .kline-panel .modal-header h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  writing-mode: horizontal-tb !important;
  word-break: keep-all;
  max-width: 100%;
}

html.is-mobile .kline-subtitle {
  grid-area: sub;
  display: block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--muted);
}

html.is-mobile .kline-mobile-view-toggle {
  grid-area: view;
  display: inline-flex;
  width: 100%;
  border: 1px solid var(--border, #444);
  border-radius: 8px;
  overflow: hidden;
}

html.is-mobile .kline-mobile-view-btn {
  flex: 1 1 50%;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted, #999);
  font-size: 14px;
  line-height: 1;
  min-height: 36px;
  padding: 8px 10px;
  cursor: pointer;
}

html.is-mobile .kline-mobile-view-btn + .kline-mobile-view-btn {
  border-left: 1px solid var(--border, #444);
}

html.is-mobile .kline-mobile-view-btn.is-active {
  color: var(--text, #e8e6e3);
  background: rgba(236, 128, 141, 0.22);
}

html.is-mobile .kline-controls {
  grid-area: controls;
  margin-left: 0;
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
}

html.is-mobile .kline-controls[hidden] {
  display: none !important;
}

html.is-mobile .kline-controls label {
  font-size: 12px;
}

html.is-mobile .kline-controls select {
  min-height: 32px;
  font-size: 13px;
}

html.is-mobile .kline-header-actions {
  grid-area: actions;
  position: static;
  top: auto;
  right: auto;
}

html.is-mobile .kline-header-actions .modal-close {
  font-size: 28px;
  padding: 0 6px;
  min-width: 36px;
  min-height: 36px;
}

html.is-mobile .kline-icon-btn {
  display: none;
}

html.is-mobile .kline-chart {
  min-height: 260px;
  flex: 1 1 auto;
}

html.is-mobile .kline-panel {
  max-height: calc(100dvh - 12px);
  height: calc(100dvh - 12px);
  width: calc(100vw - 8px);
  margin: 4px auto;
  border-radius: 12px;
}

html.is-mobile .kline-body {
  min-height: 0;
  flex: 1 1 auto;
}

html.is-mobile .kline-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

html.is-mobile .kline-status {
  padding: 4px 12px;
  font-size: 11px;
}

/* 手机端分时 / 日K 二选一，不再上下叠放 */
html.is-mobile .kline-panel.m-view-fs .kline-chart,
html.is-mobile .kline-panel.m-view-fs #klineStatus {
  display: none !important;
}

html.is-mobile .kline-panel.m-view-k .kline-intraday-section {
  display: none !important;
}

html.is-mobile .kline-panel.has-intraday .kline-chart {
  flex: 1 1 auto;
  min-height: 0;
}

html.is-mobile .kline-intraday-section {
  order: 0;
  flex: 1 1 auto;
  min-height: 0;
  border-top: none;
  border-bottom: none;
}

html.is-mobile .kline-intraday-head {
  padding: 6px 12px 0;
}

html.is-mobile .kline-intraday-status {
  padding: 4px 12px;
  font-size: 11px;
  min-height: 0;
}

html.is-mobile .kline-intraday-chart {
  min-height: 260px;
  flex: 1 1 auto;
}

html.is-mobile .kline-intraday-close {
  display: none; /* 用顶部「分时/日K」切换代替 */
}

html.is-mobile .date-picker-popover {
  position: fixed;
  top: calc(var(--header-h) + 8px);
  right: 12px;
  left: 12px;
  width: auto;
  z-index: 140;
}

/* 桌面端隐藏手机切换条 */
.kline-mobile-view-toggle[hidden] {
  display: none !important;
}

/* ===== 侧栏分时/K线：手机单图 + 粘性底部 ===== */
html.is-mobile .pz-chart-view-toggle [data-pz-view="both"] {
  display: none;
}

html.is-mobile .pz-chart-view-btn {
  min-height: 34px;
  padding: 8px 14px;
  font-size: 13px;
}

html.is-mobile .pz-chart-expand-btn {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 13px;
  margin-left: 4px;
}

html.is-mobile .intraday-jingsuan-sidebar,
html.is-mobile .intraday-chart-dock,
html.is-mobile .intraday-split-handle,
html.is-mobile #panel-selection .intraday-split-handle,
html.is-mobile #panel-intraday .intraday-split-handle,
html.is-mobile #panel-jingsuan .intraday-split-handle {
  display: none !important;
}

/* 手机端不再内嵌侧栏分时/K线，点股票走全屏弹窗 */
html.is-mobile .intraday-chart-dock.is-mobile-chart {
  display: none !important;
}

/* ===== Jingsuan APP padding / sticky titles ===== */
html.is-mobile #panel-jingsuan.active {
  padding: 14px 14px 88px;
  height: auto;
  overflow: auto;
}

html.is-mobile .jingsuan-layout {
  flex-direction: column;
  height: auto;
}

html.is-mobile .jingsuan-main {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  overflow: visible;
}

html.is-mobile #panel-jingsuan .intraday-split-handle {
  display: none;
}

html.is-mobile #panel-jingsuan .intraday-chart-dock {
  display: none !important;
}

html.is-mobile .jingsuan-wrap {
  gap: 22px;
}

html.is-mobile .jingsuan-cards {
  grid-template-columns: 1fr !important;
}
html.is-mobile .jingsuan-card.is-multi-stock .jingsuan-card-body,
html.is-mobile .jingsuan-card.is-dense-stock .jingsuan-card-body {
  display: block;
}
html.is-mobile .jingsuan-card.is-multi-stock .jingsuan-stock-block + .jingsuan-stock-block {
  border-top: 1px dotted rgba(255, 255, 255, 0.14);
}

html.is-mobile .jingsuan-section-title {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 0 12px;
  padding: 8px 0 6px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
}
