/* ============================================================
   HERMES TRADING TERMINAL — 响应式 + 设计微调（增强层）
   引入顺序：必须在 app.css 之后（覆盖增强，绝不改 app.css）
   分三档：
     · 手机  ≤768px  —— 侧栏变抽屉、单列、触控适配
     · 平板  769–1024px —— 网格两列
     · 桌面  ≥1025px  —— 克制地统一卡片阴影/圆角/标题层次
   颜色一律走 app.css 既有 CSS 变量，双主题自洽。
   ============================================================ */


/* ============================================================
   汉堡按钮 + 抽屉遮罩（基础件，所有断点共用，桌面默认隐藏）
   ============================================================ */

/* 顶栏汉堡：复用 .icon-btn 视觉；桌面隐藏，仅移动端显示（见 ≤768px 段） */
.tb-menu { display: none; flex-shrink: 0; }
.tb-menu svg { width: 17px; height: 17px; }
.tb-menu .ph { font-size:17px; }

/* 抽屉遮罩：默认不存在/不可见；nav-open 时淡入。点击由 app.js 关闭抽屉。 */
.nav-scrim {
  position: fixed; inset: 0; z-index: 49;   /* 低于 .sidebar(抽屉=60)，高于顶栏(40) */
  background: var(--scrim);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--t), visibility var(--t);
}
#app.nav-open .nav-scrim {
  opacity: 1; visibility: visible; pointer-events: auto;
}


/* ============================================================
   手机：≤768px —— 侧栏抽屉化 + 单列 + 触控适配
   ============================================================ */
