* { box-sizing: border-box; margin: 0; padding: 0; }

/* 安全区：env()（iOS）与 Android 原生注入的 --safe-area-* 取较大值 */
:root {
  --safe-area-top: 0px;
  --safe-area-right: 0px;
  --safe-area-bottom: 0px;
  --safe-area-left: 0px;
  --keyboard-inset: 0px;
  --keyboard-scroll-pad: 0px;
  --sat: max(env(safe-area-inset-top, 0px), var(--safe-area-top, 0px));
  --sar: max(env(safe-area-inset-right, 0px), var(--safe-area-right, 0px));
  --sab: max(env(safe-area-inset-bottom, 0px), var(--safe-area-bottom, 0px));
  --sal: max(env(safe-area-inset-left, 0px), var(--safe-area-left, 0px));
  /* 全站统一：状态栏下方留给「← 返回」的顶距 */
  --page-safe-top: max(28px, var(--sat, 0px), var(--safe-area-top, 0px), env(safe-area-inset-top, 0px));
}

html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f7;
  color: #1c1c1e;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* 输入法弹出：给滚动区留出底部垫高，避免最后一行贴键盘 */
body.app-keyboard-open .view.active,
body.app-keyboard-typing .view.active,
body.app-keyboard-open [data-scroll],
body.app-keyboard-typing .pro-det-panel-scroll,
body.app-keyboard-open .pro-det-panel-scroll {
  scroll-padding-bottom: max(24px, var(--keyboard-scroll-pad, 0px));
  padding-bottom: max(0px, var(--keyboard-inset, 0px));
}

/*
 * 各页顶栏统一避让状态栏 / 刘海 / 挖孔。
 * 背景色仍延伸进状态栏区域，按钮与文字落在安全区内。
 */
.sales-top-bar,
.cd2-top-bar,
.cd-top-bar,
.cla-toolbar,
.cfa-toolbar,
.sc-toolbar,
.ss-toolbar,
.sa-toolbar,
.rb-toolbar,
.rba-detail-toolbar,
.ila-toolbar,
.insp-toolbar,
.ih-toolbar,
.ia-toolbar,
.insp-loc-toolbar,
.pref-insp-toolbar,
.pro-det-toolbar,
.pro-rd-headbar,
.pro-rd-back,
.pro-record-list-back,
.pro-index-header,
.pro-project-header,
.pcfg2-topbar,
.toolbar {
  padding-top: calc(10px + var(--sat)) !important;
  padding-left: calc(12px + var(--sal));
  padding-right: calc(12px + var(--sar));
}
html.sa-shell-lock,
body.sa-shell-lock {
  height: 100%;
  overflow: hidden;
}
.view { display: none; padding: 20px 16px 32px; max-width: 480px; margin: 0 auto; }
.view:not(.active) { display: none !important; }
.view.active { display: block; }

/* Account center owns its vertical scroll; body is intentionally scroll-locked. */
#view-binding.active {
  height: 100%;
  max-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(32px, calc(20px + var(--sab)));
}

/* 全屏 ERP 子页：仅在 active 时用 flex 布局 */
.view-erp-home.active,
.view-clue-distribute.active,
.view-clue-list-admin.active,
.view-clue-flow-admin.active,
.view-salary-config.active,
.view-salary-scheme.active,
.view-salary-admin.active,
.view-invoice-upload.active,
.view-invoice-list-admin.active,
.view-invoice-list-staff.active,
.view-invoice-detail.active,
.view-reimbursement-hub.active,
.view-reimbursement-submit.active,
.view-reimbursement-list-staff.active,
.view-reimbursement-admin.active,
.view-reimbursement-audit.active,
.view-inspection-list.active,
.view-inspection-hall.active,
.view-inspection-accept.active,
.view-pro-detect.active,
.view-sales-clue-list.active,
.view-clue-detail-v2.active,
.pro-index-view.active,
.pcfg2-view.active,
.pitems-view.active,
.pitema-view.active,
.pitemi-view.active {
  display: flex !important;
  flex-direction: column;
  max-width: none;
  margin: 0;
  padding: 0;
  /* 统一顶栏安全区：三页返回键同一高度 */
  padding-top: var(--page-safe-top) !important;
  height: 100%;
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
}

/*
 * 这两个页面的顶栏自身已经使用 --sat / --sal / --sar 避让系统状态栏。
 * 外层若再使用 --page-safe-top，会在高分辨率、挖孔屏设备上把安全区叠加两次，
 * 造成标题栏整体明显下沉。这里只移除重复的外层占位，实际安全距离仍由顶栏动态控制。
 */
