/* ============================================================================
   藏宝阁价格库 · 手机版样式（v2）
   ----------------------------------------------------------------------------
   设计：B 稿「紧凑列表」为主 + C 稿「大图双列」可切换（见 手机端设计稿-20261014.html）
   ★ 全部规则锁在 ≤900px 的媒体查询内 → 桌面端（>900px）逐像素不变。
   ★ 不改 HTML、不改 app.js / auth.js / server.py；需要的控件由 mobile.js 注入。
   层级：10 侧栏 < 30 顶栏 < 40 工具条 < 60 底部 Tab < 80 筛选面板 < 90 抽屉/弹窗
   ============================================================================ */

/* mobile.js 注入的节点：桌面端一律不出现 */
.m-toolbar, .m-tabbar, .m-me-sheet, .m-mask, .m-sheet-head,
.m-fg-tabs, .m-cond, .m-sorts { display: none; }
/* 「我的」按钮注入在原导航里：桌面端必须彻底隐藏（特异性要压过 .page-tab） */
.topbar .page-tabs .page-tab.m-me { display: none; }
/* 筛选面板的「关闭」按钮同理（手机端才有意义） */
.side-head .m-close { display: none; }

@media (max-width: 900px) {

  /* ==================================================================== 基础 */
  body{ min-width: 0; -webkit-text-size-adjust: 100%; }
  html{ scroll-behavior: auto; }

  /* iOS：font-size < 16px 的输入框聚焦会整页放大 → 统一 16px */
  input, select, textarea, .combo-input { font-size: 16px; }
  input, select { height: 42px; }
  .combo-box { height: 42px; }
  .combo-native { font-size: 16px; }

  /* 底部固定 Tab 占位（含 iPhone 安全区） */
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }

  .page-wrap { padding: 10px 12px 24px; }
  .card, .kpi-card, .bar-chart, .panel { border-radius: 12px; }

  /* 触摸屏上关掉纯 hover 的提示（点不出来只会误导） */
  .tip-hint, .hint, .sort-hint { display: none; }

  /* ============================================================== 顶部（紧凑） */
  .topbar {
    flex-wrap: wrap; gap: 6px 8px; padding: 9px 12px;
    position: static; align-items: center;
  }
  .topbar .brand { min-width: 0; flex: 1 1 0; gap: 8px; }
  .topbar .brand > div { min-width: 0; overflow: hidden; }
  .topbar .brand .logo { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; flex: none; }
  .topbar .brand h1 { font-size: 15px; white-space: nowrap; }
  .topbar .brand .sub {
    font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  /* 统计胶囊：横向滚动一行，不换行挤压 */
  .stat-chips {
    order: 9; flex: 0 0 100%; width: 100%;
    flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 2px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .stat-chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 4px 10px; font-size: 11.5px; }
  .chip b { font-size: 13px; }

  /* 顶部操作按钮：收成图标条，不再和导航抢位置 */
  .topbar-actions { flex: none; gap: 6px; }
  .topbar-actions .btn { height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 16px; }

  /* ======================================================= 底部 Tab（原导航） */
  /* auth.js 注入的 .page-tabs 在手机上改成底部固定 Tab；
     ★ 必须用 .topbar 前缀提特异性：auth.js 的样式在 <head> 末尾注入，晚于本文件 */
  .topbar .page-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    z-index: 60; display: flex; gap: 0; flex: none;
    padding: 5px 0 calc(5px + env(safe-area-inset-bottom, 0px));
    background: #fff; border-top: 1px solid var(--line);
    box-shadow: 0 -2px 14px rgba(21, 35, 60, .07);
    overflow: visible;
  }
  .topbar .page-tabs .page-tab {
    flex: 1 1 0; min-width: 0; height: auto; padding: 3px 1px;
    border: 0; border-radius: 0; background: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; font-size: 11px; line-height: 1.2; color: var(--text-3); font-weight: 400;
  }
  .topbar .page-tabs .page-tab::before {
    content: ''; width: 18px; height: 18px; border-radius: 6px;
    background: #ccd4e0; transition: background .15s;
  }
  .topbar .page-tabs .page-tab.active { background: none; color: var(--brand); font-weight: 650; }
  .topbar .page-tabs .page-tab.active::before { background: var(--brand); }
  .topbar .page-tabs .page-tab:hover { background: none; }
  .topbar .page-tabs-spacer, .topbar .nav-user { display: none !important; }
  .topbar .page-tabs .btn.small { display: none; }   /* 修改密码 / 退出登录 → 移入「我的」 */

  /* 「我的」Tab（mobile.js 注入的按钮） */
  .topbar .page-tabs .page-tab.m-me { display: flex; }
  .topbar .page-tabs .m-me::before { border-radius: 50%; }

  /* ============================================================== 吸顶工具条 */
  .m-toolbar {
    display: block; position: sticky; top: 0; z-index: 40;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 8px 12px 0;
  }
  .m-tb-row { display: flex; align-items: center; gap: 8px; }
  .m-search {
    flex: 1 1 auto; min-width: 0; height: 40px; background: #f1f4f9;
    border-radius: 20px; display: flex; align-items: center; gap: 8px; padding: 0 13px;
  }
  .m-search input {
    flex: 1; min-width: 0; height: 100%; border: 0; background: none; padding: 0;
    font-size: 16px; outline: none; box-shadow: none;
  }
  .m-search input:focus { box-shadow: none; }
  .m-iconbtn {
    flex: none; height: 40px; min-width: 40px; padding: 0 11px;
    border: 1px solid #dbe2ec; border-radius: 20px; background: #fff;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 500; color: var(--text);
  }
  .m-iconbtn.on { background: #eaf1ff; border-color: #c9dcff; color: var(--brand); }
  .m-iconbtn .m-badge {
    background: var(--brand); color: #fff; border-radius: 9px;
    font-size: 11px; padding: 1px 6px; line-height: 1.5;
  }

  /* 排序 chips */
  .m-sorts {
    display: flex; gap: 6px; overflow-x: auto; padding: 9px 0 8px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .m-sorts::-webkit-scrollbar { display: none; }
  .m-sorts .m-sort {
    flex: none; height: 30px; padding: 0 13px; border-radius: 15px;
    background: #f1f4f9; color: var(--text-2); font-size: 12.5px;
    display: inline-flex; align-items: center; border: 1px solid transparent;
  }
  .m-sorts .m-sort.on { background: #2f6df6; color: #fff; font-weight: 500; }

  /* 已选条件蓝带 */
  .m-cond {
    display: none; align-items: center; gap: 8px;
    margin: 0 -12px; padding: 8px 12px; background: #eaf1ff;
  }
  .m-cond.on { display: flex; }
  .m-cond .t {
    flex: 1; min-width: 0; font-size: 12px; color: #1d5fd4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .m-cond .x { flex: none; font-size: 12px; color: #1d5fd4; font-weight: 500; }

  /* ======================================== 商品库列表（B 稿：紧凑列表 + 大图） */
  body.m-items .layout { display: block; padding: 0; }
  body.m-items .main { padding: 0; }
  body.m-items .list-head {
    display: flex; align-items: center; gap: 8px; padding: 9px 12px 7px;
  }
  body.m-items .list-title h2 { font-size: 15px; }
  body.m-items .list-title .muted { font-size: 12px; }
  body.m-items .list-tools { display: none; }      /* 条数/排序改由工具条接管 */
  body.m-items .table-wrap { overflow: visible; }

  /* 表格 → 一行一件 */
  body.m-items table.list { display: block; width: 100%; border: 0; }
  body.m-items table.list thead { display: none; }
  body.m-items table.list tbody { display: block; width: 100%; }
  body.m-items table.list tbody tr {
    display: grid; grid-template-columns: 54px minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    column-gap: 10px; row-gap: 3px;
    align-items: start; position: relative;
    padding: 11px 12px; background: #fff;
    border-bottom: 1px solid #eef2f8;
  }
  body.m-items table.list tbody tr:last-child { border-bottom: 0; }
  body.m-items table.list tbody td {
    display: block; border: 0; padding: 0; background: none; box-shadow: none;
  }
  body.m-items table.list tbody td[data-label]::before { content: none; }

  body.m-items td.c-item { grid-column: 1 / 3; grid-row: 1; }
  body.m-items td.c-price { grid-column: 3; grid-row: 1; justify-self: end; text-align: right; }
  body.m-items td.c-attr { grid-column: 1 / 3; grid-row: 2 / 4; padding-left: 64px !important; }
  body.m-items td.c-st { grid-column: 3; grid-row: 2; justify-self: end; text-align: right; }
  body.m-items td.c-col { grid-column: 3; grid-row: 3; justify-self: end; text-align: right; }
  body.m-items td.c-lv, body.m-items td.c-sv,
  body.m-items td.c-time, body.m-items td.c-go { display: none !important; }

  /* 图 + 名称块 */
  body.m-items .item-cell { gap: 10px; min-width: 0; }
  body.m-items .item-cell img {
    width: 54px; height: 54px; border-radius: 10px; flex: none; object-fit: cover;
  }
  body.m-items .item-name { font-size: 14px; font-weight: 650; line-height: 1.3; }
  body.m-items .item-sub { font-size: 11.5px; }
  body.m-items .item-sn { display: none; }        /* 编号移入详情，列表不占行 */

  /* 关键属性：两行截断，够看重点
     ★ 选择器要写全（含 table.list tbody），否则被上面的 td{display:block} 压掉 */
  body.m-items table.list tbody td.c-attr {
    font-size: 12.5px; color: var(--text-2); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  body.m-items table.list tbody td.c-attr > div { display: inline; }
  body.m-items table.list tbody td.c-attr .tag,
  body.m-items table.list tbody td.c-attr .calc { display: inline-block; margin-right: 4px; }

  /* 价格 / 状态 / 收藏（右列） */
  body.m-items td.c-price .price { font-size: 19px; font-weight: 700; }
  body.m-items td.c-st .badge { font-size: 11px; padding: 2px 7px; border-radius: 6px; }
  body.m-items td.c-st .item-sub { font-size: 11px; }
  body.m-items td.c-st .timer { font-size: 11px; margin-top: 2px; }
  body.m-items td.c-col { font-size: 11.5px; color: var(--text-3); }
  body.m-items td.c-col::before { content: '收藏 '; }

  /* 状态色条：整行左侧 */
  body.m-items table.list tbody tr.hot-draw { border-left: 4px solid var(--orange); background: #fffaf5; }
  body.m-items table.list tbody tr.fair-row { border-left: 4px solid #7fb2ff; background: #fbfdff; }
  body.m-items table.list tbody tr.drawing-row { border-left: 4px solid #ffc98a; background: #fffcf8; }
  body.m-items table.list tbody tr.hot-draw td,
  body.m-items table.list tbody tr.fair-row td,
  body.m-items table.list tbody tr.drawing-row td { box-shadow: none; }

  /* 空状态行 */
  body.m-items table.list tbody tr.m-flat { display: block; padding: 26px 16px; }
  body.m-items table.list tbody tr.m-flat td { display: block; text-align: center; line-height: 1.8; }

  /* ------------------------------------------------ C 稿：大图双列（可切换） */
  body.m-items.m-grid table.list tbody {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px; padding: 0 12px 4px;
  }
  body.m-items.m-grid table.list tbody tr {
    display: flex; flex-direction: column; gap: 0;
    padding: 0; border: 1px solid var(--line); border-radius: 13px;
    overflow: hidden; background: #fff;
  }
  body.m-items.m-grid table.list tbody tr:last-child { border-bottom: 1px solid var(--line); }
  body.m-items.m-grid tbody td { display: block !important; padding: 0 !important; }
  body.m-items.m-grid td.c-item { order: 1; }
  body.m-items.m-grid td.c-item .item-cell { flex-direction: column; gap: 0; }
  body.m-items.m-grid td.c-item .item-cell img {
    width: 100%; height: 108px; border-radius: 0; object-fit: cover;
    border-bottom: 1px solid var(--line);
  }
  body.m-items.m-grid td.c-item .item-cell > div:last-child { padding: 8px 9px 0; }
  body.m-items.m-grid td.c-item .item-name { font-size: 13.5px; }
  body.m-items.m-grid td.c-item .item-sub { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.m-items.m-grid tbody td.c-attr {
    order: 2; padding: 5px 9px 0 !important;
    font-size: 11.5px; display: -webkit-box !important; -webkit-line-clamp: 2;
  }
  body.m-items.m-grid td.c-price { order: 3; margin-left: auto; padding: 6px 9px 10px !important; }
  body.m-items.m-grid td.c-price .price { font-size: 16px; }
  body.m-items.m-grid td.c-st, body.m-items.m-grid td.c-col,
  body.m-items.m-grid td.c-lv, body.m-items.m-grid td.c-sv,
  body.m-items.m-grid td.c-time, body.m-items.m-grid td.c-go { display: none !important; }
  body.m-items.m-grid tbody tr.hot-draw { border-color: #ffd9b8; background: #fffaf5; }
  body.m-items.m-grid tbody tr.fair-row { border-color: #c9dcff; background: #fbfdff; }
  body.m-items.m-grid tbody tr.drawing-row { border-color: #ffeeda; background: #fffcf8; }

  /* ---------------------------------------------------------------- 分页 */
  .pager { gap: 5px; padding: 12px 8px 4px; flex-wrap: wrap; }
  .pager button { min-width: 40px; height: 38px; font-size: 14px; border-radius: 9px; }
  .pager .info { font-size: 12px; }

  /* ===================================\ 快速找相似条（低频功能 → 默认折叠） */
  .quickbar { margin: 10px 12px 0; padding: 10px 12px; }
  .quickbar .qb-label { font-size: 12px; }
  .quickbar .qb-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .quickbar input[type=text] { width: 100%; }
  .quickbar .btn { width: 100%; height: 40px; }
  body.m-qb .quickbar { display: block; }
  body:not(.m-qb) .quickbar { display: none; }

  /* ============================================ 筛选面板（全屏底部弹出） */
  /* ★ 原 .sidebar 带 max-height:calc(100vh - 90px)，必须显式拨回全屏 */
  body.m-items .sidebar {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 78; width: auto; max-width: none; max-height: none;
    margin: 0; border: 0; border-radius: 0; box-shadow: none;
    background: #fff; display: block; overflow-y: auto; overscroll-behavior: contain;
    padding: 0; transform: translateY(100%);
    transition: transform .26s cubic-bezier(.32, .72, 0, 1);
    visibility: hidden;
  }
  body.m-items .sidebar.m-open { transform: translateY(0); visibility: visible; }

  /* 头部与分组页签吸顶（.sidebar 自身是滚动容器）；head 高度由 mobile.js 量 */
  body.m-items .sidebar .side-head {
    flex: none; padding: 12px 14px 10px; gap: 10px;
    border-bottom: 1px solid var(--line); background: #fff;
    position: sticky; top: 0; z-index: 3;
  }
  body.m-items .sidebar .side-head h2 { font-size: 15px; }
  body.m-items .sidebar .side-head .m-close {
    display: inline-flex; align-items: center;
    height: 30px; padding: 0 11px; border-radius: 15px; font-size: 12.5px; flex: none;
  }

  /* 分组页签（mobile.js 注入） */
  .m-fg-tabs {
    display: flex; gap: 6px; flex: none;
    position: sticky; top: var(--m-head-h, 54px); z-index: 2;
    padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line);
    overflow-x: auto; scrollbar-width: none;
  }
  .m-fg-tabs::-webkit-scrollbar { display: none; }
  .m-fg-tabs .m-fg {
    flex: none; height: 32px; padding: 0 14px; border-radius: 9px;
    background: #f1f4f9; color: var(--text-2); font-size: 13px;
    display: inline-flex; align-items: center; border: 0;
  }
  .m-fg-tabs .m-fg.on { background: var(--brand); color: #fff; font-weight: 500; }
  .m-fg-tabs .m-fg .n { margin-left: 5px; font-size: 11px; opacity: .85; }

  /* 字段区：按当前分组显隐（.sidebar 自身滚动，头部/页签吸顶） */
  body.m-items .sidebar .field {
    padding: 0 14px; margin: 15px 0 0;
  }
  body.m-items .sidebar .field[data-mg] { display: none; }
  body.m-fg1 .sidebar .field[data-mg="1"] { display: block; }
  body.m-fg2 .sidebar .field[data-mg="2"] { display: block; }
  body.m-fg3 .sidebar .field[data-mg="3"] { display: block; }
  body.m-fg4 .sidebar .field[data-mg="4"] { display: block; }
  body.m-items .sidebar .field > label { font-size: 12.5px; margin-bottom: 7px; display: block; }
  body.m-items .sidebar .field select,
  body.m-items .sidebar .field input { height: 42px; }
  body.m-items .sidebar .field .pair { display: flex; align-items: center; gap: 8px; }
  body.m-items .sidebar .field .pair input { flex: 1; min-width: 0; }
  body.m-items .sidebar .field .pair span { color: var(--text-3); }

  /* 快捷区间 → 加大成可点的方块 */
  body.m-items .sidebar .quick-range { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
  body.m-items .sidebar .quick-range i {
    height: 34px; padding: 0 14px; border-radius: 9px; background: #f1f4f9;
    color: var(--text-2); font-size: 12.5px; font-style: normal;
    display: inline-flex; align-items: center; cursor: pointer;
  }
  body.m-items .sidebar .quick-range i:active { background: #e3ebf8; }

  /* 「只看可还价 / 可跨服」勾选项 */
  body.m-items .sidebar .field.checks,
  body.m-items .sidebar .field:has(> label.chk) { display: block; }
  body.m-items .sidebar label.chk {
    display: flex; align-items: center; gap: 9px; height: 42px; margin-bottom: 7px;
    padding: 0 12px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px;
    font-size: 13.5px;
  }
  body.m-items .sidebar label.chk input { width: 18px; height: 18px; flex: none; }

  /* 底部固定：查询（fixed 才能始终贴底；sticky 在内容不足一屏时不生效） */
  body.m-items .sidebar { padding-bottom: 62px; }
  body.m-items .sidebar #btnSearch {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    height: 50px; font-size: 15px; border-radius: 0; width: 100%; margin: 0;
  }
  body.m-items .sidebar .m-sheet-foot {
    flex: none; background: #fff; border-top: 1px solid var(--line);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  /* 面板右上角关闭（mobile.js 注入） */
  .m-sheet-head {
    display: flex; align-items: center; gap: 10px; flex: none;
    padding: 12px 14px 10px; background: #fff; border-bottom: 1px solid var(--line);
  }
  .m-sheet-head .t { flex: 1; font-size: 15px; font-weight: 650; }
  .m-sheet-head .x {
    flex: none; height: 32px; padding: 0 12px; border-radius: 16px;
    border: 1px solid var(--line-strong); background: #fff;
    font-size: 13px; color: var(--text-2);
  }

  /* 遮罩（低于筛选面板，高于底部 Tab） */
  .drawer-mask, .modal-mask { z-index: 77; }
  .m-mask {
    display: block; position: fixed; inset: 0; z-index: 77;
    background: rgba(16, 26, 44, .45); opacity: 0; pointer-events: none;
    transition: opacity .2s;
  }
  .m-mask.on { opacity: 1; pointer-events: auto; }

  /* 原生/自定义下拉的选择列表：必须浮在筛选面板与弹窗之上 */
  .combo-list { z-index: 95; }

  /* ================================================== 详情抽屉（底部面板） */
  .drawer {
    left: 0; right: 0; top: auto; bottom: 0; width: auto;
    max-width: none; height: 94vh; max-height: 94vh;
    border-radius: 16px 16px 0 0; z-index: 90;
    transform: translateY(100%); transition: transform .26s cubic-bezier(.32, .72, 0, 1);
    display: flex; flex-direction: column;
  }
  .drawer.on { transform: translateY(0); }
  .drawer-head { flex: none; padding: 12px 14px; gap: 10px; border-bottom: 1px solid var(--line); }
  .drawer-head #drawerTitle { font-size: 15px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .drawer-body { flex: 1; overflow-y: auto; padding: 12px 14px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .section-title { font-size: 13.5px; margin: 16px 0 8px; }
  .section-title:first-child { margin-top: 0; }

  /* 基本信息 dl：两列紧凑，不再一行一条 */
  .drawer .kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
  .drawer .kv dt { font-size: 12px; color: var(--text-3); padding: 7px 0 2px; }
  .drawer .kv dd { margin: 0; font-size: 13px; padding: 0 0 7px; border-bottom: 1px dashed #eef2f8; word-break: break-all; }

  /* 底部固定操作条（mobile.js 把详情里的按钮组搬过来）
     ★ drawer 自身有 transform → 是 fixed 后代的包含块，fixed 即「相对抽屉贴底」 */
  .m-drawer-actions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 3;
    display: flex; gap: 9px; margin: 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #fff; border-top: 1px solid var(--line);
  }
  .m-drawer-actions .btn { flex: 1; height: 46px; font-size: 14.5px; }
  .m-drawer-actions .btn.ghost { flex: 0 0 96px; }
  .drawer-body { padding-bottom: 96px; }

  /* 明细折叠 */
  .m-more-btn {
    display: block; width: 100%; height: 42px; margin: 14px 0 4px;
    border: 1px dashed var(--line-strong); border-radius: 10px; background: #fff;
    color: var(--text-2); font-size: 13.5px;
  }
  .m-folded { display: none !important; }
  body.m-fold-open .m-folded { display: block !important; }
  body.m-fold-open .m-folded.attr-table { display: table !important; }

  /* ==================================================== 弹窗（全屏底部） */
  .modal {
    left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none;
    max-height: 92vh; border-radius: 16px 16px 0 0; z-index: 90;
    transform: translateY(100%); opacity: 0;
    transition: transform .26s cubic-bezier(.32, .72, 0, 1), opacity .2s;
  }
  /* ★ 必须覆盖原 .modal.on{transform:translate(-50%,-50%) scale(1)} */
  .modal.on { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .modal-body { grid-template-columns: minmax(0, 1fr); padding: 14px; max-height: calc(92vh - 56px); overflow-y: auto; }
  .modal-head { padding: 12px 14px; }
  .modal .sim-form { position: static; }
  .modal .sim-form .field.row { display: block; }
  .modal .sim-form .field.row .chk { display: flex; margin-bottom: 8px; }
  .modal .attr-table, .modal table.wide { display: block; overflow-x: auto; white-space: nowrap; }

  /* ================================================== 「我的」底部面板 */
  .m-me-sheet {
    display: block; position: fixed; left: 12px; right: 12px;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px)); z-index: 85;
    background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
    padding: 6px; transform: translateY(12px) scale(.98); opacity: 0;
    pointer-events: none; transition: .18s;
  }
  .m-me-sheet.on { transform: none; opacity: 1; pointer-events: auto; }
  .m-me-sheet .u { padding: 10px 12px 8px; font-size: 12.5px; color: var(--text-3); }
  .m-me-sheet .u b { color: var(--text); }
  .m-me-sheet button {
    display: block; width: 100%; text-align: left; height: 44px; padding: 0 12px;
    background: none; border: 0; font-size: 14.5px; color: var(--text); border-radius: 10px;
  }
  .m-me-sheet button:active { background: #f1f4f9; }
  .m-me-sheet button.danger { color: var(--red); }

  /* ==================================================== KPI / 图表（其他页） */
  .kpi-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* ★ admin.css 的 .kpi-cards.four 是 4 列（特异性更高），必须显式压回两列，否则溢出 */
  .kpi-cards.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { padding: 12px 13px; min-width: 0; overflow: hidden; }
  .kpi-value { font-size: 19px; }
  .bar-row { grid-template-columns: 96px minmax(0, 1fr) auto; gap: 9px; }
  .bar-label { font-size: 11.5px; }
  .chart-head h2 { font-size: 13.5px; }

  /* ========================================== 其他页面：表格 → 卡片（通用） */
  table.list { display: block; width: 100%; }
  table.list thead { display: none; }
  table.list tbody { display: block; }
  table.list tr {
    display: block; position: relative; margin-bottom: 9px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    padding: 11px 13px; box-shadow: var(--shadow);
  }
  table.list tr.hot-draw { border-left: 4px solid var(--orange); }
  table.list tr.fair-row { border-left: 4px solid #7fb2ff; }
  table.list tr.drawing-row { border-left: 4px solid #ffc98a; }
  table.list td {
    display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px;
    border: 0; padding: 4px 0; align-items: baseline; background: none;
  }
  table.list td[data-label]::before {
    content: attr(data-label); color: var(--text-3); font-size: 11.5px; white-space: nowrap;
  }
  /* 主列整行显示，不带字段名 */
  table.list td.c-item, table.list td.c-time, table.list td.c-attr,
  table.list td.c-sv, table.list td.c-coin-name { display: block; padding: 0 0 6px; }
  table.list td.c-item::before, table.list td.c-time::before,
  table.list td.c-attr::before, table.list td.c-sv::before,
  table.list td.c-coin-name::before { content: none; }
  table.list tr.m-flat { padding: 22px 14px; }
  table.list tr.m-flat td { display: block; text-align: center; }
  table.list tr.m-flat td::before { content: none; }
  /* 其他页面价格也放大一档 */
  table.list .price { font-size: 18px; }

  /* ======================================================== 排行页（微调） */
  body.m-rank .rank-quant { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  body.m-rank .verdict-strip { padding: 10px 12px; gap: 6px; }
  body.m-rank .vs-chip { height: 32px; font-size: 12.5px; }
  body.m-rank .pct-wrap { min-width: 0; }
  body.m-rank .peer-list { display: block; }
  body.m-rank .peer-list tr { display: block; padding: 10px 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  body.m-rank .peer-list td { border: 0; display: block; }
  body.m-rank .peer-list td::before { content: none; }
  body.m-rank .alt-item { max-width: 100%; }
  body.m-rank .alt-name { max-width: none; }
  body.m-rank .filterbar { border-radius: 12px; }

  /* 筛选条：两列网格，勾选项独占一行 */
  .filterbar { padding: 10px 12px; gap: 10px 12px; border-radius: 12px; }
  .filterbar .field { width: calc(50% - 6px); }
  .filterbar .field > label { font-size: 11.5px; }
  .filterbar input, .filterbar select { width: 100%; }
  .filterbar .field.row, .filterbar .field:has(> label.chk),
  .filterbar .field:has(.chk) { width: 100%; }
  .filterbar .filter-actions { width: 100%; margin-left: 0; }
  .filterbar .filter-actions .btn { flex: 1; height: 42px; }

  /* ================================================== 日志页（单列） */
  body.m-logs .log-main { display: block; }
  body.m-logs .log-side { display: block; margin-bottom: 10px; }
  body.m-logs .log-side-item { padding: 10px 12px; }
  body.m-logs .log-lines { font-size: 12px; line-height: 1.75; }
  body.m-logs pre, body.m-logs .raw-log { font-size: 12px; }

  /* ================================================== 账号页 */
  body.m-accounts .acct-card { padding: 13px; }

  /* ================================================== 登录页 */
  .login-wrap { padding: 20px 16px; }
  .login-card { width: auto; max-width: 420px; padding: 24px 20px 20px; }
  .login-card input, .login-card .btn { height: 44px; }

  /* ============================================ 表格里的小控件加触摸目标 */
  .btn { min-height: 34px; }
  .btn.small { min-height: 30px; }
  a.go { display: inline-flex; align-items: center; height: 32px; padding: 0 11px; font-size: 12.5px; }
}

/* 小屏机型（iPhone SE 等）：进一步压缩 */
@media (max-width: 400px) {
  .topbar .brand h1 { font-size: 14px; }
  .m-toolbar { padding-left: 10px; padding-right: 10px; }
  body.m-items .list-head { padding-left: 10px; padding-right: 10px; }
  body.m-items table.list tbody tr { padding: 10px; }
  body.m-items td.c-attr { padding-left: 0 !important; }
  body.m-items.m-grid table.list tbody { padding: 0 10px; }
  body.m-rank .rank-quant { grid-template-columns: minmax(0, 1fr); }
  .filterbar .field { width: 100%; }
}

/* ── 币价页 · 梦幻币 ⇄ 现金换算（2026-10-15）── */
@media (max-width: 900px) {
  .filterbar .coin-conv { width: 100%; }
  .filterbar .coin-conv .conv-row { flex-wrap: nowrap; }
  .filterbar .coin-conv #convWan { width: auto; flex: 1 1 0; min-width: 0; }
  .filterbar .coin-conv .conv-cny { width: auto; flex: 1 1 0; min-width: 0; }
}
