/* Pro-inspection-items-list 复刻（默认检测项模板管理） */
.pitems-view.view {
  background: #eef5fb;
  padding: 0 !important;
  max-width: none;
  margin: 0;
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pitems-view.view.active {
  display: flex !important;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding-top: var(--page-safe-top) !important;
  padding-right: 0 !important;
  padding-bottom: 0 !important;
  padding-left: 0 !important;
}

.pitems-container {
  flex: 1;
  min-height: 0;
  height: 0; /* 强制列表区可滚动（Android WebView） */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 0;
}

.pitems-compact-header {
  background: #fff;
  padding: 8px 12px;
  flex-shrink: 0;
}

.pitems-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pitems-title {
  font-size: 17px;
  font-weight: 700;
  color: #12335b;
}

.pitems-subtitle {
  font-size: 11px;
  color: #7b92ab;
  margin-left: 6px;
}

.pitems-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pitems-save-btn {
  padding: 5px 10px;
  background: #e8eef6;
  color: #7b92ab;
  border: 1px solid #d5e0ec;
  border-radius: 4px;
  font-size: 12px;
  cursor: default;
}

.pitems-save-btn.dirty {
  background: linear-gradient(135deg, #2e6bd9 0%, #1f56c0 100%);
  color: #fff;
  border-color: transparent;
  cursor: pointer;
}

.pitems-save-btn:disabled {
  opacity: 0.85;
}

.pitems-delete-template-btn {
  padding: 5px 10px;
  background: #fff;
  color: #e53935;
  border: 1px solid #f3b4b0;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.pitems-delete-template-btn:active {
  opacity: 0.85;
}

.pitems-add-btn {
  padding: 5px 10px;
  background: linear-gradient(135deg, #2e6bd9 0%, #1f56c0 100%);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.pitems-search {
  margin-top: 6px;
}

.pitems-search input {
  width: 100%;
  box-sizing: border-box;
  background: #eef5fb;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}

.pitems-filters {
  background: #fff;
  padding: 6px 12px;
  border-bottom: 1px solid #dbe8f4;
  flex-shrink: 0;
}

.pitems-filter-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.pitems-filter-row:last-child { margin-bottom: 0; }

.pitems-filter-item {
  flex-shrink: 0;
  padding: 5px 8px;
  border-radius: 12px;
  font-size: 12px;
  color: #666;
  background: #eef5fb;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.pitems-filter-item.small {
  padding: 4px 7px;
  font-size: 11px;
}

.pitems-filter-item.active {
  background: linear-gradient(135deg, #2e6bd9 0%, #1f56c0 100%);
  color: #fff;
}

.pitems-filter-count {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.1);
  padding: 1px 4px;
  border-radius: 8px;
  margin-left: 3px;
}

.pitems-filter-item.active .pitems-filter-count {
  background: rgba(255, 255, 255, 0.3);
}

.pitems-list {
  flex: 1;
  min-height: 0;
  height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 8px 12px;
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
}

.pitems-card {
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  transition: box-shadow 0.15s ease, opacity 0.15s ease;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.pitems-card.pitems-card-dragging {
  opacity: 0.96;
  box-shadow: 0 10px 28px rgba(18, 51, 91, 0.28);
  z-index: 20;
  position: relative;
  touch-action: none !important;
  cursor: grabbing;
}

.pitems-list.pitems-dragging {
  touch-action: none !important;
  overflow-y: auto;
}

body.pitems-body-dragging {
  /* 仅锁定列表页滚动，勿锁死整个 App（否则导入页等无法滑动） */
  overscroll-behavior: none;
}

.pitems-drag-handle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: -4px 2px -4px -4px;
  color: #6f86a3;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  -webkit-touch-callout: none;
  border-radius: 8px;
  background: #eef3f9;
}

.pitems-field-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  gap: 4px;
}

.pitems-delete-btn {
  font-size: 10px;
  color: #f44336;
  padding: 2px 6px;
  border: 1px solid #f44336;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}

.pitems-name {
  font-size: 14px;
  font-weight: 600;
  color: #12335b;
}

.pitems-name-wrap {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.pitems-name-wrap:hover { background: rgba(46, 107, 217, 0.08); }

.pitems-edit-hint {
  font-size: 9px;
  color: #2e6bd9;
  margin-left: 4px;
}

.pitems-group {
  font-size: 11px;
  color: #7b92ab;
  padding: 2px 5px;
  background: #eef5fb;
  border-radius: 4px;
}

.pitems-cat2 {
  font-size: 11px;
  color: #ff9500;
  background: #fff7e6;
  padding: 2px 5px;
  border-radius: 2px;
}

.pitems-mode-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  font-size: 13px;
}

.pitems-mode-1 { color: #2e6bd9; font-weight: 500; }
.pitems-mode-sep { color: #999; }
.pitems-mode-2 { color: #333; }
.pitems-mode-3 { color: #666; }

.pitems-sub-table {
  background: #f9f9f9;
  border-radius: 4px;
  margin-top: 6px;
  padding: 5px;
  font-size: 11px;
  width: 100%;
  box-sizing: border-box;
}

.pitems-pos-table { background: #f0f8ff; }

.pitems-sub-header {
  display: flex;
  padding: 4px 0;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 4px;
  color: #999;
  font-weight: 500;
}

.pitems-sub-row {
  display: flex;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid #f0f0f0;
}

.pitems-sub-row:last-child { border-bottom: none; }

.pitems-col-cat { width: 60px; flex-shrink: 0; }
.pitems-col-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitems-col-sev { width: 40px; text-align: center; flex-shrink: 0; font-weight: 600; }
.pitems-col-act { width: 30px; text-align: center; flex-shrink: 0; }
.pitems-col-del { width: 36px; text-align: center; flex-shrink: 0; }
.pitems-col-pos-name { flex: 1; min-width: 0; }

.pitems-tag-mini {
  font-size: 11px;
  color: #fff;
  background: #333;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 3px;
}

.pitems-sev-0 { color: #4caf50; }
.pitems-sev-1 { color: #ff9800; }
.pitems-sev-2 { color: #ff5722; }
.pitems-sev-3 { color: #f44336; }

.pitems-mini-edit {
  font-size: 10px;
  color: #2e6bd9;
  cursor: pointer;
  padding: 2px 6px;
}

.pitems-mini-del {
  font-size: 9px;
  color: #f44336;
  padding: 2px 4px;
  border: 1px solid #f44336;
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
}

.pitems-sub-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #e5e5e5;
}

.pitems-add-sub-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  border: none;
}

.pitems-add-sub-btn.lib { color: #2e6bd9; background: #edf4ff; }
.pitems-add-sub-btn.custom { color: #ff9500; background: #fff7e6; }
.pitems-add-sub-btn.pos { color: #2e6bd9; background: #edf4ff; }

.pitems-empty-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
}

.pitems-no-status { color: #999; font-size: 11px; }

.pitems-empty {
  text-align: center;
  padding: 48px 16px;
  color: #7b92ab;
  font-size: 14px;
}

.pitems-loading {
  text-align: center;
  padding: 32px;
  color: #7b92ab;
}

.pitems-report-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.pitems-report-tag {
  font-size: 10px;
  color: #2e6bd9;
  background: #edf4ff;
  padding: 2px 6px;
  border-radius: 2px;
}

/* Modals */
.pitems-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1200;
}

.pitems-mask.hidden { display: none; }

.pitems-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: #fff;
  border-radius: 10px;
  width: min(92vw, 420px);
  max-height: 85vh;
  z-index: 1201;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pitems-modal.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.pitems-modal.bottom {
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  transform: translateY(100%);
  width: 100%;
  max-width: 100%;
  border-radius: 15px 15px 0 0;
  max-height: 88vh;
}

.pitems-modal.bottom.show {
  transform: translateY(0);
}

.pitems-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #dbe8f4;
  font-size: 16px;
  font-weight: 600;
  color: #12335b;
}

.pitems-modal-close {
  font-size: 24px;
  color: #7b92ab;
  cursor: pointer;
  padding: 0 8px;
  border: none;
  background: none;
}

.pitems-modal-body {
  padding: 15px;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.pitems-modal-foot {
  display: flex;
  gap: 10px;
  padding: 15px;
  border-top: 1px solid #dbe8f4;
  flex-shrink: 0;
}

.pitems-modal-btn {
  flex: 1;
  padding: 12px 0;
  border-radius: 6px;
  font-size: 15px;
  text-align: center;
  border: none;
  cursor: pointer;
}

.pitems-modal-btn.cancel { background: #eef5fb; color: #666; }
.pitems-modal-btn.confirm {
  background: linear-gradient(135deg, #2e6bd9 0%, #1f56c0 100%);
  color: #fff;
}

.pitems-form-item { margin-bottom: 15px; }
.pitems-form-item:last-child { margin-bottom: 0; }

.pitems-label {
  font-size: 13px;
  color: #7b92ab;
  margin-bottom: 6px;
  display: block;
}

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

.pitems-input {
  width: 100%;
  box-sizing: border-box;
  background: #eef5fb;
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
}

.pitems-textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 80px;
  background: #eef5fb;
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.pitems-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pitems-option {
  padding: 4px 6px;
  background: #eef5fb;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
  border: none;
  cursor: pointer;
}

.pitems-option.active {
  background: linear-gradient(135deg, #2e6bd9 0%, #1f56c0 100%);
  color: #fff;
}

.pitems-inline-add {
  font-size: 12px;
  color: #2e6bd9;
  padding: 3px 8px;
  background: #edf4ff;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

.pitems-state-list {
  max-height: 45vh;
  overflow-y: auto;
}

.pitems-state-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  background: #eef5fb;
  border-radius: 4px;
  margin-bottom: 5px;
  cursor: pointer;
}

.pitems-state-item.selected {
  background: #edf4ff;
  border: 1px solid #2e6bd9;
}

.pitems-state-item.added { opacity: 0.55; }

.pitems-check {
  width: 18px;
  height: 18px;
  border: 1px solid #ddd;
  border-radius: 3px;
  margin-right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}

.pitems-check.on {
  background: linear-gradient(135deg, #2e6bd9 0%, #1f56c0 100%);
  border-color: #2e6bd9;
}

.pitems-select-all {
  padding: 5px 12px;
  background: #eef5fb;
  border-radius: 4px;
  font-size: 13px;
  color: #666;
  border: none;
  cursor: pointer;
}

.pitems-select-all.on {
  background: linear-gradient(135deg, #2e6bd9 0%, #1f56c0 100%);
  color: #fff;
}

.pitems-sort-active { color: #2e6bd9; cursor: pointer; }
