/* ==========================================================================
   活动系统 · 手机端补丁（2026-11-15）
   style.css 已有底部导航 / 侧栏 / 表单的基础适配；这里只补两件事：
   1) 宽表格改成卡片（原来要左右滑 3 屏才看完一行）
   2) 一排按钮 / 筛选条换行，不再被裁掉
   所有规则只在 ≤900px 生效，桌面端零改动。
   ========================================================================== */

@media (max-width: 900px) {
  /* ── 1. 表格卡片化（m-cards 由 /activity/static/js/mobile.js 打标） ── */
  .table-wrap.m-cards-wrap,
  .performance-table-wrap.m-cards-wrap,
  .table-responsive.m-cards-wrap { overflow: visible !important; }

  table.m-cards {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }
  table.m-cards > thead,
  table.m-cards > tfoot { display: none !important; }
  table.m-cards > tbody { display: block !important; }

  table.m-cards > tbody > tr {
    display: block !important;
    /* [2026-11-15] 底色跟皮肤变量走：深色皮肤 --bg-card=#1C1C1E、正文白字，
       这里写死 #fff 会变成白底白字，字全看不见。 */
    background: var(--bg-card, #fff);
    border: 1px solid var(--gray-200, #E4E7EC);
    border-radius: 14px;
    padding: 10px 12px;
    margin: 0 0 10px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  }
  table.m-cards > tbody > tr:nth-child(even),
  table.m-cards > tbody > tr:hover { background: var(--bg-card, #fff) !important; }

  table.m-cards > tbody > tr > td {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    position: static !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 4px 0 !important;
    font-size: .88rem;
    line-height: 1.5;
    white-space: normal !important;
    word-break: break-word;
    background: transparent !important;
  }
  table.m-cards > tbody > tr > td::before {
    content: attr(data-mlabel);
    flex: 0 0 5.6em;
    color: var(--gray-500, #667085);
    font-size: .78rem;
    line-height: 1.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* 原来的首列固定（sticky）在卡片模式下必须解除 */
  table.m-cards > tbody > tr > td:first-child {
    position: static !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  table.m-cards > tbody > tr > td.m-title {
    display: block !important;
    text-align: left !important;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--gray-900, #0E1116);
    border-bottom: 1px dashed var(--gray-200, #EAECF0) !important;
    padding: 0 0 8px !important;
    margin-bottom: 4px;
  }
  table.m-cards > tbody > tr > td.m-title::before { display: none; }
  table.m-cards > tbody > tr > td.m-none,
  table.m-cards > tbody > tr > td[data-mlabel=""] { display: none !important; }
  table.m-cards > tbody > tr > td.m-actions {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px dashed var(--gray-200, #EAECF0) !important;
    margin-top: 6px;
    padding: 8px 0 0 !important;
  }
  table.m-cards > tbody > tr > td.m-actions::before { display: none; }
  table.m-cards > tbody > tr > td.m-actions .btn { min-height: 34px; padding: 5px 12px; font-size: .84rem; }
  table.m-cards > tbody > tr > td[colspan] { display: block !important; text-align: center; }
  table.m-cards > tbody > tr > td[colspan]::before { display: none; }

  /* ── 2. 工具条 / 芯片行：允许换行 ── */
  .toolbar, .rec-bar, .tb-filters, .customer-toolbar { flex-wrap: wrap; row-gap: 8px; }
  /* 按钮组 / 左右工具条：原来 nowrap，两个大按钮会被右边缘切掉 */
  .page-toolbar, .toolbar-left, .toolbar-right { flex-wrap: wrap; row-gap: 8px; }
  .toolbar-left .btn, .toolbar-right .btn { flex: 1 1 auto; }
  .btn-group { flex-wrap: wrap; }
  .content-wrap { padding-left: 12px; padding-right: 12px; }

  /* 日期区间一格挤两个输入框时，让它们等宽 */
  .tb-filters .form-control,
  .customer-toolbar .form-control { min-width: 0; }

  /* 分页：页码多时一行排不下会被裁掉 */
  .pagination { flex-wrap: wrap; row-gap: 6px; justify-content: center; }
  .pagination .page-link { padding: .22rem .45rem; font-size: .78rem; }

  /* 表头的统计小卡在窄屏两列并排 */
  .stat-grid { grid-template-columns: 1fr 1fr !important; }
}
