*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    'PingFang SC',
    'Microsoft YaHei',
    sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: #0f172a;
  background: #f1f5f9;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* 与登录前一致：浅色主界面 */
body.app-dark {
  background: #f1f5f9;
  color: #0f172a;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: #0f172a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  flex: 1;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}

.btn-back,
.btn-text {
  background: none;
  border: none;
  color: #93c5fd;
  font-size: 1rem;
  padding: 8px 10px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

.btn-back:disabled {
  opacity: 0;
  pointer-events: none;
}

.main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

body.has-bottom-nav .main {
  padding-bottom: 72px;
}

/* 生产报工列表：吸底「合并报工 / 接单 / 完工」与主内容留白（离开该页后 class 移除，不影响其它界面） */
body.has-pro-sign-list-sticky .main {
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0));
}

#pro-sign-list-sticky[hidden] {
  display: none !important;
}

.pro-sign-list-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 560px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0));
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
}

.app-dark .pro-sign-list-sticky {
  background: #f8fafc;
  border-color: #e2e8f0;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
}

.pro-sign-list-sticky__btn {
  min-width: 200px;
  min-height: 48px;
  width: 100%;
  max-width: 320px;
}

.pro-sign-merge-hint-bottom {
  margin-top: 16px;
  margin-bottom: 8px;
  text-align: left;
  line-height: 1.5;
}

.view {
  animation: fade 0.2s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.hint {
  color: #64748b;
  font-size: 0.9rem;
  text-align: center;
  margin: 8px 0 20px;
}

/* 登录页：表单在上，安卓下载链接靠底部区域 */
#view-login.view-login {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 52px - 32px);
}

#view-login .login-stack {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#view-login .login-apk-footer {
  margin-top: auto;
  padding-top: 28px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0));
  text-align: center;
}

#view-login .login-apk-link {
  font-size: 0.9rem;
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#view-login .login-apk-link:active {
  color: #1d4ed8;
}

.placeholder-page {
  text-align: center;
  color: #64748b;
  padding: 48px 16px;
  font-size: 0.95rem;
}

.report-pager {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 4px;
  font-size: 0.9rem;
  color: #475569;
}

.report-pager-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.report-pager-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 16px;
}

.report-pager-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: inherit;
  color: inherit;
}

.report-pager-field > span {
  flex-shrink: 0;
  white-space: nowrap;
}

.report-pager-select {
  min-height: 40px;
  padding: 6px 28px 6px 10px;
  font-size: inherit;
  color: #0f172a;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  max-width: 100%;
}

.report-pager-jump-input {
  width: 4.5rem;
  min-height: 40px;
  padding: 6px 8px;
  font-size: inherit;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  text-align: center;
}

.report-pager .report-pager-jump-btn {
  min-width: auto;
  padding-left: 12px;
  padding-right: 12px;
}

.report-pager-info {
  flex: 1 1 auto;
  text-align: center;
  min-width: 0;
}

.report-pager .report-pager-btn {
  color: #0f172a;
  flex-shrink: 0;
  touch-action: manipulation;
  min-height: 44px;
  min-width: 44px;
}

.report-pager .report-pager-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* —— 目录：动态菜单网格（每行 4 个） —— */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 8px;
  padding: 8px 0 24px;
}

.catalog-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font: inherit;
  color: inherit;
  text-align: center;
  min-width: 0;
}

.catalog-tile:active .catalog-tile-icon {
  transform: scale(0.96);
  opacity: 0.88;
}

/* 仅展示图标（emoji / 字符），无底色方框 */
.catalog-tile-icon {
  display: block;
  font-size: clamp(1.75rem, 8vw, 2.35rem);
  line-height: 1.15;
  transition: transform 0.12s ease, opacity 0.12s ease;
  filter: none;
}

.catalog-tile-label {
  font-size: 0.65rem;
  color: #334155;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
  padding: 0 1px;
  word-break: break-word;
}

.catalog-empty {
  padding: 40px 16px;
}

#owor-empty {
  font-size: 0.85rem;
  line-height: 1.5;
  padding-left: 8px;
  padding-right: 8px;
}

/* OITM（SAP 物料主数据）列表，类名沿用 owor- */
.owor-subtitle {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0 0 12px;
  text-align: center;
}

