/* ============================================================
   NFC 工位点检页样式（page.css）
   简约工业风：深灰主色 + 橙色强调 + 浅底深字
   ============================================================ */

:root {
  --pg-bg: #f0f2f4;
  --pg-card: #ffffff;
  --pg-ink: #1f2429;
  --pg-ink-sub: #5b6470;
  --pg-line: #dfe4e8;
  --pg-accent: #ff7a1a;
  --pg-ok: #1a7f5a;
  --pg-warn: #c98a00;
  --pg-danger: #c23a2b;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--pg-bg);
  color: var(--pg-ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 顶部工位条 */
.pg-topbar {
  background: var(--pg-ink);
  color: #f2f4f6;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pg-topbar .pg-brand {
  font-size: 11px;
  letter-spacing: 2px;
  color: #aab3bd;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pg-topbar .pg-brand b {
  color: var(--pg-accent);
  font-weight: 700;
}

.pg-topbar .pg-station {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.pg-topbar .pg-device {
  font-size: 12px;
  color: #c3cad1;
}

/* NFC 来源标识 */
.pg-nfc-tag {
  margin: 12px 16px 0;
  padding: 8px 12px;
  background: #fff7f0;
  border: 1px solid #ffd9bd;
  border-radius: 10px;
  font-size: 12px;
  color: #a05a1c;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pg-nfc-tag .pg-nfc-ico {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--pg-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* 主内容区 */
.pg-main {
  padding: 12px 16px 84px;
  max-width: 560px;
  margin: 0 auto;
}

.pg-card {
  background: var(--pg-card);
  border: 1px solid var(--pg-line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(20, 24, 28, 0.05);
}

.pg-card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pg-card-title::before {
  content: "";
  width: 4px;
  height: 16px;
  background: var(--pg-accent);
  border-radius: 2px;
}

/* 点检项 */
.pg-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 2px;
  border-bottom: 1px dashed var(--pg-line);
  font-size: 14px;
}

.pg-check-row:last-of-type { border-bottom: none; }

.pg-check-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1;
}

.pg-radio {
  display: flex;
  gap: 6px;
}

.pg-radio span {
  padding: 5px 12px;
  border: 1px solid var(--pg-line);
  border-radius: 8px;
  font-size: 12px;
  color: var(--pg-ink-sub);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.pg-radio span.on-ok {
  background: #e8f5ef;
  border-color: #9fd6bf;
  color: var(--pg-ok);
  font-weight: 600;
}

.pg-radio span.on-bad {
  background: #fdeeed;
  border-color: #f0b7b0;
  color: var(--pg-danger);
  font-weight: 600;
}

/* 故障描述输入 */
.pg-textarea {
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--pg-line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--pg-ai-ink, #1f2429);
  background: #fafbfc;
  resize: vertical;
}

.pg-textarea:focus {
  outline: none;
  border-color: var(--pg-accent);
  background: #fff;
}

/* 分类快选 */
.pg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pg-chip {
  padding: 6px 12px;
  border: 1px solid var(--pg-line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--pg-ink-sub);
  background: #fafbfc;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.pg-chip.on {
  background: #1f2429;
  color: #fff;
  border-color: #1f2429;
}

/* 主按钮 */
.pg-btn {
  display: block;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: inherit;
}

.pg-btn-primary {
  background: var(--pg-accent);
  color: #fff;
}

.pg-btn-primary:active { transform: scale(0.98); }

.pg-btn-dark {
  background: var(--pg-ink);
  color: #fff;
}

.pg-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 台账列表 */
.pg-ledger-item {
  padding: 10px 0;
  border-bottom: 1px dashed var(--pg-line);
  font-size: 13px;
}

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

.pg-ledger-head {
  display: flex;
  justify-content: space-between;
  color: var(--pg-ink-sub);
  font-size: 12px;
  margin-bottom: 2px;
}

.pg-ledger-main { color: var(--pg-ink); }

.pg-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.pg-badge.ok   { background: #e8f5ef; color: var(--pg-ok); }
.pg-badge.bad  { background: #fdeeed; color: var(--pg-danger); }

/* 工单结果卡 */
.pg-order-card {
  border: 1px solid #ffd9bd;
  background: #fffaf5;
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
}

.pg-order-card .pg-order-id {
  font-weight: 700;
  color: #a05a1c;
  font-size: 14px;
}

/* 模拟企业微信推送状态 */
.pg-wecom {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  background: #f4f6f8;
  border: 1px solid var(--pg-line);
  color: var(--pg-ink-sub);
}

.pg-wecom.ok {
  background: #e8f5ef;
  border-color: #9fd6bf;
  color: var(--pg-ok);
}

.pg-wecom .pg-wecom-link {
  color: var(--pg-accent);
  font-weight: 600;
  text-decoration: underline;
}

/* 页脚免责声明 */
.pg-footer {
  padding: 4px 16px 90px;
  text-align: center;
  font-size: 11px;
  color: #98a0aa;
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto;
}

/* toast */
.pg-toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%);
  background: rgba(31, 36, 41, 0.92);
  color: #fff;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}

.pg-toast.show { opacity: 1; }

/* 模拟滴卡入口（演示用） */
.pg-sim {
  padding: 4px 16px 0;
  max-width: 560px;
  margin: 0 auto;
  font-size: 12px;
  color: #8a929c;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.pg-sim-card {
  display: inline-block;
  padding: 4px 10px;
  border: 1px dashed #c3cad1;
  border-radius: 8px;
  color: #5b6470;
  text-decoration: none;
  background: #fff;
}

.pg-sim-card:hover { border-color: var(--pg-accent); color: var(--pg-accent); }

/* 上报人输入框 */
.pg-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--pg-line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--pg-ink);
  background: #fafbfc;
}

.pg-input:focus {
  outline: none;
  border-color: var(--pg-accent);
  background: #fff;
}

/* 工单卡 · AI 规整块 */
.pg-ai-block {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f7f8fa;
  border: 1px solid var(--pg-line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.pg-ai-label {
  display: block;
  font-size: 11px;
  color: #8a929c;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.pg-ai-row { color: var(--pg-ink); }

.pg-disclaimer-mini {
  margin-top: 8px;
  font-size: 11px;
  color: #98a0aa;
  line-height: 1.5;
}

.pg-badge.warn { background: #fdf6e3; color: var(--pg-warn); }

/* ---------- 顶栏历史按钮 ---------- */
.pg-topbar { position: relative; }

.pg-hist-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 1px;
}

.pg-hist-btn:active { background: rgba(255, 255, 255, 0.22); }

/* ---------- 历史记录抽屉（底部弹层，两级视图） ---------- */
.pg-sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 19, 24, 0.55);
  z-index: 9000;
}

.pg-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9001;
  background: #fff;
  border-radius: 16px 16px 0 0;
  max-height: 82vh;
  min-height: 46vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -6px 24px rgba(20, 24, 28, 0.18);
  animation: pg-sheet-up 0.25s ease;
}

@keyframes pg-sheet-up {
  from { transform: translateY(48px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.pg-sheet-head {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #eef1f4;
}

.pg-sheet-title {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--pg-ink);
}

.pg-sheet-close {
  border: none;
  background: #f1f3f6;
  color: #5b6470;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.pg-sheet-back {
  border: none;
  background: transparent;
  color: var(--pg-accent);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px 4px 0;
  cursor: pointer;
  min-width: 52px;
  text-align: left;
}

.pg-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  overscroll-behavior: contain;
}

.pg-sheet-foot {
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
  font-size: 10px;
  color: #98a0aa;
  text-align: center;
  border-top: 1px dashed #eef1f4;
}

/* 日历视图 */
.pg-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pg-cal-nav {
  border: 1px solid #dfe4e8;
  background: #fff;
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 15px;
  color: var(--pg-ink-sub);
  cursor: pointer;
  font-family: inherit;
}

.pg-cal-nav[disabled] { opacity: 0.35; cursor: not-allowed; }

.pg-cal-title { font-weight: 700; font-size: 14px; color: var(--pg-ink); }

.pg-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }

.pg-cal-wd {
  font-size: 10px;
  color: #8a929c;
  text-align: center;
  padding: 4px 0;
}

.pg-cal-cell {
  position: relative;
  text-align: center;
  padding: 9px 0;
  font-size: 13px;
  border-radius: 9px;
  color: var(--pg-ink);
  border: 1px solid transparent;
}

.pg-cal-cell.empty { visibility: hidden; }

.pg-cal-cell.has {
  background: #fff7f0;
  border-color: #ffd9bd;
  color: #c25a00;
  font-weight: 700;
  cursor: pointer;
}

.pg-cal-cell.has::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--pg-accent);
}

.pg-cal-cell.sel {
  background: var(--pg-ink) !important;
  color: #fff !important;
  border-color: var(--pg-ink) !important;
}

.pg-cal-cell.today { border: 1px dashed var(--pg-accent); }

/* 当天记录视图 */
.pg-h-day {
  display: flex;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px dashed #eef1f4;
  font-size: 13px;
  align-items: baseline;
}

.pg-h-day:last-child { border-bottom: none; }

.pg-h-time {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #8a929c;
  flex: none;
}

.pg-h-text { flex: 1; color: var(--pg-ink); line-height: 1.5; }

.pg-h-badges { display: flex; gap: 4px; flex: none; }

.pg-h-station {
  font-size: 10px;
  color: #98a0aa;
  margin-top: 2px;
}

.pg-h-empty {
  text-align: center;
  color: #98a0aa;
  padding: 30px 0;
  font-size: 13px;
}

/* 历史 · 详情按钮与三级详情视图 */
.pg-h-detail {
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--pg-accent);
  background: #f0f6ff;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  cursor: pointer;
}
.pg-h-detail:active { background: #e3edff; }

.pg-hd-sec {
  background: #fff;
  border: 1px solid #e7ebef;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.pg-hd-sec-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--pg-ink);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #eef1f4;
}
.pg-hd-row {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
  line-height: 1.55;
  align-items: baseline;
}
.pg-hd-label {
  flex: none;
  width: 74px;
  color: #8a929c;
  font-size: 12px;
}
.pg-hd-value { flex: 1; color: var(--pg-ink); word-break: break-all; }
.pg-hd-note {
  font-size: 11px;
  color: #98a0aa;
  margin-top: 8px;
  line-height: 1.5;
}
.pg-risk-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pg-risk-tag.r-urgent { background: #fdeeed; color: var(--pg-danger); }
.pg-risk-tag.r-high   { background: #fff1e6; color: #d97a1e; }
.pg-risk-tag.r-normal { background: #fdf6e3; color: var(--pg-warn); }
.pg-risk-tag.r-low    { background: #e8f5ef; color: var(--pg-ok); }

/* 详情 · 真实工单 iframe（与服务端详情页同款视觉） */
.pg-hd-frame-wrap {
  border: 1px solid #e7ebef;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.pg-hd-frame {
  display: block;
  width: 100%;
  height: 72vh;
  border: none;
}

/* 历史 · 全屏前进详情页（演示快照用） */
.pg-hist-full {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  background: #f4f6f8;
}
.pg-hist-full[hidden] { display: none !important; }
.pg-hist-full .pg-topbar { flex: none; }
.pg-hist-full .pg-sheet-title { flex: 1; text-align: center; }
.pg-hist-full-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #f4f6f8;
}

/* 白色返回栏（详情页顶部，滚动时常驻） */
.od-backbar {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 10px 14px;
  border-bottom: 1px solid #e7ebef;
  box-shadow: 0 1px 4px rgba(20, 24, 28, .05);
  flex: none;
}
.od-backbar button {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid #dfe4e8;
  border-radius: 999px;
  background: #fafbfc;
  color: #1f2429;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.od-backbar button:active { background: #eef0f2; }
.od-backbar span { font-size: 12px; color: #98a0aa; }

/* 详情 · 快照渲染（编号字段版式，对齐服务端详情页） */
.pg-hd-sec-title.bar {
  border-left: 4px solid var(--pg-warn);
  padding-left: 8px;
  border-bottom: 1px solid #f0f2f5;
}
.pg-hd-row { align-items: flex-start; }
.pg-hd-no {
  flex: none;
  width: 26px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  background: #f2f5f8;
  color: #8a929c;
  border-radius: 6px;
  font-size: 11px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  margin-top: 2px;
}
.pg-hd-main { flex: 1; min-width: 0; }
.pg-hd-main .pg-hd-label {
  width: auto;
  font-size: 11px;
  color: #98a0aa;
  margin-bottom: 2px;
}
.pg-hd-main .pg-hd-value { font-size: 13px; }

/* 故障上报 · 异常项联动区 */.pg-fault-item {
  padding: 10px 12px;
  background: #fdf3f2;
  border: 1px solid #f0c5c0;
  border-radius: 10px;
  margin-bottom: 10px;
}

.pg-fault-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--pg-danger);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pg-fault-item-title::before {
  content: "!";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--pg-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pg-fault-item .pg-chip {
  background: #fff;
}

.pg-fault-item .pg-chip.on {
  background: var(--pg-danger);
  color: #fff;
  border-color: var(--pg-danger);
}