@media (max-width: 768px) {

  /* —— 间距收紧（变量级生效，全站联动）—— */
  :root {
    --gap: 12px;
    --topbar-h: 54px;
    /* 抽屉展开宽度（不再受 app.css ≤1023px 的 56px 图标轨约束）*/
    --sidebar-w: 252px;
  }

  /* —— 顶栏：让出汉堡位，标题区可收缩 —— */
  .tb-menu { display: grid; }              /* 覆盖默认 none，移动端显示汉堡 */
  .topbar { gap: 9px; padding: 0 12px; }
  .tb-left { display: none; }
  .tb-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
  /* 中部时钟保留、行情带/指数让位（窄屏信息降噪）*/
  .tb-mid { gap: 4px; flex: 1 1 auto; justify-content: center; overflow: visible; }
  .tb-clock { flex-direction: column; align-items: flex-start; gap: 0; font-size: 12px; line-height: 1.25; text-shadow: none; }
  .tb-clock-date { font-size: 12px; }
  .tb-clock-meta { gap: 5px; }
  .tb-clock-time { font-size: 12.5px; }
  .tb-market-state { min-height: 0; padding: 0; border: 0; background: transparent; font-size: 12px; }
  #tb-fresh { display: none; }
  .mini-indexes { display: none; }         /* 窄屏隐藏顶栏迷你指数 */
  .trade-badge { display: none; }          /* 状态过载，盘口状态交由底部/页内呈现 */
  .tb-right { gap: 5px; }
  .client-badge { display: none !important; }  /* 覆盖 JS 内联 display:'' */

  /* —— 滚动行情带：窄屏隐藏（信息密度过高、无横向空间）—— */
  .ticker-bar { display: none; }

  /* —— 侧栏 → 抽屉 —— */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    height: 100%; height: 100dvh;          /* 移动端动态视口高度，避开地址栏抖动 */
    z-index: 60;                            /* 高于遮罩(49)/顶栏(40) */
    transform: translateX(-100%);
    transition: transform var(--t-slow);
    box-shadow: var(--shadow-pop);
    border-right: 1px solid var(--border-strong);
    will-change: transform;
    /* 抽屉内允许纵向滚动（导航项较多时）*/
    overflow-y: auto;
  }
  /* 折叠态在移动端无意义：始终用抽屉全宽，覆盖 app-shell.nav-collapsed 的 68px */
  .app-shell.nav-collapsed .sidebar { width: var(--sidebar-w); }
  #app.nav-open .sidebar { transform: translateX(0); }

  /* 抽屉内恢复 logo 文案 / 导航文字 / 折叠按钮文字（app.css ≤1023px 把它们 display:none 了）*/
  .sidebar .logo-text,
  .app-shell.nav-collapsed .logo-text { display: block; }
  .sidebar .nav-label,
  .app-shell.nav-collapsed .nav-item .nav-label { display: inline; }
  .sidebar .nav-group-toggle { display: grid; }
  .sidebar .nav-children:not([hidden]) { display: block; }
  .sidebar .nav-children { padding-left: 42px; }
  .sidebar .nav-child { min-height: 40px; font-size: 14px; }
  .collapse-btn .c-label { display: inline; }
  /* 抽屉里导航项恢复左对齐 + 大触控目标 */
  .nav-item,
  .app-shell.nav-collapsed .nav-item {
    justify-content: flex-start;
    padding: 13px 18px;
    min-height: 48px;                       /* 触控目标 ≥44px */
    font-size: 15px;
  }
  /* 移动端保留底部的「历史与知识 / 系统设置」，只隐藏无意义的折叠按钮。 */
  .side-foot { display: block; }
  .side-foot .collapse-btn { display: none; }

  /* —— 主区：内容铺满、内距收紧 —— */
  .main-wrap { padding-bottom: 0; }         /* 底部状态条本就隐藏 */
  .view { padding: var(--space-3); }

  /* —— 栅格：强制单列（覆盖 app.css ≤1023px 已有规则，统一到 12 跨度）—— */
  .grid12 { gap: 12px; }
  .sp-3, .sp-4, .sp-5, .sp-6, .sp-7, .sp-8, .sp-9, .sp-12 { grid-column: 1 / -1; }

  /* 页内常见双/三列子栅格 → 单列或两列，避免横向溢出 */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .quote-grid { grid-template-columns: repeat(2, 1fr); }
  .sched-grid { grid-template-columns: 1fr; }
  .sector-cols { grid-template-columns: 1fr; }
  .ds-infra-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .phase-cards { grid-template-columns: 1fr; }
  .kn-masonry { columns: 1; }
  .kn-layout, .ar-layout, .diy-layout, .ft-leaders-grid, .mkt-grid {
    grid-template-columns: 1fr;
  }
  /* 防 flash-list/mkt-news 的 min-content 撑破 1fr 单列轨道导致手机横向溢出 */
  .mkt-grid > * { min-width: 0; }

  /* —— 卡片：字号/内距适配 —— */
  .card-head { padding: var(--space-4) var(--space-4) 0; flex-wrap: wrap; align-items: flex-start; }
  .card-head > .card-title { min-width: 0; flex: 1 1 180px; }
  .card-head > .card-extra { width: 100%; min-width: 0; margin-left: 0; flex-wrap: wrap; }
  .card-body { padding: var(--space-4); }
  .card-title { font-size: var(--font-sm); line-height: 1.45; letter-spacing: .7px; }
  .page-title { font-size: var(--font-lg); }
  .page-head { gap: 9px; margin-bottom: 12px; }
  .page-head .ph-extra { width: 100%; margin-left: 0; }  /* 操作区换行铺满，按钮不挤标题 */

  /* —— 图表高度收一点，窄屏不至于过高 —— */
  .hero-chart { height: 260px; }
  .big-chart  { height: 300px; }
  .heat-chart { height: 300px; }
  .flow-chart { height: 260px; }
  .gauge-wrap { flex-wrap: wrap; }

  /* —— Hero 指数 tab：横向可滚动 + 紧凑，绝不换行/贴边/溢出 ——
     桌面态 .idx-tab{flex:1} 把 4 指数等分挤窄，窄屏内容会换行/撑破。
     这里改成横向滚动条：tab 不再拉伸(flex:0 0 auto)、给最小宽度容纳价/涨跌/额，
     行内不换行(.it-px 等)，容器 overflow-x:auto + iOS 动量滚动。字号各收一档。 */
  .hero-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;                  /* Firefox 隐藏滚动条，靠惯性/拖动 */
  }
  .hero-tabs::-webkit-scrollbar { display: none; }   /* WebKit 同上，避免占高 */
  .idx-tab {
    flex: 0 0 auto;                         /* 覆盖桌面 flex:1：不再等分拉伸 */
    min-width: 116px;                       /* 容纳「现价 / 涨跌% / 成交额」不挤压换行 */
    padding: 8px 11px;
    white-space: nowrap;                    /* tab 内整体不换行 */
  }
  .idx-tab .it-name { letter-spacing: 0.5px; gap: 8px; }
  .idx-tab .it-px  { font-size: 17px; }     /* 价格主数字收一档 */
  .idx-tab .it-amt { margin-left: 5px; }

  /* —— A/H/U 市场段控：窄屏铺满一行、可滚动，按钮触控目标足够 ——
     (段控由 dashboard.js 以 .segmented.hero-mkt-seg 注入；无对应 JS 时本规则自然空转) */
  .hero-mkt-seg {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px 12px 0;
  }
  .hero-mkt-seg::-webkit-scrollbar { display: none; }
  .hero-mkt-seg .seg { flex: 1 0 auto; min-height: 40px; }

  /* —— 数据列表改为纵向信息卡，手机不再依赖左右滑动 —— */
  .tbl-wrap { overflow-x: visible !important; width: 100%; min-width: 0; }
  .md-body { overflow-x: hidden; }
  table.mobile-card-table { display: block; width: 100%; min-width: 0 !important; }
  table.mobile-card-table thead { display: none; }
  table.mobile-card-table tbody { display: flex; flex-direction: column; gap: 10px; width: 100%; }
  table.mobile-card-table tfoot { display: block; width: 100%; margin-top: 10px; }
  table.mobile-card-table tbody tr {
    display: block; width: 100%; padding: 8px 10px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--panel-2); min-width: 0;
  }
  table.mobile-card-table tfoot tr {
    display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5px 10px;
    width: 100%; padding: 8px 10px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--panel); min-width: 0;
  }
  table.mobile-card-table tfoot td {
    display: block; width: auto !important; min-width: 0 !important; padding: 4px 2px;
    border: 0; white-space: normal !important; overflow-wrap: anywhere; text-align: left !important;
  }
  table.mobile-card-table tbody td {
    display: grid; grid-template-columns: minmax(84px, 32%) minmax(0, 1fr);
    gap: 10px; align-items: start; width: 100% !important; min-width: 0 !important;
    padding: 7px 2px; border: 0; white-space: normal !important;
    overflow-wrap: anywhere; text-align: left !important;
  }
  table.mobile-card-table tbody td::before {
    content: attr(data-label); color: var(--text-3); font-size: 12px; font-weight: 650;
  }
  table.mobile-card-table tbody td[colspan] { display: block; }
  table.mobile-card-table tbody td[colspan]::before { content: none; }
  table.mobile-card-table input, table.mobile-card-table select,
  table.mobile-card-table textarea { width: 100% !important; min-width: 0 !important; max-width: 100%; }

  /* 持仓不再把十四个字段逐项拉成一条超长竖线：摘要、盈亏与编辑项两列排布，
     行业/备注/操作和展开详情仍占整行。 */
  table.holdings-mobile-table tbody tr[data-i] {
    position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 12px; padding: 10px;
  }
  table.holdings-mobile-table tbody tr[data-i] > td {
    display: flex; flex-direction: column; gap: 2px; padding: 5px 2px;
  }
  table.holdings-mobile-table tbody tr[data-i] > td:nth-child(4),
  table.holdings-mobile-table tbody tr[data-i] > td:nth-child(13),
  table.holdings-mobile-table tbody tr[data-i] > td:nth-child(14) { grid-column: 1 / -1; }
  table.holdings-mobile-table .hold-row-ops {
    display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px;
  }
  table.holdings-mobile-table .hold-row-ops > * { width: 100%; min-height: 38px; margin: 0; }
  table.holdings-mobile-table tbody tr.hold-detail-row { display: block; padding: 8px; }

  /* 台账、涨停明细和多因子榜使用紧凑双列卡；长说明与操作独占一行，
     比“每个单元格一整行”的通用移动卡短一半左右。 */
  table.operation-log-table tbody tr,
  table.mobile-compact-table tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 2px 12px;
  }
  table.operation-log-table tbody td,
  table.mobile-compact-table tbody td {
    display: flex; flex-direction: column; gap: 2px; padding: 5px 2px;
  }
  table.operation-log-table tbody td.ol-wrap,
  table.operation-log-table tbody td.ol-ops { grid-column: 1 / -1; max-width: none; }
  table.operation-log-table .ol-ops { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  table.operation-log-table .ol-ops .btn { margin: 0; width: 100%; }

  /* 信息榜在手机上限定为一屏半高度，保留可见的竖向滚动条；桌面不截断。 */
  #ft-money-body, #ft-mainline-body, #ft-crowd-body, #ft-leaders-body,
  #cap-sec-list, #cap-hot-list, #mf-inst-body, #mf-ind-body,
  #ck2-mainline-body {
    max-height: 520px; overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--scrollbar-hover) var(--track);
  }
  #ft-money-body::-webkit-scrollbar, #ft-mainline-body::-webkit-scrollbar,
  #ft-crowd-body::-webkit-scrollbar, #ft-leaders-body::-webkit-scrollbar,
  #cap-sec-list::-webkit-scrollbar, #cap-hot-list::-webkit-scrollbar,
  #mf-inst-body::-webkit-scrollbar, #mf-ind-body::-webkit-scrollbar,
  #ck2-mainline-body::-webkit-scrollbar { width: 6px; }

  .fc-search { max-width: 100% !important; flex-wrap: wrap; }
  .fc-search .input { flex: 1 1 100%; }

  /* 研究中心、资金追踪、主线深研和持仓图表全部允许内容列收缩。 */
  .card, .card-body, .grid12 > *, .ft-workbench, .ft-workbench-col,
  .ft-module, .ft-module-body, .holdings-grid > *, #hold-pie,
  .report-work, .tm-diary-actions { min-width: 0 !important; max-width: 100%; }
  .ft-workbench { grid-template-columns: 1fr !important; }
  .ft-me-row { display: grid !important; grid-template-columns: minmax(0,1fr) auto !important; gap: 6px 10px; }
  .ft-me-row > * { min-width: 0 !important; white-space: normal !important; overflow-wrap: anywhere; }
  .cap-row { display: grid !important; grid-template-columns: 30px minmax(0,1fr) auto !important; gap: 6px 8px !important; }
  .cap-row > * { min-width: 0 !important; max-width: 100%; white-space: normal !important; overflow-wrap: anywhere; }
  #hold-pie-chart { width: 100% !important; min-width: 0; }
  .tm-diary-actions { display: grid !important; grid-template-columns: 1fr; }
  .tm-diary-input { width: 100%; min-width: 0 !important; }
  .page-head .ph-extra, .card-extra, .tabs, .segmented { display: flex; flex-wrap: wrap !important; overflow-x: visible !important; gap: 6px; }
  .page-head .ph-extra > *, .card-extra > *, .tabs > *, .segmented > * { min-width: 0; max-width: 100%; }
  .card-extra .data-stamp { display: flex; flex: 1 1 150px; flex-wrap: wrap; white-space: normal; overflow-wrap: anywhere; }
  #cap-stamp > div { flex: 1 0 100%; width: 100% !important; min-width: 0; margin-left: 0 !important; }
  #cap-stamp > span { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .btn, .btn-sm { white-space: normal !important; overflow-wrap: anywhere; }

  /* —— 触控目标 ≥44px：按钮/输入/分段/标签页/图标钮 —— */
  .btn { min-height: 44px; padding: 11px 18px; }
  .btn-sm { min-height: 40px; padding: 9px 14px; }
  .icon-btn, .theme-toggle, .tb-menu { width: 44px; height: 44px; }
  .tb-today { min-height: 44px; padding: 0 12px; }
  .input, .select { min-height: 42px; }
  .tab { padding: 11px 14px; }
  .seg, .segmented .seg { padding: 9px 13px; }
  .send-btn { width: 46px; height: 46px; }

  /* —— 聊天：上下堆叠、占满可视高度（覆盖 app.css ≤1023px 的高度算式，去掉 ticker 项）—— */
  .chat-layout { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .chat-main { height: calc(100dvh - var(--topbar-h) - 24px); min-height: 420px; }
  .chat-side { max-height: none; }
  .msg-bubble { max-width: 90%; font-size: 14.5px; }

  /* —— Toast：贴边自适应宽度，避开汉堡/顶栏 —— */
  .toast-root { top: calc(var(--topbar-h) + 8px); left: 10px; right: 10px; }
  .toast { min-width: 0; max-width: none; }

  /* —— Modal：留出安全边距 —— */
  .modal-overlay { padding: 14px; }
  .modal { max-height: 88vh; }

  /* —— 报告正文：去掉桌面宽度上限，铺满 —— */
  .report-body, #diy-output .report-body { max-width: 100%; }
}

