/* =========================================================
   移动端适配层（≤760px）
   表格转卡片、弹窗全屏、工具栏自适应
   ========================================================= */

@media (max-width: 760px) {
  /* ---------- 布局 ---------- */
  .content { padding: 14px 12px 80px; }
  .topbar { height: 54px; flex-basis: 54px; padding: 0 12px; gap: 10px; }
  .topbar h1 { font-size: 15.5px; }
  .topbar .sub { display: none; }
  .topbar-right { gap: 8px; }

  /* ---------- 统计卡两列 ---------- */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px 14px; min-width: 0; }

  /* ---------- 工具栏 / 筛选栏 ---------- */
  .card-head { flex-wrap: wrap; gap: 10px; padding: 14px 14px; }
  .filters, .toolbar, [class*="Toolbar"] {
    flex-wrap: wrap !important;
  }
  .filters .input, .filters .select {
    width: 100% !important; min-width: 0 !important; flex: 1 1 100%;
  }
  /* 选中工具条按钮可换行 */
  #libToolbar, #flToolbar { flex-wrap: wrap; gap: 8px; }
  #libToolbar .btn, #flToolbar .btn { flex: 1 1 auto; }

  /* ---------- 表格 → 卡片 ---------- */
  .tb thead { display: none; }
  .tb, .tb tbody { display: block; }
  .tb tbody tr {
    display: block;
    margin: 0; padding: 12px 14px 10px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }
  .tb tbody tr:last-child { border-bottom: none; }
  .tb tbody tr.selected { background: var(--brand-50); }
  .tb td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; padding: 7px 0; border: none !important;
    text-align: right;
  }
  .tb td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--text-3); font-size: 12px; font-weight: 500;
    text-align: left; white-space: nowrap;
  }
  /* 无标签的列（复选框、素材主体）特殊处理 */
  .tb td:not([data-label]) { justify-content: flex-start; text-align: left; }
  /* 素材名称列：占满整行 */
  .tb td.name-td {
    flex-wrap: wrap; padding: 2px 0 6px;
    border-bottom: 1px dashed var(--line) !important;
    margin-bottom: 4px;
  }
  .tb td.name-td::before { display: none; }
  /* 操作列：按钮右对齐一行 */
  .tb td.tr { justify-content: flex-end; padding-top: 8px; }
  .tb td.tr::before { display: none; }
  .tb td.tr .btn { margin-left: 8px; }
  /* 复选框列固定在卡片右上角（仅当选首列为复选框时） */
  .tb td:first-child:has(input.cb) {
    position: absolute; top: 14px; right: 14px; margin: 0;
  }
  .tb tbody tr { position: relative; padding: 12px 14px 10px; }

  /* 批次分组头部 */
  .batch-head {
    flex-wrap: wrap; gap: 8px; padding: 10px 12px;
    position: static;
  }
  .batch-head > div:first-child { flex: 1 1 100%; }
  .batch-head .row { width: 100%; justify-content: space-between; }

  /* ---------- 弹窗 ---------- */
  .modal-mask { padding: 0; }
  .modal {
    width: 100% !important; max-width: 100% !important;
    max-height: 100vh !important; height: 100vh;
    border-radius: 0 !important; margin: 0 !important;
    display: flex; flex-direction: column;
  }
  .modal-head { padding: 16px 16px 0; }
  .modal-body { padding: 14px 16px; flex: 1; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }

  /* ---------- 上传区 ---------- */
  .dropzone { padding: 26px 14px !important; }
  .dropzone h4, .dropzone p { text-align: center; }

  /* ---------- 表单 ---------- */
  .row.gap-10 { flex-wrap: wrap; }
  .row.gap-10 .field.grow { flex: 1 1 45%; }
  .btn { height: 40px; }
  .btn-sm { height: 34px; }
  .btn-icon { width: 36px; }

  /* ---------- 其他 ---------- */
  code.mono { word-break: break-all; }
  .copyrow { flex-wrap: wrap; }
  .copyrow code { flex: 1 1 100%; }
  .empty { padding: 36px 16px; }
  .name-cell .thumb { flex: 0 0 34px; }
}

/* 触屏友好：小屏幕上隐藏桌面悬浮效果依赖 */
@media (hover: none) {
  .btn:active { opacity: .85; }
  .nav-item:active { background: var(--brand-50); }
}

/* 超小屏（≤380px）统计卡单列 */
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
}
