/* 录入页移动端布局：吸底操作栏 + 大触控 + 标签滚动 */

.inspect-app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
}

.inspect-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.inspect-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: stretch;
}
.inspect-top-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.inspect-top-name {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inspect-top-slogan {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.25;
}
.inspect-top-nav a {
  color: var(--c-accent, #1769aa);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.35;
  white-space: nowrap;
}
.inspect-top-nav a:hover {
  text-decoration: underline;
}
.inspect-top-tools {
  align-items: stretch;
}
.inspect-top-tools .btn {
  width: 100%;
  justify-content: center;
}
.inspect-top-portal {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  align-self: flex-start;
}
.inspect-top-portal:hover {
  color: var(--c-accent, #1769aa);
}

.inspect-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px;
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

.code-box {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
  padding: 14px 10px;
  background: #eef3f8;
  border-radius: var(--radius);
  margin: 8px 0 12px;
  word-break: break-all;
  color: var(--text);
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.code-box.empty {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.cont-pass {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #eef3f8;
  border: 1px solid #d5dee8;
  cursor: pointer;
  user-select: none;
}
.cont-pass.on {
  background: #e7f6ec;
  border-color: #9fd4b0;
}
.cont-pass-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cont-pass-copy strong {
  font-size: 0.98rem;
  color: var(--text);
}
.cont-pass-copy .meta {
  margin: 0;
  line-height: 1.35;
}
.cont-pass input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  accent-color: #1a7f37;
}
#itemNo.flash-ok {
  outline: 2px solid #1a7f37;
  background: #e7f6ec;
}

.btn-touch {
  min-height: 52px;
  font-size: 1.08rem;
}

.actionbar {
  position: fixed;
  left: 50%;
  right: auto;
  /* 键盘顶起时由 JS 设置 --kb-offset */
  bottom: var(--kb-offset, 0px);
  z-index: 40;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid var(--border);
  transition: bottom 120ms ease-out;
}
.actionbar.fail-mode {
  grid-template-columns: 1fr 1.4fr;
}
.actionbar .btn {
  width: 100%;
}
.actionbar .btn-ok,
.actionbar .btn-bad {
  font-size: 1.15rem;
  font-weight: 700;
  min-height: 56px;
}

.tags-wrap {
  max-height: 40dvh;
  overflow: auto;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: #fafbfc;
}
.tags-wrap .chips {
  margin-bottom: 0;
}
.tags .chip {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.95rem;
}

#defectSearch {
  margin-bottom: 8px;
}

.resp-wrap {
  position: relative;
  margin-bottom: 12px;
}
.resp-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 4px);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.resp-dropdown.hidden {
  display: none;
}
.resp-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f2f5;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}
.resp-item:last-child {
  border-bottom: none;
}
.resp-item:active,
.resp-item:hover {
  background: #f5f7fa;
}
.resp-item .sub {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--muted);
}
.resp-picked {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef2ff;
  color: #1a2331;
  font-size: 0.92rem;
  line-height: 1.4;
}
.resp-picked.hidden {
  display: none;
}
.resp-picked .clear {
  float: right;
  border: none;
  background: transparent;
  color: #4a88ed;
  font-size: 0.85rem;
  padding: 0;
  cursor: pointer;
}

.scan-extra {
  margin-bottom: 8px;
}

.toast.show {
  bottom: calc(88px + env(safe-area-inset-bottom, 0px) + var(--kb-offset, 0px));
}

html.capacitor-native .scan-extra {
  display: none !important;
}

/* 录入反馈：扫码 / 合格 / 不合格 */
@keyframes poqs-flash-ok {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}
@keyframes poqs-flash-pass {
  0% { background: #ecfdf5; }
  100% { background: #fff; }
}
@keyframes poqs-flash-fail {
  0% { background: #fef2f2; }
  100% { background: #fff; }
}
@keyframes poqs-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.code-box.flash-ok {
  animation: poqs-flash-ok 0.65s ease-out;
  border: 1px solid #6ee7b7;
}
.actionbar.flash-pass {
  animation: poqs-flash-pass 0.55s ease-out;
}
.actionbar.flash-fail {
  animation: poqs-flash-fail 0.55s ease-out;
}
.today-chip.flash-bump {
  animation: poqs-bump 0.45s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .code-box.flash-ok,
  .actionbar.flash-pass,
  .actionbar.flash-fail,
  .today-chip.flash-bump {
    animation: none !important;
  }
}

body.inspect-mode {
  padding-bottom: 0;
}

@media (min-width: 600px) {
  .inspect-app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--bg);
  }
}

/* ---- 登录引导 / 今日计数 ---- */
.login-card .login-badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
}
.login-title {
  margin: 0 0 8px;
  font-size: 1.45rem;
}
.login-lead {
  margin: 0 0 14px;
  line-height: 1.5;
}
.login-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.friendly-tips {
  margin-top: 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.friendly-tips p {
  margin: 0 0 6px;
  font-size: 0.92rem;
}
.friendly-tips ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

/* 手机登录：标签与输入框更醒目 */
@media (max-width: 600px) {
  .login-card {
    padding: 20px 18px 22px;
  }
  .login-title {
    font-size: 1.65rem;
  }
  .login-card label:not(.remember-row) {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
  }
  .login-card input#loginName,
  .login-card input#password {
    min-height: 52px;
    padding: 14px 14px;
    font-size: 16px; /* 避免 iOS 自动放大页面 */
    border: 1.5px solid #94a3b8;
    border-radius: 12px;
    background: #f8fafc;
    margin-bottom: 14px;
  }
  .login-card input#loginName:focus,
  .login-card input#password:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(74, 136, 237, 0.22);
  }
  .login-card .btn-primary {
    min-height: 54px;
    font-size: 1.12rem;
    margin-top: 4px;
  }
  .friendly-tips {
    padding: 10px 12px;
    font-size: 0.84rem;
  }
}
.today-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.88rem;
}
.today-chip strong {
  font-size: 1.05rem;
}
.btn-theme,
.btn-logout {
  padding: 5px 10px !important;
  font-size: 0.8rem !important;
  min-height: 0;
  line-height: 1.2;
}

/* 高对比主题：车间亮光更好认 */
html[data-theme="contrast"] {
  --bg: #eef1f4;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #334155;
  --primary: #1d4ed8;
  --primary-deep: #1e3a8a;
  --ok: #047857;
  --bad: #b91c1c;
  --border: #94a3b8;
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
html[data-theme="contrast"] .code-box {
  background: #fff;
  border: 2px solid #0f172a;
  font-size: 1.35rem;
}
html[data-theme="contrast"] .actionbar .btn-ok {
  background: #047857;
  box-shadow: 0 0 0 2px #065f46 inset;
}
html[data-theme="contrast"] .actionbar .btn-bad {
  background: #b91c1c;
  box-shadow: 0 0 0 2px #7f1d1d inset;
}
html[data-theme="contrast"] .inspect-top {
  border-bottom-width: 2px;
}
html[data-theme="contrast"] .chip.on {
  border-width: 2px;
}
html[data-theme="contrast"] .login-badge {
  background: #dbeafe;
  color: #1e3a8a;
}