.view-sales-clue-list.active,
.view-pro-detect.active {
  padding-top: 0 !important;
}

/* 专业版相关页：「← 返回」统一外观与边距 */
.pro-index-back,
.pitems-back,
.pitema-back,
.pitemi-back,
.pro-project-back,
.pcfg2-back {
  display: inline-flex !important;
  align-items: center;
  align-self: flex-start;
  flex-shrink: 0;
  margin: 8px 16px 4px !important;
  padding: 8px 4px !important;
  min-height: 40px;
  border: none !important;
  background: transparent !important;
  color: #2e6bd9 !important;
  font-size: 15px !important;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  position: relative;
  z-index: 5;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* 登录页 — 验车日记工作室 */
.view-login {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(180deg, #f3f3f5 0%, #ececef 100%);
}

.view-login.active {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.login-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding:
    max(24px, var(--sat))
    max(20px, var(--sar))
    max(24px, var(--sab))
    max(20px, var(--sal));
  box-sizing: border-box;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 28px;
  padding: clamp(28px, 6vw, 36px) clamp(20px, 5vw, 28px) clamp(24px, 5vw, 32px);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  box-sizing: border-box;
}

.login-title {
  font-size: clamp(20px, 5.5vw, 22px);
  font-weight: 600;
  color: #1c1c1e;
  text-align: center;
  margin: 0 0 28px;
  letter-spacing: 0.02em;
  line-height: 1.35;
  word-break: keep-all;
}

.login-input {
  display: block;
  width: 100%;
  border: 1px solid #e8e8ed;
  background: #fff;
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 15px;
  color: #1c1c1e;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input::placeholder {
  color: #a1a1aa;
}

.login-input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.login-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #2563eb;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.22);
  transition: transform 0.15s, box-shadow 0.15s;
}

.login-btn:hover {
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

.login-btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
}

.login-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.login-footer {
  width: 100%;
  max-width: 360px;
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
  color: #8e8e93;
  line-height: 1.5;
  flex-shrink: 0;
}

.login-footer-in-card {
  max-width: none;
  margin-top: 20px;
  margin-bottom: 0;
}

#view-register.active .login-shell {
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login-link {
  border: none;
  background: none;
  color: #007aff;
  font-size: 14px;
  padding: 0 4px;
  cursor: pointer;
}

.login-select {
  appearance: auto;
}

.login-err {
  color: #ef4444;
  font-size: 13px;
  text-align: center;
  margin: 14px 0 0;
  min-height: 18px;
}

h1 { font-size: 26px; color: #007aff; margin-bottom: 4px; }
.sub { font-size: 13px; color: #8e8e93; margin-bottom: 24px; }
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  margin-bottom: 16px;
}
label { display: block; font-size: 13px; color: #636366; margin-bottom: 6px; }
input, textarea, select {
  width: 100%;
  border: none;
  background: #f2f2f7;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  margin-bottom: 14px;
}
textarea { min-height: 100px; resize: vertical; }
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: #007aff; color: #fff; }
.btn-primary:disabled { opacity: .6; }
.btn-danger { background: #ff3b30; color: #fff; padding: 8px 12px; width: auto; font-size: 13px; }
.btn-full-danger { width: 100%; margin-top: 10px; padding: 12px; font-size: 15px; }
.btn-ghost { background: #f2f2f7; color: #636366; padding: 8px 12px; width: auto; font-size: 13px; margin-right: 8px; }
.btn-accent { background: #007aff; color: #fff; }
.page-title { margin: 0; font-size: 20px; color: #1c1c1e; }
.photo-preview-box {
  display: flex; flex-wrap: wrap; gap: 10px; min-height: 80px;
  padding: 12px; background: #f2f2f7; border-radius: 10px; margin-bottom: 12px;
}
.photo-empty { font-size: 13px; color: #8e8e93; width: 100%; text-align: center; padding: 16px 0; }
.photo-thumb-wrap { position: relative; width: 88px; height: 88px; }
.photo-thumb { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; background: #ddd; image-orientation: from-image; }
.photo-remove {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border: none; border-radius: 50%; background: #ff3b30; color: #fff; font-size: 14px; line-height: 22px; padding: 0;
}
.photo-actions { display: flex; gap: 10px; margin-bottom: 10px; }
.btn-half { flex: 1; width: auto; padding: 12px; font-size: 15px; }
.photo-hint { font-size: 11px; color: #aeaeb2; margin-bottom: 14px; line-height: 1.4; }
.photo-badge { font-size: 12px; color: #007aff; font-weight: normal; margin-left: 6px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.err { color: #ff3b30; font-size: 13px; text-align: center; margin-top: 12px; }
.hint { text-align: center; font-size: 12px; color: #aeaeb2; margin-top: 16px; }
.item {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.item-main { flex: 1; min-width: 0; cursor: pointer; }
.item-title { font-size: 16px; font-weight: 600; }
.item-note { font-size: 13px; color: #636366; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 11px; color: #aeaeb2; margin-top: 4px; }
.empty { text-align: center; color: #8e8e93; padding: 40px 16px; font-size: 14px; }
.binding-intro { font-size: 13px; color: #636366; line-height: 1.6; margin-bottom: 16px; }
.binding-status {
  background: #f2f2f7;
  color: #636366;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 14px;
  word-break: break-all;
}
.binding-status.bound { background: #e8f7ee; color: #1f7a3f; }
.binding-status.unbound { background: #fff7e6; color: #9a6500; }
.binding-status.error { background: #ffecec; color: #c0261d; }
.binding-list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.binding-head-actions { display: flex; align-items: center; gap: 8px; }
.binding-head-actions .btn { width: auto; padding: 7px 10px; font-size: 12px; }
.binding-list { display: flex; flex-direction: column; gap: 0; overflow: visible; }
.binding-virtual-spacer { flex: 0 0 auto; }
.binding-row {
  background: #f8f8fb;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-all;
  min-height: 188px;
  overflow: hidden;
  margin-bottom: 10px;
}
.binding-row.bound { border-left: 4px solid #34c759; }
.binding-row.unbound { border-left: 4px solid #ff9500; }
.binding-row-title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.binding-row-title strong { font-size: 15px; color: #1c1c1e; }
.binding-tag { flex: 0 0 auto; font-size: 12px; color: #fff; background: #8e8e93; border-radius: 999px; padding: 2px 8px; }
.binding-tag.bound { background: #34c759; }
.binding-tag.unbound { background: #ff9500; }
.binding-row-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.binding-row-actions .btn { flex: 1 1 calc(33% - 8px); min-width: 88px; width: auto; padding: 8px 10px; font-size: 13px; }
.binding-line { font-size: 13px; color: #636366; line-height: 1.5; word-break: break-all; }
.binding-line-muted { color: #8e8e93; }
.binding-line-warn { color: #c0261d; }
.binding-login-identities {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef6ff;
  color: #52606d;
  font-size: 12px;
  line-height: 1.45;
}
.binding-login-identities strong { color: #1769aa; }
.binding-tab-row { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.binding-tab {
  border: 1px solid #d1d1d6;
  background: #fff;
  color: #1c1c1e;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
}
.binding-tab.on { background: #007aff; border-color: #007aff; color: #fff; }
.binding-row.pending { border-left: 4px solid #ff9500; }
.binding-row.approved { border-left: 4px solid #34c759; }
.binding-row.rejected { border-left: 4px solid #ff3b30; }
.binding-tag.pending { background: #ff9500; }
.binding-tag.approved { background: #34c759; }
.binding-tag.rejected { background: #ff3b30; }
.binding-advanced summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
.binding-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1200;
}
.binding-sheet[hidden] { display: none !important; }
.binding-sheet-panel {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
.binding-sheet-title { font-size: 17px; font-weight: 600; margin-bottom: 14px; }
.binding-role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.binding-role-btn {
  border: 1px solid #d1d1d6;
  background: #f2f2f7;
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 14px;
}
.binding-role-btn.on { background: #007aff; border-color: #007aff; color: #fff; }
.binding-sheet-actions { display: flex; gap: 10px; }
.binding-sheet-actions .btn { flex: 1; }

.binding-staff-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 9000;
  padding: 16px;
}
.binding-staff-sheet[hidden] { display: none !important; }
.binding-staff-sheet .binding-sheet-panel { width: 100%; max-width: 480px; }
.binding-staff-sheet-btn { width: 100%; margin-bottom: 8px; }
.binding-staff-name-input {
  width: 100%;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  margin-bottom: 12px;
}
.binding-staff-tip {
  padding: 10px 12px;
  background: #fff7e6;
  border-radius: 10px;
  font-size: 12px;
  color: #9a6500;
  margin-bottom: 12px;
  line-height: 1.5;
}
.binding-staff-card {
  background: #fff;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: 1px solid #ececf0;
}
.binding-account-card.approved { border-left: 4px solid #34c759; }
.binding-account-card.pending { border-left: 4px solid #ff9500; }
.binding-account-card.rejected { border-left: 4px solid #ff3b30; }
.binding-account-issue {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 10px 0;
  padding: 9px 11px;
  background: #fff1f0;
  border-left: 3px solid #ff3b30;
  border-radius: 8px;
  color: #c0261d;
  font-size: 12px;
  line-height: 1.45;
}
.binding-account-issue span { color: #8a3a35; }
.binding-staff-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #f2f2f7;
  margin-bottom: 12px;
  cursor: pointer;
}
.binding-staff-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.binding-staff-name { font-size: 16px; font-weight: 700; color: #1c1c1e; }
.binding-staff-role {
  font-size: 11px;
  color: #007aff;
  background: #ebf5ff;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 600;
}
.binding-staff-perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.binding-staff-p-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f9f9f9;
  padding: 8px 10px;
  border-radius: 10px;
  gap: 6px;
}
.binding-staff-p-item.master { background: #fff7e6; }
.binding-staff-p-lbl { font-size: 11px; color: #3a3a3c; font-weight: 600; line-height: 1.3; }
.binding-staff-switch { width: 44px; height: 24px; flex-shrink: 0; }

.binding-manual-panel { margin-top: 4px; }
.binding-manual-tip {
  font-size: 13px; color: #636366; line-height: 1.6;
  background: #f2f2f7; border-radius: 10px; padding: 12px; margin-bottom: 16px;
}
.binding-manual-section { margin-bottom: 18px; }
.binding-manual-label { display: block; font-size: 14px; color: #1c1c1e; margin-bottom: 8px; }
.binding-manual-selected {
  font-size: 13px; color: #1f7a3f; background: #e8f7ee;
  border-radius: 8px; padding: 10px 12px; margin: 8px 0; line-height: 1.5; word-break: break-all;
}
.binding-manual-selected.empty { color: #8e8e93; background: #f2f2f7; }
.binding-pick-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 28vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.binding-pick-item {
  border: 1px solid #e5e5ea; border-radius: 10px; padding: 10px 12px;
  background: #fff; text-align: left; cursor: pointer;
}
.binding-pick-item.on { border-color: #007aff; background: #f0f7ff; }
.binding-pick-item strong { display: block; font-size: 14px; color: #1c1c1e; margin-bottom: 4px; }
.binding-pick-item span { font-size: 12px; color: #636366; line-height: 1.4; word-break: break-all; }
.binding-manual-save { width: 100%; margin-top: 4px; }
.btn-load-more { width: 100%; margin-top: 12px; padding: 12px; text-align: center; }
.pro-scheme-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.pro-scheme-row {
  background: #f8f8fb;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border: 2px solid transparent;
}
.pro-scheme-row.active { border-color: #007aff; background: #eef5ff; }
.pro-detect-title { font-size: 18px; margin-bottom: 12px; color: #1c1c1e; }
.pro-detect-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.pro-status-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pro-status-btn.active { background: #007aff; color: #fff; }
.pro-detail-list { margin-top: 12px; padding-left: 18px; font-size: 14px; line-height: 1.7; }
.pro-detail-head { margin-bottom: 8px; font-size: 16px; }
.pro-record-item { cursor: pointer; }
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
  background: rgba(0,0,0,.78); color: #fff; padding: 10px 18px; border-radius: 20px;
  font-size: 14px; display: none; z-index: 10001;
}
.toast.show { display: block; }

.app-image-preview-open {
  overflow: hidden;
}

.app-image-preview {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 用 JS 注入的 --safe-area-*（Android env 常为 0）并兼容 env() */
  padding:
    max(12px, var(--safe-area-top, 0px), env(safe-area-inset-top, 0px))
    max(12px, var(--safe-area-right, 0px), env(safe-area-inset-right, 0px))
    max(12px, var(--safe-area-bottom, 0px), env(safe-area-inset-bottom, 0px))
    max(12px, var(--safe-area-left, 0px), env(safe-area-inset-left, 0px));
  box-sizing: border-box;
}

.app-image-preview.hidden {
  display: none;
}

.app-image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.app-image-preview-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.app-image-preview-content {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 64px 0 76px;
  box-sizing: border-box;
}

.app-image-preview-plane {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  transform-origin: center center;
  will-change: transform;
  transition: none;
}

.app-image-preview-img {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  image-orientation: from-image;
  border-radius: 6px;
  background: #111;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  pointer-events: none;
  image-rendering: auto;
}

.app-image-preview.is-zoomed .app-image-preview-plane,
.app-image-preview-plane.is-zoomed {
  max-width: none;
  max-height: none;
}

.app-image-preview.is-zoomed .app-image-preview-img {
  max-width: none;
  max-height: none;
  /* 放大后按屏幕宽度为基准线性缩放，避免被 contain 卡住 */
  width: min(100vw, 100%);
  height: auto;
  max-height: none;
}

.app-image-preview-hint {
  position: absolute;
  left: 50%;
  bottom: calc(max(16px, var(--safe-area-bottom, 0px), env(safe-area-inset-bottom, 0px)) + 28px);
  z-index: 2;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}

.app-image-preview-close,
.app-image-preview-nav {
  position: absolute;
  z-index: 3;
  border: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-image-preview-close {
  /* 必须避开刘海/状态栏；优先用 --safe-area-top */
  top: calc(max(10px, var(--safe-area-top, 0px), env(safe-area-inset-top, 0px)) + 6px);
  right: calc(max(10px, var(--safe-area-right, 0px), env(safe-area-inset-right, 0px)) + 4px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 30px;
  line-height: 44px;
  padding: 0;
}

.app-image-preview-label {
  position: relative;
  z-index: 4;
  align-self: flex-start;
  max-width: calc(100% - 72px);
  padding: 8px 4px 10px;
  background: transparent;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
  box-shadow: none;
}

.app-image-preview-description {
  position: relative;
  z-index: 4;
  align-self: flex-start;
  max-width: calc(100% - 24px);
  min-height: 24px;
  padding: 10px 4px 0;
  color: rgba(255,255,255,.86);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
  white-space: pre-line;
}

.app-image-preview-nav {
  top: 50%;
  width: 42px;
  height: 64px;
  margin-top: -32px;
  border-radius: 22px;
  font-size: 42px;
  line-height: 58px;
}

.app-image-preview-nav.prev {
  left: max(10px, var(--safe-area-left, 0px), env(safe-area-inset-left, 0px));
}

.app-image-preview-nav.next {
  right: max(10px, var(--safe-area-right, 0px), env(safe-area-inset-right, 0px));
}

/* Full-screen reports use direct, inertial-feeling horizontal gestures. */
.app-image-preview-nav { display: none !important; }

.app-image-preview-count {
  position: absolute;
  left: 50%;
  bottom: max(16px, var(--safe-area-bottom, 0px), env(safe-area-inset-bottom, 0px));
  z-index: 2;
  transform: translateX(-50%);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 13px;
}

.view-share-exit.active {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  background: #f5f5f7;
}

.share-exit-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}

.share-exit-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

.share-exit-title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
  color: #1c1c1e;
}

.share-exit-desc {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.6;
  color: #333;
}

.share-exit-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #8e8e93;
}

/* html + body 双保险：首屏脚本先挂在 html 上，避免登录页闪现 */
html.share-viewer-mode #view-login,
html.share-viewer-mode #view-register,
html.share-viewer-mode #view-list,
body.share-viewer-mode #view-list,
body.share-viewer-mode #view-login,
body.share-viewer-mode #view-register {
  display: none !important;
}
/* 分享访客只允许报告相关页，禁止切到 ERP 其它界面 */
body.share-viewer-mode .view:not(#view-pro-detail-2):not(#view-pro-detail-2-item) {
  display: none !important;
}

/* 拍照/相册来源选择（发票、报账等共用；检测页也有同名样式） */
.pro-det-source-mask {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.pro-det-source-sheet {
  width: min(320px, 92vw);
  background: #fff;
  border-radius: 14px 14px 0 0;
  padding: 8px 8px calc(8px + max(env(safe-area-inset-bottom, 0px), var(--sab, 0px)));
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}
.pro-det-source-btn {
  border: none;
  border-radius: 10px;
  padding: 14px 12px;
  font-size: 16px;
  font-weight: 600;
  background: #f2f2f7;
  color: #007aff;
  cursor: pointer;
  white-space: nowrap;
}
.pro-det-source-btn.cancel {
  color: #8e8e93;
  font-weight: 500;
}