.owor-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

.owor-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  border-left: 4px solid #2563eb;
}

.owor-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
}

.owor-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.owor-doc-badge {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.owor-kv {
  padding: 10px 14px 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  font-size: 0.9rem;
  align-items: baseline;
}

.owor-kv dt {
  margin: 0;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 600;
}

.owor-kv dd {
  margin: 0;
  color: #0f172a;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

/* 宽屏：表格；窄屏：上方卡片列表 */
.owor-table-panel {
  display: none;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: auto;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.owor-data-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.owor-data-table th,
.owor-data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.owor-data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}

.owor-data-table td {
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.owor-data-table tbody tr:last-child td {
  border-bottom: none;
}

.owor-data-table tbody tr:hover td {
  background: #f8fafc;
}

@media (min-width: 640px) {
  .owor-list-wrap {
    display: none;
  }

  .owor-table-panel {
    display: block;
  }
}

/* 可配置报表：勿沿用 OWOR「窄屏隐藏表格」；手机端也必须显示查询结果 */
#view-dynamic-report .owor-table-panel {
  display: block;
  overflow: visible;
}

#view-dynamic-report .report-query-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-top: 0.25rem;
}

/* 可配置报表：横向滚动 + 首列固定 */
.report-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.dynamic-report-grid {
  min-width: max(100%, 520px);
}

.dynamic-report-grid th:first-child,
.dynamic-report-grid td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 4px 0 12px -6px rgba(15, 23, 42, 0.18);
}

.dynamic-report-grid thead th:first-child {
  z-index: 2;
  background: #f8fafc;
}

.dynamic-report-grid tbody tr:hover td {
  background: #f8fafc;
}

.dynamic-report-grid tbody tr:hover td:first-child {
  background: #f1f5f9;
}

.dynamic-report-grid tbody tr.report-row-clickable:active td {
  background: #f1f5f9;
}

.report-row-clickable {
  cursor: pointer;
}

.report-cell-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 11rem;
}

.report-cell-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-cell-expand {
  flex-shrink: 0;
  min-width: 36px;
  min-height: 36px;
  padding: 4px 6px;
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.report-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.report-overlay[hidden] {
  display: none !important;
}

.report-overlay-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.report-overlay-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: min(85vh, 640px);
  margin: 0;
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: report-overlay-up 0.2s ease;
}

@keyframes report-overlay-up {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.report-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.report-overlay-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.report-overlay-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  padding: 8px;
  cursor: pointer;
  color: #64748b;
  touch-action: manipulation;
}

.report-overlay-body {
  overflow: auto;
  padding: 12px 16px 20px;
  flex: 1;
  min-height: 0;
}

.report-overlay-text-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  margin: 0 0 10px;
  padding: 0 0 8px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.report-overlay-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.5;
}

.report-detail-scroll {
  margin: 0 -4px;
}

/* 行详情：宽表转置为纵向键值对 */
.report-detail-transpose-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-detail-record-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  padding: 4px 0 0;
}

.report-detail-transpose {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}

.report-detail-transpose th {
  width: 38%;
  max-width: 11rem;
  padding: 8px 10px 8px 0;
  vertical-align: top;
  text-align: left;
  font-weight: 500;
  color: #64748b;
  border-bottom: 1px solid #f1f5f9;
  word-break: break-word;
}

.report-detail-transpose td {
  padding: 8px 0 8px 8px;
  vertical-align: top;
  color: #0f172a;
  border-bottom: 1px solid #f1f5f9;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.report-detail-transpose tr:last-child th,
.report-detail-transpose tr:last-child td {
  border-bottom: none;
}

.report-row-detail-page {
  padding: 0 4px 24px;
  max-width: 42rem;
  margin: 0 auto;
}

.report-row-detail-error {
  padding: 16px;
  color: #b91c1c;
  font-size: 0.95rem;
  line-height: 1.5;
}

@media (min-width: 640px) {
  .report-overlay {
    align-items: center;
    padding: 16px;
  }

  .report-overlay-card {
    border-radius: 12px;
    max-height: min(80vh, 720px);
  }

  .report-cell-inner {
    max-width: 14rem;
  }
}

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  color: #0f172a;
}

.section-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #475569;
}

.field {
  display: block;
  margin-bottom: 14px;
}

