/* ============================================================
 * 手机版样式（P0 客户链路）
 *
 * 规矩：
 *   1. 全部规则都写在 @media (max-width: 768px) 里 —— 电脑端一条都不生效
 *   2. 不覆盖全局属性（html/body 只加 padding-bottom，且只在小屏）
 *   3. 只改布局，不改任何业务逻辑；JS 的抽屉/弹层都由独立脚本控制
 *
 * 加新页面时：把该页面的小屏规则追加到本文件末尾，勿写进 app.css
 * ============================================================ */

/* 手机底栏：默认不显示，只有小屏出现 */
.m-tabbar {
  display: none;
}

@media (max-width: 768px) {
  /* ---------- 顶部公告条：收成一行 ---------- */
  #client-notice .cn-in {
    flex-wrap: nowrap !important;
    padding: 8px 12px !important;
    gap: 8px !important;
  }
  #client-notice .cn-tag {
    flex: 0 0 auto;
    font-size: 10px;
    padding: 2px 7px;
  }
  #client-notice .cn-txt {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 12.5px !important;
    line-height: 1.4;
  }
  #client-notice .cn-btn {
    display: none !important;
  }
  #client-notice .cn-x {
    flex: 0 0 auto;
    font-size: 18px;
    padding: 0 2px;
    opacity: .9;
  }

  /* ---------- 顶栏：只留 logo + 登录 + 汉堡 ---------- */
  .topbar-inner {
    padding: 10px 14px;
    gap: 10px;
  }
  .wordmark {
    font-size: 17px;
    gap: 8px;
  }
  .wordmark-mark {
    width: 32px;
    height: 32px;
    font-size: 11px;
    border-radius: 9px;
  }
  .topbar-account {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 38px;
  }
  .topbar-contact {
    display: none !important; /* 客服挪到底栏 */
  }
  .menu-toggle {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  /* ---------- Hero 首屏 ---------- */
  .hero {
    padding: 26px 16px 10px !important;
  }
  .hero .eyebrow {
    font-size: 11px;
    letter-spacing: 1.2px;
  }
  .hero h1 {
    font-size: 33px !important;
    line-height: 1.26 !important;
    margin-top: 10px !important;
  }
  .hero p {
    font-size: 15px !important;
    line-height: 1.65 !important;
    margin-top: 12px !important;
  }
  .hero-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
  }
  .hero-actions .button {
    flex: 1;
    min-height: 48px;
    font-size: 15px;
    padding: 0 12px;
  }
  .hero-stats {
    gap: 14px;
    margin-top: 22px;
    font-size: 12px;
  }
  .hero-stats strong {
    font-size: 21px;
  }

  /* ---------- 内容区块：压缩留白 ---------- */
  .section-block {
    padding: 28px 16px;
  }
  .section-block h2 {
    font-size: 24px;
    line-height: 1.3;
  }
  .section-nav {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    gap: 8px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .section-nav::-webkit-scrollbar {
    display: none;
  }

  /* ---------- 底部快捷栏 ---------- */
  .m-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(10px);
    border-top: 2px solid var(--ink, #241b31);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .m-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted, #6b6478);
    text-decoration: none;
  }
  .m-tab i {
    font-style: normal;
    font-size: 19px;
    line-height: 1;
  }
  .m-tab.is-on {
    color: var(--purple, #6d24ff);
  }

  /* 出品方角标：抬到底栏上方，别被压住 */
  #vendor-attribution {
    bottom: calc(64px + env(safe-area-inset-bottom) + 8px) !important;
    font-size: 10px !important;
    padding: 4px 8px !important;
  }

  /* 给底栏让位，避免最后一行被压住 */
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

/* ============================================================
 * 后台 / 打手端外壳（≤768px）
 * 只改布局：顶栏压缩、侧栏改成可滑动的整列、筛选单列、
 * 表格横向滚动（首列固定）、隐藏右侧好友栏与底部音乐条。
 * ============================================================ */
@media (max-width: 768px) {
  /* 外壳：不再用「左栏 + 内容」的桌面布局 */
  .admin-shell {
    display: block !important;
    min-height: 0 !important;
  }

  /* 侧栏：20 项全部可达（横向滑动，一行一个胶囊） */
  .admin-nav {
    position: static !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    padding: 12px 14px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    margin: 10px 14px !important;
    scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar {
    display: none;
  }
  .admin-nav a,
  .admin-nav button,
  .admin-nav .nav-item {
    flex: 0 0 auto !important;
    white-space: nowrap;
    padding: 9px 14px !important;
    font-size: 14px !important;
    border-radius: 999px !important;
  }

  /* 页面标题与说明 */
  .page-head h1 {
    font-size: 24px !important;
  }
  .page-head p {
    font-size: 14px !important;
    line-height: 1.7;
  }

  /* 筛选区：单列，输入框撑满 */
  form.filters {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  form.filters .field {
    width: auto !important;
    min-width: 0 !important;
  }
  form.filters input,
  form.filters select {
    width: 100% !important;
    min-height: 44px;
    font-size: 16px !important; /* 防 iOS 聚焦自动放大 */
  }

  /* 表格：横向滚动，首列固定，保证看得到订单号 */
  .table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
    padding-bottom: 4px;
  }
  table.data {
    min-width: 760px;
  }
  table.data thead th:first-child,
  table.data tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
  }
  table.data thead th:first-child {
    background: #f4f0ff;
  }

  /* 右侧好友栏：手机上会盖住内容，先隐藏（P1 再做成底栏入口） */
  #fdock {
    display: none !important;
  }

  /* 底部音乐条：会压住最后一行，手机上收起 */
  .music-bar,
  #music-bar {
    display: none !important;
  }

  /* 空表格提示 / 分页 */
  .pager,
  .table-pager {
    flex-wrap: wrap;
    gap: 8px;
  }
}
/* ---------- 补充：顶栏一行、音乐条隐藏、导航更紧凑 ---------- */
@media (max-width: 768px) {
  /* 顶栏（后台/打手端由 JS 渲染）：强制单行，多的收起来 */
  .topbar-inner {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topbar-inner::-webkit-scrollbar {
    display: none;
  }
  .topbar-inner > * {
    flex: 0 0 auto;
  }
  .topbar-inner .btn,
  .topbar-inner a,
  .topbar-inner button {
    font-size: 13px !important;
    padding: 8px 12px !important;
    min-height: 38px;
    white-space: nowrap;
  }

  /* 音乐条（.mbar 是 JS 生成的真名） */
  .mbar {
    display: none !important;
  }

  /* 侧栏胶囊小一点，一屏能扫到更多 */
  .admin-nav a,
  .admin-nav button,
  .admin-nav .nav-item {
    padding: 8px 12px !important;
    font-size: 13px !important;
  }
}
/* ---------- 卡片列表（由 mobile.js 生成） ---------- */
@media (max-width: 768px) {
  table.data.m-hidden-table {
    display: none !important;
  }
  .m-cards {
    display: block;
  }
  .m-card {
    border: 2px solid var(--ink, #241b31);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 3px 0 #ece6fb;
    padding: 12px 14px;
    margin: 0 0 12px;
  }
  .m-card-h {
    font-size: 16px;
    font-weight: 900;
    padding-bottom: 8px;
    margin-bottom: 6px;
    border-bottom: 1px dashed var(--line, #e7e1f5);
    word-break: break-all;
  }
  .m-card-h a,
  .m-card-h button {
    font-size: 15px;
  }
  .m-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    font-size: 14px;
  }
  .m-k {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted, #6b6478);
  }
  .m-v {
    flex: 1 1 auto;
    text-align: right;
    min-width: 0;
    word-break: break-word;
  }
  /* 操作列：按钮横排、不换行、可横向滑 */
  .m-row:last-child .m-v {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
  }
  .m-v .btn,
  .m-v button {
    min-height: 38px;
    font-size: 13px !important;
    padding: 6px 12px !important;
  }

  /* ---------- 下单页底部固定提交条 ---------- */
  .m-submit-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    background: rgba(255, 255, 255, .98);
    border-top: 2px solid var(--ink, #241b31);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
  }
  .m-submit-bar .btn,
  .m-submit-bar button {
    flex: 1;
    min-height: 48px;
    font-size: 16px !important;
  }
  body.has-m-submit-bar {
    padding-bottom: calc(86px + env(safe-area-inset-bottom)) !important;
  }
}
@media (max-width: 768px) {
  /* 顶栏里过长的文字（切换账号提示等）截断，别把整条撑爆 */
  .topbar-inner > a,
  .topbar-inner > span,
  .topbar-inner > button {
    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* 出品方角标：小屏缩小并贴底，避免挡住卡片文字 */
  #vendor-attribution {
    font-size: 10px !important;
    padding: 3px 7px !important;
    opacity: .92;
  }
}
/* ---------- 后台菜单：默认收起，点开看全部 ---------- */
@media (max-width: 768px) {
  .m-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: calc(100% - 28px);
    margin: 10px 14px 6px;
    padding: 12px 16px;
    border: 2px solid var(--ink, #241b31);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 0 #ece6fb;
    font-size: 15px;
    font-weight: 900;
    color: var(--ink, #241b31);
  }
  .m-nav-toggle .m-nav-count {
    font-size: 12px;
    font-weight: 800;
    color: var(--purple, #6d24ff);
    background: #f1e9ff;
    border-radius: 999px;
    padding: 3px 10px;
  }
  /* 收起时不占地方 */
  .admin-nav {
    display: none !important;
  }
  .admin-nav.m-open {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin: 0 14px 12px !important;
    padding: 10px !important;
    max-height: 62vh;
    overflow-y: auto !important;
    border: 2px solid var(--ink, #241b31);
    border-radius: 14px;
    background: #fff;
  }
  .admin-nav.m-open a,
  .admin-nav.m-open button,
  .admin-nav.m-open .nav-item {
    width: auto !important;
    justify-content: space-between;
    font-size: 14px !important;
    padding: 10px 12px !important;
  }
}
/* ---------- 兜底：手机端禁止整页横向滚动 ----------
 * 原因：某个宽元素（表格/长按钮）会把文档撑宽，用户往右滑一点，
 * 固定宽度的顶栏就盖不住，右边露出页面底色（看起来像粉色方块）。
 * 这里把文档宽度锁死；表格自己的横向滚动仍保留（在 .table-wrap 里）。
 */
@media (max-width: 768px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
  }
  body {
    position: relative;
  }
  /* 顶栏自己也不许被内撑出去 */
  .topbar,
  #topbar {
    max-width: 100%;
    overflow: hidden;
  }
  .topbar-inner {
    max-width: 100%;
    width: 100%;
  }
  /* 任何 fixed 元素都不许超出视口 */
  #topbar,
  .m-tabbar,
  .m-submit-bar,
  #vendor-attribution {
    max-width: 100vw;
  }
}
/* ---------- 去掉手机端的粉色光晕、顶栏改不透明 ----------
 * 症状：右上角出现一块粉色方块，像有元素溢出。
 * 原因：body::before 的两团装饰光晕（右边那团是粉色）在手机上
 *       透过半透明顶栏露出来，边缘被顶栏切口切成方块。
 * 处理：手机上不画光晕；顶栏背景改纯白，彻底盖住底下内容。
 */
@media (max-width: 768px) {
  body::before {
    background-image: none !important;
  }
  .topbar,
  #topbar {
    background: #fff !important;
    backdrop-filter: none !important;
  }
  .topbar-inner {
    background: #fff !important;
  }
}
/* ---------- 顶栏真正的原因：桌面导航条还在 ----------
 * .topnav 在手机上仍占 362px，把「账号 + 切换账号」挤出屏幕，
 * 顶栏内容总宽 835px，于是右边露出页面底色（粉色方块）。
 * 手机上隐藏桌面导航，顶栏只留：logo + 账号 + 切换账号。
 */
@media (max-width: 768px) {
  .topbar .topnav,
  #topbar .topnav {
    display: none !important;
  }
  .topbar .spacer,
  #topbar .spacer {
    display: none !important;
  }
  .topbar .userchip,
  #topbar .userchip {
    max-width: 30vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .userchip img,
  #topbar .userchip img {
    width: 22px;
    height: 22px;
  }
}
/* 顶栏横向空间不够：手机端隐藏「账号胶囊」，只留 logo + 切换账号 + 退出 */
@media (max-width: 768px) {
  .topbar .userchip,
  #topbar .userchip {
    display: none !important;
  }
  .topbar .brand,
  #topbar .brand {
    font-size: 16px !important;
    gap: 6px;
  }
  .topbar .btn.btn-sm,
  #topbar .btn.btn-sm {
    padding: 8px 10px !important;
    font-size: 13px !important;
  }
}
/* ---------- 客服工作台：5 列看板 → 列切换 ----------
 * 桌面是横向 5 列，手机上每列都比屏幕宽，必须左右拖才能看全。
 * 手机端改成：顶部一排列标签，点哪列显示哪列，整屏宽。
 */