@media (max-width: 420px) {
  #tb-export-btn { display: none; }
  .tb-today { width: 44px; padding: 0; }
  .tb-today span { display: none; }
  .workspace-nav { margin-bottom: 12px; }
}

/* 工作台页签在手机上优先保证主路径完整可横滑；次级能力单列，不遮住最后几个页签。 */
@media (max-width: 760px) {
  .workspace-nav { display: block; }
  .workspace-tabs { margin-bottom: 6px; }
  .workspace-more { display: flex; justify-content: flex-end; }
  .workspace-more-trigger { height: auto; min-height: 34px; }
}


/* ============================================================
   平板：769–1024px —— 网格两列（介于桌面12列与手机单列之间）
   注：app.css 在 ≤1023px 把 .sp-* 全压成单列且侧栏变 56px 图标轨；
       此处下界 769px 不触发抽屉，仅把主栅格放成两列，信息密度更合理。
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {

  /* 二级能力已迁入侧栏，平板不能再退化成仅图标轨，否则子目录不可达。 */
  :root { --sidebar-w: 220px; }
  .app-shell:not(.nav-collapsed) .sidebar .logo-text,
  .app-shell:not(.nav-collapsed) .sidebar .nav-label,
  .app-shell:not(.nav-collapsed) .collapse-btn .c-label { display: block; }
  .app-shell:not(.nav-collapsed) .nav-item { justify-content: flex-start; padding: 11px 16px; }
  .app-shell:not(.nav-collapsed) .nav-group-toggle { display: grid; }
  .app-shell:not(.nav-collapsed) .nav-children:not([hidden]) { display: block; }

  /* 主 12 列栅格 → 等效两列（每项占 6 跨度）；整宽项仍整宽 */
  .sp-3, .sp-4, .sp-5, .sp-6, .sp-7, .sp-8, .sp-9 { grid-column: span 6; }
  .sp-12 { grid-column: span 12; }

  /* 页内子栅格收成两列，避免三列在中屏过窄 */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .quote-grid { grid-template-columns: repeat(2, 1fr); }
  .ds-infra-grid { grid-template-columns: repeat(2, 1fr); }

  /* 聊天右侧情报栏在中屏偏窄 → 收一档（app.css 此区间已是单列布局，这里仅微调间距）*/
  .view { padding: 16px; }
}