/* 仅直接子级：避免 .field 内嵌套列表（如合并报工操作员行）里的 span 被当成标题，导致 flex 列宽塌成一字宽 */
.field > span {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
}

.field textarea {
  resize: vertical;
  min-height: 72px;
}

.field-scan-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.field-scan-row input {
  flex: 1;
  min-width: 0;
  width: auto;
}

.btn-field-scan {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 48px;
  padding: 0;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
  line-height: 0;
}

.btn-field-scan:active {
  background: #dbeafe;
}

.scan-hint {
  font-size: 0.8rem;
  color: #64748b;
  margin-left: 8px;
  white-space: nowrap;
  align-self: center;
}

.scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.72);
  box-sizing: border-box;
}

.scan-overlay-panel {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

/* 移动端扫码优化：更大取景区域、更友好提示 */
@media (max-width: 768px) {
  .scan-overlay {
    padding: 0;
  }

  .scan-overlay-panel {
    max-width: none;
    height: 100%;
    border-radius: 0;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
  }

  .scan-overlay-hint {
    font-size: 1.1rem;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 500;
  }

  .scan-overlay-video {
    flex: 1;
    max-height: none;
    border-radius: 12px;
    margin-bottom: 20px;
  }

  .scan-overlay-actions {
    margin-top: auto;
    padding-bottom: env(safe-area-inset-bottom, 20px);
  }

  .scan-overlay-close {
    min-width: 160px;
    padding: 14px 24px;
    font-size: 1.05rem;
  }
}

.scan-overlay-hint {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #475569;
  text-align: center;
}

.scan-overlay-hint--multiline {
  white-space: pre-wrap;
  text-align: left;
  line-height: 1.5;
  max-height: 40vh;
  overflow-y: auto;
}

.scan-html5-reader {
  width: 100%;
  min-height: 200px;
  border-radius: 10px;
  background: #0f172a;
  margin-bottom: 12px;
}

.scan-overlay-actions-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.scan-overlay-actions-row .btn-primary,
.scan-overlay-actions-row .btn-secondary {
  width: 100%;
}

.scan-overlay-video {
  display: block;
  width: 100%;
  max-height: min(52vh, 360px);
  border-radius: 10px;
  background: #0f172a;
  object-fit: cover;
}

.scan-overlay-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.scan-overlay-close {
  min-width: 120px;
}

/* AI 生成 Prompt：自定义弹层（多行输入 + 可选中示例） */
.scan-overlay-panel.ai-prompt-gen-panel {
  max-width: 560px;
  max-height: min(92vh, 720px);
  overflow-y: auto;
  text-align: left;
}

.ai-prompt-gen-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.45;
}

.ai-prompt-gen-example-label {
  margin: 14px 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
}

.ai-prompt-gen-example {
  margin: 0;
  padding: 10px 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  cursor: text;
}

.ai-prompt-gen-field-label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
}

.ai-prompt-gen-textarea {
  display: block;
  width: 100%;
  min-height: 168px;
  padding: 12px;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  resize: vertical;
  box-sizing: border-box;
}

.ai-prompt-gen-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #2563eb;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  min-height: 48px;
  touch-action: manipulation;
}

.btn-primary:active {
  opacity: 0.92;
}

.err {
  color: #dc2626;
  font-size: 0.9rem;
  margin: 0 0 10px;
  word-break: break-word;
  white-space: pre-wrap;
}

.pull-hint {
  text-align: center;
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0 0 8px;
}

.order-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.order-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.order-item:active {
  background: #f8fafc;
}

.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.order-no {
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f172a;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: #2563eb;
}

.order-product {
  color: #334155;
  margin-bottom: 6px;
}

.order-meta {
  font-size: 0.85rem;
  color: #64748b;
}

.empty {
  text-align: center;
  color: #94a3b8;
  padding: 40px 16px;
}

.empty.muted {
  padding: 16px;
}

.muted {
  color: #64748b;
}

.detail-head .order-no {
  font-size: 1.25rem;
  color: #0f172a;
}

.detail-head .meta {
  font-size: 0.9rem;
  color: #64748b;
  margin-top: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 12px;
  border-radius: 8px;
  background: #e2e8f0;
  border: none;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  color: #334155;
}