@media (max-width: 768px) {
  .cs-board {
    display: block !important;
    overflow: visible !important;
    gap: 0 !important;
  }
  .cs-board .cs-col {
    display: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 0 14px !important;
  }
  .cs-board .cs-col.m-on {
    display: block !important;
  }
  .cs-board .cs-col > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
  }

  /* 列标签 */
  .m-cs-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 2px 10px;
    margin-bottom: 6px;
  }
  .m-cs-tabs::-webkit-scrollbar {
    display: none;
  }
  .m-cs-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border: 2px solid var(--ink, #241b31);
    border-radius: 999px;
    background: #fff;
    font-size: 14px;
    font-weight: 900;
    color: var(--ink, #241b31);
  }
  .m-cs-tab .m-cs-n {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #f1e9ff;
    color: var(--purple, #6d24ff);
    font-size: 12px;
    text-align: center;
  }
  .m-cs-tab.is-on {
    background: var(--purple, #6d24ff);
    border-color: var(--purple, #6d24ff);
    color: #fff;
  }
  .m-cs-tab.is-on .m-cs-n {
    background: rgba(255, 255, 255, .22);
    color: #fff;
  }

  /* 单子卡片：撑满一列，内部按钮换行 */
  .cs-board .cs-stack,
  .cs-board .cs-card {
    width: 100% !important;
    max-width: 100% !important;
  }
  .cs-board .cs-card .row,
  .cs-board .cs-card .actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .cs-board .cs-card .actions .btn {
    flex: 1 1 auto;
    min-height: 40px;
  }
}
/* 中和表格上的内联 min-width（有的页面写死 1040/1180px，手机上会撑出横向拖动） */
@media (max-width: 768px) {
  table.data {
    min-width: 0 !important;
    width: 100% !important;
  }
  .table-wrap {
    max-width: 100% !important;
  }
  .m-card-empty {
    text-align: center;
    color: var(--muted, #6b6478);
    font-size: 14px;
    padding: 18px 14px;
  }
}