/* ============================================================
   桌面：≥1025px —— 克制地统一卡片阴影/圆角/标题层次（更清爽）
   仅做轻量统一，不改色板、不动布局，避免破坏现有视觉签名。
   ============================================================ */
@media (min-width: 1025px) {

  /* 圆角统一：卡片/模态/弹层走同一档，去掉零散圆角带来的细碎感 */
  .card, .modal, .export-menu, .acc-item, .phase-card {
    border-radius: var(--radius);
  }

  /* 卡片阴影统一为更轻的一档（默认态克制，hover 再抬升——hover 抬升已在 app.css 定义，此处不覆盖）*/
  .card { box-shadow: var(--shadow-soft); }

  /* 标题层次：卡片小标题与页面大标题拉开字距/字重对比，结构更清晰 */
  .card-title { letter-spacing: 1px; }
  .page-title { letter-spacing: .6px; }
  /* 卡片头与正文之间留白略增，呼吸感更足（仅桌面，不影响移动紧凑）*/
  .card-head { padding-top: var(--space-4); }

  /* 大屏正文行宽适度收敛，长段落更易读（不影响表格/图表类卡片）*/
  .report-body { max-width: 920px; }
}


/* ============================================================
   动效无障碍：尊重"减少动态效果"偏好 —— 抽屉/遮罩瞬时切换
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-scrim { transition: none; }
}

/* 统一一级模块的垂直节奏。各页面可以在模块内部自行排版，但相邻模块之间固定为 --gap。 */
#view > :is(.card, .grid12, .ck2-overview-shell, .ck2-top-grid, .ck2-embedded-view),
.workspace-panel > :is(.card, .grid12, .ck2-overview-shell, .ck2-top-grid, .ck2-embedded-view) {
  margin-bottom: var(--gap) !important;
}