.chip.is-active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.report-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.report-item {
  padding: 10px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.9rem;
  color: #334155;
}

.report-item:last-child {
  border-bottom: none;
}

.report-sub {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 12px 20px;
  background: #1e293b;
  color: #fff;
  border-radius: 10px;
  font-size: 0.9rem;
  z-index: 100;
  max-width: 90%;
  text-align: center;
}

/* 固定四页签（浅色） */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  min-height: 56px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: #fff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
}

/* hidden 属性须覆盖上面的 display:flex，否则登录页底部栏仍会占位，键盘弹出时会被顶到中间 */
.bottom-nav[hidden] {
  display: none !important;
}

/* 登录页使用 display:flex，hidden 必须 !important 才能彻底隐藏，否则登录成功后老界面仍叠在目录页上方 */
#view-login[hidden] {
  display: none !important;
}

/* 同上：.view--pro-sign-receive 对 section 设置了 display:flex，会压过 hidden，离开接单页后表单仍会叠在目录等页下方 */
#view-pro-sign-receive[hidden] {
  display: none !important;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.68rem;
  color: #64748b;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-height: 52px;
}

.bottom-nav-item.is-active {
  color: #2563eb;
  font-weight: 600;
}

.bottom-nav-glyph {
  font-size: 1.35rem;
  line-height: 1;
  display: block;
}

.bottom-nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

.settings-card {
  margin-bottom: 16px;
}

.settings-line {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #334155;
  display: flex;
  gap: 12px;
}

.settings-line:last-child {
  margin-bottom: 0;
}

.settings-k {
  color: #64748b;
  min-width: 3em;
}

.menu-admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.menu-edit-card .field {
  margin-bottom: 10px;
}

.menu-edit-card .section-title {
  margin-top: 0;
  color: #475569;
}

