/* QC admin — align with main admin table/modal patterns */
.modal.qc-modal {
  width: min(1180px, calc(100vw - 48px));
  max-width: min(1180px, calc(100vw - 48px));
  height: min(860px, calc(100vh - 40px));
  max-height: min(860px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.qc-modal .modal-head {
  flex-shrink: 0;
  padding: 20px 24px;
}

.modal.qc-modal .qc-seg {
  flex-shrink: 0;
}

.modal.qc-modal .modal-foot.qc-modal-foot {
  flex-shrink: 0;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line);
}

.modal.qc-modal .modal-body.qc-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px 24px 24px;
  -webkit-overflow-scrolling: touch;
}

.qc-modal-head-main h2 {
  margin: 0;
}

.qc-modal-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.qc-seg {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  background: #f6f8fb;
}

.qc-seg-btn {
  border: none;
  background: transparent;
  padding: 10px 14px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.qc-seg-btn.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
  background: #fff;
}

.qc-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px 24px 24px;
}

.qc-tab-panel.hidden {
  display: none;
}

.qc-info-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  background: #fff;
}

.qc-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 0;
}

.qc-info-table-v2 th {
  width: 96px;
  white-space: nowrap;
}

.qc-info-table th,
.qc-info-table td {
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: middle;
}

.qc-info-table tr th:last-child,
.qc-info-table tr td:last-child {
  border-right: none;
}

.qc-info-table tr:last-child th,
.qc-info-table tr:last-child td {
  border-bottom: none;
}

.qc-info-table th {
  background: #f6f8fb;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
}

.qc-info-table td {
  color: var(--ink);
  background: #fff;
}

.qc-code {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
  color: #334155;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

.qc-overview-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 900px) {
  .qc-overview-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.qc-stat-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.qc-stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.qc-stat-value {
  display: block;
  font-size: 24px;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.qc-type-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qc-overview-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 280px;
  gap: 14px;
  align-items: start;
}

@media (max-width: 960px) {
  .qc-overview-grid {
    grid-template-columns: 1fr;
  }
}

.qc-section {
  padding: 16px 18px;
  margin: 0;
}

.qc-section-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.qc-section .qc-pre {
  margin: 0;
  min-height: 120px;
  max-height: 220px;
  overflow: auto;
}

.qc-attach-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.qc-attach-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  margin-bottom: 8px;
}

.qc-attach-list li:last-child {
  margin-bottom: 0;
}

.qc-attach-list a {
  color: #1d4ed8;
  text-decoration: none;
  font-size: 13px;
}

.qc-attach-list a:hover {
  text-decoration: underline;
}

.qc-empty-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.qc-qr-box {
  text-align: center;
}

.qc-qr-box img {
  width: 160px;
  height: 160px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.qc-qr-tip {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.qc-edit-form .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 720px) {
  .qc-edit-form .field-row {
    grid-template-columns: 1fr;
  }
}

.qc-edit-form .field-row .field-col label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.qc-edit-form .field-min input {
  max-width: 140px;
}

.qc-edit-form .field-types > label:first-child {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.qc-edit-form .field-types .qc-type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 900px) {
  .qc-edit-form .field-types .qc-type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.qc-edit-form .field.field-types label.qc-type-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
  user-select: none;
  line-height: 1.4;
  box-sizing: border-box;
}

.qc-edit-form .field.field-types label.qc-type-item .qc-type-check {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.qc-edit-form .field.field-types label.qc-type-item .qc-type-box {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qc-edit-form .field.field-types label.qc-type-item .qc-type-text {
  flex: 1;
  line-height: 1.4;
  color: var(--ink);
}

.qc-edit-form .field.field-types label.qc-type-item:has(.qc-type-check:checked) .qc-type-box {
  border-color: var(--accent);
  background: var(--accent);
}

.qc-edit-form .field.field-types label.qc-type-item:has(.qc-type-check:checked) .qc-type-box::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.qc-edit-form .field.field-types label.qc-type-item:has(.qc-type-check:checked) {
  border-color: #7bb9a5;
  background: var(--accent-soft);
}

.qc-edit-form .field.field-types label.qc-type-item:has(.qc-type-check:checked) .qc-type-text {
  color: var(--accent);
  font-weight: 600;
}

.qc-edit-form .field.field-types label.qc-type-item:has(.qc-type-check:disabled) {
  opacity: 0.6;
  cursor: not-allowed;
}

.qc-type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.qc-block-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.qc-pre {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 13px;
}

.qc-alert {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  margin-bottom: 14px;
}

.qc-inline-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: visible;
  margin-bottom: 16px;
}

.qc-modal-body .qc-inline-table-wrap {
  max-height: none;
  overflow: visible;
}

.qc-modal-body .qc-inline-table-wrap table th,
.qc-modal-body .qc-inline-table-wrap table td {
  padding: 14px 16px;
}

.qc-inline-table-wrap table {
  margin: 0;
}

.qc-inline-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f8fb;
}

.qc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.qc-toolbar input,
.qc-toolbar select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  min-width: 140px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}

.qc-toolbar select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #fbfcfe;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.qc-toolbar input:focus,
.qc-toolbar select:focus {
  border-color: #7bb9a5;
  box-shadow: 0 0 0 3px rgba(15, 110, 86, 0.12);
  outline: none;
}

.qc-participant-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

@media (max-width: 720px) {
  .qc-participant-form {
    grid-template-columns: 1fr;
  }
}

.qc-participant-form .field {
  margin-bottom: 0;
}

.qc-participant-form textarea {
  min-height: 72px;
  resize: vertical;
}

.qc-participant-form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.qc-submit-files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 8px;
}

.qc-detail-row td {
  background: #fbfcfe;
  padding: 16px 18px !important;
}

.qc-file-links {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.qc-file-links li {
  margin: 4px 0;
}

.qc-file-links a {
  color: #1d4ed8;
  text-decoration: none;
}

.qc-file-links a:hover {
  text-decoration: underline;
}

.qc-qrcode-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.qc-qrcode-inline img {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.qc-ref-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.qc-ref-toolbar .muted {
  font-size: 12px;
}

.qc-modal-foot {
  justify-content: space-between;
}

.qc-revoke-modal,
.qc-review-modal {
  max-width: 480px;
}

.qc-num {
  font-variant-numeric: tabular-nums;
}

#qcTaskModalMask {
  align-items: flex-start;
  padding-top: 20px;
  padding-bottom: 20px;
  overflow-y: auto;
}