/* 三个长榜在桌面与手机都使用鼠标滚轮/触摸纵向浏览；表头固定，避免滚动后失去字段语义。 */
.hb-table-wrap,
#q-rank-body > .tbl-wrap,
#senti-body {
  max-height: min(620px, 68vh);
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}
.hb-table-wrap thead th,
#q-rank-body > .tbl-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
}

/* 方案A：移动端只把决策字段放在卡面，次要解释收进详情/编辑动作。 */
@media (max-width: 768px) {
  table.holdings-mobile-table tbody tr[data-i] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "name select"
      "code price"
      "pnl pnlpct"
      "change mv"
      "cost shares"
      "actions actions";
    gap: 3px 12px;
    padding: 12px;
    border-left: 3px solid var(--accent);
    background: var(--panel);
    box-shadow: var(--shadow-soft);
  }
  table.holdings-mobile-table .hold-select { grid-area: select; align-items: flex-end; }
  table.holdings-mobile-table .hold-code { grid-area: code; }
  table.holdings-mobile-table .hold-name { grid-area: name; font-size: 17px; font-weight: 800 !important; }
  table.holdings-mobile-table .hold-cost { grid-area: cost; }
  table.holdings-mobile-table .hold-shares { grid-area: shares; }
  table.holdings-mobile-table .hold-price { grid-area: price; font-size: 18px; font-weight: 800; color: var(--text); }
  table.holdings-mobile-table .hold-change { grid-area: change; }
  table.holdings-mobile-table .hold-pnl { grid-area: pnl; font-size: 22px; font-weight: 850 !important; }
  table.holdings-mobile-table .hold-pnlpct { grid-area: pnlpct; font-size: 18px; font-weight: 760; }
  table.holdings-mobile-table .hold-mv { grid-area: mv; }
  table.holdings-mobile-table .hold-actions { grid-area: actions; border-top: 1px solid var(--border); margin-top: 5px; padding-top: 9px; }
  table.holdings-mobile-table .hold-code,
  table.holdings-mobile-table .hold-cost,
  table.holdings-mobile-table .hold-shares { align-items: flex-start; text-align: left !important; }
  table.holdings-mobile-table .hold-code input,
  table.holdings-mobile-table .hold-cost input,
  table.holdings-mobile-table .hold-shares input { text-align: left !important; }
  table.holdings-mobile-table .hold-row-ops {
    display: grid !important; width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 5px;
  }
  table.holdings-mobile-table .hold-row-ops > * {
    width: 100% !important; min-width: 0; min-height: 38px; margin: 0 !important;
    padding: 5px 2px !important; font-size: 12px !important; white-space: nowrap !important;
  }
  table.holdings-mobile-table .hold-row-ops .row-del .ph { display: none; }
  table.holdings-mobile-table .hold-sector,
  table.holdings-mobile-table .hold-weight,
  table.holdings-mobile-table .hold-note { display: none !important; }
  table.holdings-mobile-table .hold-name::before,
  table.holdings-mobile-table .hold-select::before,
  table.holdings-mobile-table .hold-actions::before { display: none; }

  /* 持仓详情与观察池一致：紧跟当前股票行内展开，单次只显示一只股票。 */
  table.holdings-mobile-table tbody tr.hold-detail-row {
    position: static; inset: auto; z-index: auto; display: block !important;
    width: 100%; margin-top: -10px; padding: 0 !important; border: 0; background: transparent;
  }
  table.holdings-mobile-table tbody tr.hold-detail-row > td {
    display: block !important; width: 100% !important; max-height: none; overflow: hidden;
    padding: 10px !important; border: 1px solid var(--border); border-top: 0;
    border-radius: 0 0 10px 10px; background: var(--panel-2); box-shadow: none;
  }
  .hold-inline-detail { padding: 0; }
  .hold-drawer-head {
    position: static; display: flex; align-items: center; justify-content: space-between;
    min-height: 42px; margin: 0 0 10px; padding: 0 0 8px;
    border-bottom: 1px solid var(--border); background: transparent;
  }
  .hold-drawer-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hold-drawer-close { display: grid; flex: none; }
  .hold-draw-k.chan-k { height: 440px !important; }

  /* 台账摘要卡：保留交易事实和盈亏，长说明通过编辑/留痕查看。 */
  table.operation-log-table tbody tr {
    grid-template-columns: repeat(2, minmax(0,1fr));
    grid-template-areas:
      "date stock"
      "level point"
      "stop buy"
      "sell sell"
      "profit status"
      "actions actions";
    border-left: 3px solid var(--accent);
    padding: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-soft);
  }
  table.operation-log-table { display: block; width: 100%; min-width: 0 !important; }
  table.operation-log-table thead { display: none; }
  table.operation-log-table tbody { display: flex; flex-direction: column; gap: 10px; width: 100%; }
  table.operation-log-table tbody td {
    width: auto !important; min-width: 0 !important; white-space: normal !important;
    overflow-wrap: anywhere; text-align: left !important;
  }
  table.operation-log-table tbody td::before {
    content: attr(data-label); color: var(--text-3); font-size: 12px; font-weight: 650;
  }
  table.operation-log-table .ol-date{grid-area:date}
  table.operation-log-table .ol-stock{grid-area:stock}
  table.operation-log-table .ol-level{grid-area:level}
  table.operation-log-table .ol-point{grid-area:point}
  table.operation-log-table .ol-stop{grid-area:stop}
  table.operation-log-table .ol-buy{grid-area:buy}
  table.operation-log-table .ol-sell{grid-area:sell}
  table.operation-log-table .ol-profit{grid-area:profit}
  table.operation-log-table .ol-watch{grid-area:watch}
  table.operation-log-table .ol-status{grid-area:status}
  table.operation-log-table .ol-ops{grid-area:actions}
  table.operation-log-table tbody td:nth-child(2) { font-size: 16px; }
  table.operation-log-table tbody td:nth-child(10) { font-size: 21px; font-weight: 850; }
  table.operation-log-table tbody td:nth-child(5),
  table.operation-log-table tbody td:nth-child(7),
  table.operation-log-table tbody td:nth-child(11) { display: none !important; }
  table.operation-log-table .ol-date,
  table.operation-log-table .ol-stock,
  table.operation-log-table .ol-sell,
  table.operation-log-table .ol-profit,
  table.operation-log-table .ol-status { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap !important; }
  table.operation-log-table .ol-stock { justify-content: flex-end; }
  table.operation-log-table .ol-ops {
    display: flex !important; flex-direction: row !important; align-items: stretch; width: 100% !important;
    flex-wrap: nowrap; gap: 5px; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px;
  }
  table.operation-log-table .ol-ops .btn {
    flex: 1 1 0; width: auto; min-width: 0; min-height: 34px;
    margin: 0 !important; padding: 4px 2px; font-size: 11px; white-space: nowrap !important;
  }
  table.operation-log-table .ol-label-wide { display: none; }
  table.operation-log-table .ol-label-mobile { display: inline; }
  table.operation-log-table tbody td:nth-child(13)::before { display: none; }

  /* 涨停摘要卡：涨幅是主数字，首封/封单/题材为二级证据。 */
  .hb-table.mobile-compact-table { min-width: 0; }
  .hb-table.mobile-compact-table tbody tr {
    grid-template-columns: repeat(2, minmax(0,1fr));
    border-left: 3px solid var(--up);
    padding: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-soft);
  }
  .hb-table.mobile-compact-table tbody td:nth-child(4),
  .hb-table.mobile-compact-table tbody td:nth-child(10) { grid-column: 1 / -1; }
  .hb-table.mobile-compact-table tbody td:nth-child(1) { grid-column: 2; grid-row: 1; align-items: flex-end; }
  .hb-table.mobile-compact-table tbody td:nth-child(2) { grid-column: 1; grid-row: 1; font-size: 17px; }
  .hb-table.mobile-compact-table tbody td:nth-child(1),
  .hb-table.mobile-compact-table tbody td:nth-child(2) { flex-direction: row; white-space: nowrap !important; }
  .hb-table.mobile-compact-table tbody td:nth-child(1)::before,
  .hb-table.mobile-compact-table tbody td:nth-child(2)::before { display: none; }
  .hb-table.mobile-compact-table tbody td:nth-child(4) { font-size: 22px; font-weight: 850; }
  .hb-table.mobile-compact-table tbody td:nth-child(3),
  .hb-table.mobile-compact-table tbody td:nth-child(6),
  .hb-table.mobile-compact-table tbody td:nth-child(7) { display: none !important; }

  /* 多因子摘要卡：名称、名次、总分与五因子是首屏；原始估值字段留在桌面表格。 */
  #q-rank-body table.mobile-compact-table tbody tr {
    grid-template-columns: repeat(2, minmax(0,1fr));
    border-left: 3px solid var(--accent);
    padding: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-soft);
  }
  #q-rank-body table.mobile-compact-table tbody td:nth-child(10),
  #q-rank-body table.mobile-compact-table tbody td:nth-child(11) { grid-column: 1 / -1; }
  #q-rank-body table.mobile-compact-table tbody td:nth-child(1) { grid-column: 1; grid-row: 1; }
  #q-rank-body table.mobile-compact-table tbody td:nth-child(2) { grid-column: 2; grid-row: 1; align-items: flex-end; }
  #q-rank-body table.mobile-compact-table tbody td:nth-child(1),
  #q-rank-body table.mobile-compact-table tbody td:nth-child(2),
  #q-rank-body table.mobile-compact-table tbody td:nth-child(11) {
    flex-direction: row; align-items: center; white-space: nowrap !important;
  }
  #q-rank-body table.mobile-compact-table tbody td:nth-child(2)::before { display: none; }
  #q-rank-body table.mobile-compact-table tbody td:nth-child(11) { justify-content: space-between; gap: 10px; }
  #q-rank-body table.mobile-compact-table tbody td:nth-child(11) .inst-score { margin-left: 0; flex: 0 0 112px; width: 112px; }
  #q-rank-body table.mobile-compact-table tbody td:nth-child(2) { font-size: 17px; font-weight: 800; }
  #q-rank-body table.mobile-compact-table tbody td:nth-child(11) { font-size: 22px; font-weight: 850; }
  #q-rank-body table.mobile-compact-table tbody td:nth-child(5),
  #q-rank-body table.mobile-compact-table tbody td:nth-child(6),
  #q-rank-body table.mobile-compact-table tbody td:nth-child(7),
  #q-rank-body table.mobile-compact-table tbody td:nth-child(8),
  #q-rank-body table.mobile-compact-table tbody td:nth-child(9) { display: none !important; }
}
