/* 手机版外壳（phone.js 在窄屏时给 <html> 加 .is-phone；2026-10-01 老板：手机上只露收发货、拍照上传、偶尔看报表、临时查一下）。
   整页 = 顶上一行页名 + 中间内嵌页（自己滚）+ 底部一排入口。左边侧栏整块收起。
   全部规则挂在 html.is-phone 下：电脑上一条都不生效（底部那排、「全部」面板电脑上也不显示）。 */
.ph-tabbar, .ph-sheet { display: none; }
.ph-sheet[hidden], .ph-sheet [hidden] { display: none !important; }

html.is-phone, html.is-phone body { height: 100%; overflow: hidden; }
html.is-phone body { min-width: 0; }
html.is-phone .app-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; }
html.is-phone .sidebar { display: none; }
html.is-phone .main-content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
html.is-phone .main-content.has-embed { padding: 0; overflow: hidden; }

/* 顶上一行：页名（+「? 说明」）… 反馈、复制链接（只留 🔗，10-11 起手机上也能把画面发给同事）、账号。人员管理、系统设置、以谁的身份看、数据服务在线这几样手机上不放 */
html.is-phone .topbar { flex: 0 0 auto; min-height: 0; margin: 0; padding: 8px 12px 8px 14px; gap: 8px;
  background: var(--surface); border-bottom: 1px solid var(--border-subtle); }
html.is-phone .topbar > div:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
html.is-phone .topbar h1 { font-size: 17px; line-height: 1.3; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
html.is-phone .topbar .page-tabs { flex-basis: 100%; margin-top: 2px; overflow-x: auto; }
html.is-phone .topbar-right { gap: 6px; }
html.is-phone .topbar-right .topbar-entry,
html.is-phone .topbar-right .api-state,
html.is-phone .topbar-right .va-pick { display: none !important; }
html.is-phone .topbar-right .pf-btn { padding: 5px 8px; }
html.is-phone .topbar-right .pf-btn b { display: none; }
html.is-phone .topbar .topbar-right .share-link-btn { padding: 5px 8px; }
html.is-phone .topbar .topbar-right .share-link-btn b { display: none; }
html.is-phone .va-banner { margin: 0; border-radius: 0; }

/* 中间：内嵌页撑满剩下的高度，自己滚（layoutEmbed 写的像素高度在手机上不用） */
html.is-phone .main-content > .page:not(.embed-page) { padding: 12px; }
html.is-phone .embed-page.active { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; }
html.is-phone .embed-frame { flex: 1 1 auto; min-height: 0; height: auto !important; border-radius: 0; }

/* 底部一排：首页 · 收发货 · 报表 · 问一问 · 全部 */
html.is-phone .ph-tabbar { display: flex; flex: 0 0 auto; align-items: stretch; justify-content: space-around;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border-subtle);
  position: relative; z-index: 40; }
.ph-tab { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 50px; padding: 4px 2px; border: 0; border-radius: 10px; background: transparent; color: var(--text-muted);
  font: inherit; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ph-tab b { font-size: 11px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.ph-tab .ph-ico { display: grid; place-items: center; width: 30px; height: 26px; border-radius: 13px; }
.ph-tab .ph-ico svg { width: 21px; height: 21px; }
.ph-tab.on { color: var(--accent); }
.ph-tab.on .ph-ico { background: var(--accent-soft-bg); }
.ph-tab:active { background: var(--surface-hover); }

/* 「全部」：从底部那排上面盖住整个内容区 */
html.is-phone .ph-sheet { display: block; position: fixed; left: 0; right: 0; top: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 35;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background: var(--canvas); padding: 0 14px 20px; }
.ph-sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; margin: 0 -14px 6px; padding: 10px 14px;
  background: var(--canvas); border-bottom: 1px solid var(--border-subtle); }
.ph-q { flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--border-control); border-radius: 10px;
  background: var(--surface); color: var(--text-primary); font-size: 16px; outline: none; }
.ph-q:focus { border-color: var(--accent); }
.ph-x { flex: 0 0 auto; width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--surface-sunken); color: var(--text-secondary);
  font-size: 22px; line-height: 1; cursor: pointer; }
.ph-grp { margin-top: 12px; }
.ph-grp h3 { margin: 0 2px 6px; font-size: 13px; font-weight: 700; color: var(--text-secondary); letter-spacing: .06em; }
.ph-apps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 8px 4px; border-radius: 12px; background: var(--surface); }
.ph-results { margin-top: 10px; }
.ph-app { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 2px; border-radius: 10px;
  color: var(--text-primary); text-decoration: none; font-size: 12px; -webkit-tap-highlight-color: transparent; }
.ph-app:active { background: var(--surface-hover); }
.ph-app .nm { max-width: 100%; line-height: 1.3; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ph-app .ph-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; font-size: 15px; font-weight: 700;
  color: var(--n-0); background: color-mix(in srgb, var(--n-500) 82%, transparent); }
.ph-app .ph-ico svg { width: 20px; height: 20px; }
.ph-app[data-hue="amber"] .ph-ico { background: color-mix(in srgb, var(--a-600) 82%, transparent); }
.ph-app[data-hue="blue"] .ph-ico { background: color-mix(in srgb, var(--b-600) 82%, transparent); }
.ph-app[data-hue="teal"] .ph-ico { background: color-mix(in srgb, var(--chart-6) 82%, transparent); }
.ph-app[data-hue="red"] .ph-ico { background: color-mix(in srgb, var(--r-600) 82%, transparent); }
.ph-app[data-hue="violet"] .ph-ico { background: color-mix(in srgb, var(--v-600) 82%, transparent); }
.ph-app[data-hue="gray"] .ph-ico { background: color-mix(in srgb, var(--n-500) 82%, transparent); }
.ph-app.desk .ph-ico { opacity: .55; }
.ph-app.desk { color: var(--text-secondary); }
/* 顶上「我的工作」里已有的：下面各组照样列，淡一档（同首页全部功能，10-17） */
.ph-app.in-work .ph-ico { opacity: .45; }
.ph-app.in-work { color: var(--text-muted); }
.ph-desk { margin-top: 18px; }
.ph-desk > summary { display: block; padding: 10px 4px; cursor: pointer; color: var(--text-secondary);
  font-size: 13px; font-weight: 600; list-style: none; }
.ph-desk > summary::-webkit-details-marker { display: none; }
.ph-desk > summary::before { content: '▸ '; }
.ph-desk[open] > summary::before { content: '▾ '; }
.ph-desk > summary small { display: block; margin: 2px 0 0 1.1em; font-size: 12px; font-weight: 400; color: var(--text-muted); }
.ph-empty { margin: 18px 4px; color: var(--text-muted); font-size: 13px; line-height: 1.6; grid-column: 1 / -1; }

/* 提示条别压在底部那排上 */
html.is-phone #toast { left: 12px; right: 12px; bottom: calc(66px + env(safe-area-inset-bottom)); max-width: none; }

/* 登录框：按钮字别被挤成一字一行；输入框 16px，iPhone 点进去不自己放大 */
html.is-phone .modal-backdrop button { white-space: nowrap; }
html.is-phone .modal-backdrop input, html.is-phone .modal-backdrop select, html.is-phone .modal-backdrop textarea { font-size: 16px; }