.row-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row-inline input[type='checkbox'] {
  width: auto;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.btn-row .btn-primary,
.btn-row .btn-secondary {
  width: auto;
  flex: 1;
}

.btn-secondary {
  flex: 1;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  min-height: 48px;
}

.btn-secondary.danger {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.btn-secondary:active {
  opacity: 0.92;
}

@media (min-width: 600px) {
  .main {
    padding: 24px;
  }
}

/* 生产报工登记：列表工具条与勾选列 */
.pro-sign-toolbar {
  margin-bottom: 12px;
}

.pro-sign-toolbar .btn-primary {
  width: 100%;
  max-width: 280px;
}

.pro-sign-th-check,
.pro-sign-td-check {
  width: 44px;
  text-align: center;
  vertical-align: middle;
}

.pro-sign-td-check input[type='checkbox'] {
  width: 20px;
  height: 20px;
}

.pro-sign-merge-lead {
  margin: 0 0 12px;
  font-size: 14px;
  color: #64748b;
  line-height: 1.5;
}

.pro-sign-merge-scroll {
  max-height: min(58vh, 480px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.pro-sign-merge-table {
  min-width: 100%;
  margin: 0;
  font-size: 13px;
}

.pro-sign-merge-table th,
.pro-sign-merge-table td {
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pro-sign-merge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

/* 合并报工·接单：保存区固定于视口底部，滚动时始终贴在屏幕下沿（与 root 四页签互斥不叠显） */
#view-pro-sign-receive {
  min-height: min(100dvh, 100%);
  position: relative;
}

.view--pro-sign-receive {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#pro-sign-receive-scroll.pro-sign-receive--scroll,
.pro-sign-receive.pro-sign-receive--scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* 为 fixed 底栏与刘海安全区留空，避免最后几行与按钮重叠 */
  padding: 0 0 calc(88px + env(safe-area-inset-bottom, 0));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 离开本页时须隐藏，否则 position:fixed 的保存条会盖住其它屏 */
#pro-sign-receive-sticky[hidden] {
  display: none !important;
}

.pro-sign-receive-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 560px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0));
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
}

/* 与 body / 卡片浅色框架一致（app-dark 下主界面仍为浅色，底栏勿再用深色块） */
.app-dark .pro-sign-receive-sticky {
  background: #f8fafc;
  border-color: #e2e8f0;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
}

.pro-sign-receive-sticky__btn {
  min-width: 200px;
  min-height: 48px;
}

.pro-sign-receive {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pro-sign-line-qty {
  min-width: 4.5rem;
  min-height: 40px;
}

.pro-sign-receive-hint {
  margin: 0 0 4px;
}

.pro-sign-receive-header-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.pro-sign-receive-meta-row {
  display: grid;
  grid-template-columns: minmax(6.5rem, 42%) 1fr;
  gap: 8px;
  align-items: baseline;
}

.pro-sign-receive-meta-label {
  color: #64748b;
  flex-shrink: 0;
}

.pro-sign-receive-meta-value {
  color: #0f172a;
  font-weight: 500;
  word-break: break-word;
}

.pro-sign-receive-remarks {
  margin-top: 0;
}

.pro-sign-receive-operators-field {
  margin: 0 0 12px;
}

/* 与 .field input / 备注框同一套浅色表单主题（主界面 app-dark 下仍为白底卡片） */
.pro-sign-receive-operators-picker {
  margin-top: 2px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.pro-sign-receive-operators-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pro-sign-receive-operators-summary {
  font-size: 0.8rem;
  line-height: 1.4;
  color: #64748b;
  margin: 0;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.pro-sign-receive-operators-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.pro-sign-receive-operators-search {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.pro-sign-receive-operators-search::placeholder {
  color: #94a3b8;
}

.pro-sign-receive-operators-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pro-sign-receive-operators-action {
  font: inherit;
  font-size: 0.85rem;
  padding: 8px 12px;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pro-sign-receive-operators-action:active {
  background: #f8fafc;
}

.pro-sign-receive-operators-action--compact {
  padding: 6px 12px;
  min-height: 36px;
  font-size: 0.82rem;
  flex-shrink: 0;
  align-self: flex-start;
}

.pro-sign-receive-operators-list-wrap {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

/* 原生多选列表：由系统绘制选项行，工号姓名整行可读 */
.pro-sign-receive-operators-select {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.5;
  color: #0f172a;
  background: #fff;
  border: none;
  border-radius: 10px;
  min-height: 7.5rem;
  max-height: min(32vh, 200px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  -webkit-appearance: none;
  appearance: none;
}

.pro-sign-receive-operators-select:focus {
  outline: 2px solid #93c5fd;
  outline-offset: -2px;
}

.pro-sign-receive-operators-select option {
  padding: 6px 4px;
  border-radius: 4px;
}

.app-dark .pro-sign-receive-header-meta {
  background: #f1f5f9;
}

.app-dark .pro-sign-receive-meta-label {
  color: #64748b;
}

.app-dark .pro-sign-receive-meta-value {
  color: #0f172a;
}

.pro-sign-receive-block {
  margin: 0;
}

.pro-sign-receive-h2,
.pro-sign-receive-h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.pro-sign-receive-h3 {
  font-size: 0.98rem;
  color: #475569;
  font-weight: 600;
}

.pro-sign-receive-form .field {
  margin-bottom: 0.75rem;
}

.pro-sign-receive-block--sub .pro-sign-receive-h2,
.pro-sign-receive-block--proc .pro-sign-receive-h3 {
  margin-top: 0;
}

.pro-sign-receive-child-scroll,
.pro-sign-receive-block--proc {
  max-width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.pro-sign-receive-block--proc {
  padding: 0;
}

.pro-sign-receive-block--proc h3,
.pro-sign-receive-block--proc .pro-sign-receive-h3 {
  padding: 10px 12px 0;
  margin: 0;
  border: none;
}

.pro-sign-receive-block--proc table {
  margin: 0;
  border: none;
}

.pro-sign-receive-child-table th,
.pro-sign-receive-proc-table th,
.pro-sign-receive-child-table td,
.pro-sign-receive-proc-table td {
  font-size: 13px;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 合并接单：明细行 — 移动端卡片 */
.pro-sign-receive-child-scroll--cards {
  padding: 0;
}

.pro-sign-receive-line-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 12px 12px;
}

.pro-sign-receive-line-card {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  box-shadow: none;
}

.pro-sign-receive-line-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 10px;
  line-height: 1.35;
}

.pro-sign-receive-line-card__row {
  display: grid;
  grid-template-columns: minmax(92px, 36%) 1fr;
  gap: 8px 12px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}

.pro-sign-receive-line-card__row:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.pro-sign-receive-line-card__label {
  color: #64748b;
  font-size: 13px;
  line-height: 1.3;
}

.pro-sign-receive-line-card__value {
  min-width: 0;
  color: #0f172a;
  word-break: break-word;
}

.pro-sign-receive-line-qty {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
}

.pro-sign-receive-btn-primary,
.pro-sign-receive-sticky__btn {
  /* 吸底全宽/醒目 */
  width: 100%;
  max-width: 400px;
}

.app-dark .pro-sign-receive-block--proc,
.app-dark .pro-sign-receive-child-scroll {
  border-color: #cbd5e1;
}

/* 合并接单：保存前确认预览（共用 report-overlay） */
.pro-sign-save-preview-section {
  margin-bottom: 16px;
}

.pro-sign-save-preview-section:last-of-type {
  margin-bottom: 12px;
}

.pro-sign-save-preview-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
}

.pro-sign-save-preview-lines-scroll {
  max-width: 100%;
  max-height: min(38vh, 280px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.pro-sign-save-preview-lines-scroll--cards {
  max-height: min(52vh, 360px);
  padding: 0;
}

.pro-sign-save-preview-line-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px 12px;
}

.pro-sign-save-preview-line-card {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 13px;
}

.pro-sign-save-preview-line-card__title {
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 8px;
  line-height: 1.35;
}

.pro-sign-save-preview-line-card__row {
  display: grid;
  grid-template-columns: minmax(88px, 36%) 1fr;
  gap: 6px 10px;
  padding: 4px 0;
  border-bottom: 1px solid #e2e8f0;
}

.pro-sign-save-preview-line-card__row:last-of-type {
  border-bottom: none;
}

.pro-sign-save-preview-line-card__label {
  color: #64748b;
}

.pro-sign-save-preview-line-card__value {
  color: #0f172a;
  word-break: break-word;
  text-align: right;
}

.pro-sign-save-preview-table {
  margin: 0;
  font-size: 13px;
}

.pro-sign-save-preview-table th,
.pro-sign-save-preview-table td {
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pro-sign-save-preview-actions {
  margin-top: 8px;
  margin-bottom: 0;
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  background: linear-gradient(to top, #fff 70%, rgba(255, 255, 255, 0));
}

.app-dark .pro-sign-save-preview-lines-scroll {
  border-color: #cbd5e1;
}

.app-dark .pro-sign-save-preview-title {
  color: #94a3b8;
}

.app-dark .pro-sign-save-preview-actions {
  background: linear-gradient(to top, #1e293b 70%, rgba(30, 41, 59, 0));
}

/* 报工登记页 */
.work-reg-head .section-title {
  margin-top: 0;
}

.work-reg-meta {
  margin: 8px 0 0;
  font-size: 14px;
  color: #64748b;
}

.work-reg-status {
  font-weight: 600;
  color: #0f172a;
}

.app-dark .work-reg-status {
  color: #f1f5f9;
}

.work-reg-pause-reason {
  margin: 10px 0 0;
  padding: 10px 12px;
  font-size: 14px;
  color: #92400e;
  background: #fffbeb;
  border-radius: 8px;
  border: 1px solid #fde68a;
}

.work-reg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.work-reg-toolbar .btn-primary,
.work-reg-toolbar .btn-secondary {
  min-height: 44px;
}

.work-reg-lines-card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.work-reg-lines-table {
  min-width: 100%;
}

.work-reg-lines-table th,
.work-reg-lines-table td {
  font-size: 14px;
  vertical-align: middle;
}

.work-reg-qty {
  width: 100%;
  max-width: 7rem;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.work-reg-remark {
  width: 100%;
  min-width: 6rem;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

/* ---------- 报表图片列 ---------- */
.report-cell-inner--img {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 50px;
}

.report-cell-img {
  display: block;
  max-height: 80px;
  max-width: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease;
  border: 1px solid #e2e8f0;
}

.report-cell-img:hover {
  transform: scale(1.06);
  border-color: #3b82f6;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.25);
}

.report-cell-img-err {
  font-size: 0.78rem;
  color: #94a3b8;
}

/* ---------- 图片灯箱 ---------- */
.img-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.img-lightbox-image {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.img-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.img-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
