.qbc-pu-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
}

.qbc-pu-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1080px;
  max-height: calc(100vh - 24px);
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 18px;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.35);
}

.qbc-pu-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  background: linear-gradient(120deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%);
  color: #fff;
}

.qbc-pu-heading h2,
.qbc-pu-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.qbc-pu-subtitle {
  margin: 4px 0 0;
  color: rgba(226, 232, 240, 0.86);
  font-size: 12px;
  line-height: 1.5;
}

.qbc-pu-close {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.qbc-pu-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.qbc-pu-toolbar {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.qbc-pu-select {
  min-width: 150px;
  max-width: 220px;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
}

.qbc-pu-ranges {
  display: inline-flex;
  padding: 2px;
  border-radius: 10px;
  background: #f1f5f9;
}

.qbc-pu-range {
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
}

.qbc-pu-range.is-active {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}

.qbc-pu-button {
  margin-left: auto;
  padding: 7px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  cursor: pointer;
}

.qbc-pu-button:hover {
  background: #f8fafc;
}

.qbc-pu-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.qbc-pu-danger {
  margin-left: 0;
  border-color: #fecaca;
  color: #b91c1c;
}

.qbc-pu-export {
  margin-left: 0;
}

.qbc-pu-danger:hover {
  background: #fef2f2;
}

.qbc-pu-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px 8px;
  display: grid;
  gap: 14px;
}

.qbc-pu-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.qbc-pu-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.qbc-pu-stat[data-tone="accent"] {
  border-color: #bfdbfe;
  background: linear-gradient(160deg, #eff6ff, #fff);
}

.qbc-pu-stat[data-tone="warn"] {
  border-color: #fde68a;
  background: linear-gradient(160deg, #fffbeb, #fff);
}

.qbc-pu-stat[data-tone="danger"] {
  border-color: #fecaca;
  background: linear-gradient(160deg, #fef2f2, #fff);
}

.qbc-pu-stat-label {
  color: #64748b;
  font-size: 12px;
}

.qbc-pu-stat-value {
  color: #0f172a;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.qbc-pu-stat-unit {
  margin-left: 3px;
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
}

.qbc-pu-stat-delta {
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

.qbc-pu-stat-delta.is-up {
  color: #15803d;
}

.qbc-pu-stat-delta.is-down {
  color: #b91c1c;
}

.qbc-pu-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.qbc-pu-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.qbc-pu-card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.qbc-pu-count {
  color: #64748b;
  font-size: 12px;
}

.qbc-pu-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: end;
  gap: 6px;
  height: 130px;
  padding-top: 6px;
}

.qbc-pu-bar {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100%;
  border-radius: 6px;
  background: #f1f5f9;
  cursor: default;
}

.qbc-pu-bar-fill {
  display: block;
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.qbc-pu-bar-fill.is-empty {
  background: #e2e8f0;
}

.qbc-pu-bar-tip {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  color: #94a3b8;
  font-size: 9px;
  white-space: nowrap;
}

.qbc-pu-miss-list {
  display: grid;
  gap: 4px;
}

.qbc-pu-miss-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
}

.qbc-pu-miss-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
}

.qbc-pu-miss-name {
  min-width: 0;
  overflow: hidden;
  color: #334155;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qbc-pu-miss-count {
  color: #b45309;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.qbc-pu-miss-time {
  color: #94a3b8;
  font-size: 11px;
  white-space: nowrap;
}

.qbc-pu-table-wrap {
  overflow-x: auto;
}

.qbc-pu-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
}

.qbc-pu-table th {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.qbc-pu-table th.is-num,
.qbc-pu-table td.is-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.qbc-pu-table th.is-sortable {
  cursor: pointer;
  user-select: none;
}

.qbc-pu-table th.is-sortable:hover {
  color: #2563eb;
}

.qbc-pu-table th.is-active {
  color: #2563eb;
}

.qbc-pu-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.qbc-pu-row:hover {
  background: #f8fafc;
}

.qbc-pu-row.is-open {
  background: #eff6ff;
}

.qbc-pu-table td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.qbc-pu-table td.is-danger {
  color: #b91c1c;
  font-weight: 600;
}

.qbc-pu-name strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}

.qbc-pu-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.qbc-pu-tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 10px;
  line-height: 16px;
}

.qbc-pu-tag.is-on {
  background: #dcfce7;
  color: #15803d;
}

.qbc-pu-muted {
  color: #64748b;
  white-space: nowrap;
}

.qbc-pu-detail-row td {
  padding: 0 10px 12px;
  background: #f8fafc;
}

.qbc-pu-detail {
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

.qbc-pu-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 10px;
  color: #64748b;
  font-size: 11px;
}

.qbc-pu-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.qbc-pu-detail-block h4 {
  margin: 0 0 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.qbc-pu-detail-list {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  font-size: 12px;
  line-height: 1.9;
}

.qbc-pu-detail-name {
  margin-right: 6px;
}

.qbc-pu-detail-value {
  color: #64748b;
}

.qbc-pu-empty {
  margin: 8px 0;
  color: #94a3b8;
  font-size: 12px;
}

.qbc-pu-footer {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.qbc-pu-status {
  color: #64748b;
  font-size: 12px;
}

.qbc-pu-status[data-tone="ok"] {
  color: #15803d;
}

.qbc-pu-status[data-tone="error"] {
  color: #b91c1c;
}

.qbc-pu-config-toggle {
  margin-left: auto;
}

.qbc-pu-config-toggle + .qbc-pu-button {
  margin-left: 0;
}

.qbc-pu-config-toggle.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.qbc-pu-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.qbc-pu-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.qbc-pu-field-wide {
  grid-column: 1 / -1;
}

.qbc-pu-field-label {
  color: #475569;
  font-size: 12px;
}

.qbc-pu-input,
.qbc-pu-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  font-family: inherit;
}

.qbc-pu-textarea {
  resize: vertical;
  line-height: 1.5;
}

.qbc-pu-input:focus,
.qbc-pu-textarea:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

.qbc-pu-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
}

.qbc-pu-config-more {
  margin-top: 12px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 10px;
}

.qbc-pu-config-more summary {
  cursor: pointer;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.qbc-pu-config-more .qbc-pu-config-grid {
  margin-top: 10px;
}

.qbc-pu-config-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.qbc-pu-hint {
  flex: 1 1 220px;
  color: #64748b;
  font-size: 12px;
}

.qbc-pu-config-actions .qbc-pu-button {
  margin-left: 0;
}

.qbc-pu-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.qbc-pu-primary:hover {
  background: #1d4ed8;
}

.qbc-pu-primary:disabled {
  border-color: #93c5fd;
  background: #93c5fd;
}

@media (max-width: 860px) {
  .qbc-pu-config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qbc-pu-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qbc-pu-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .qbc-pu-miss-item {
    grid-template-columns: 22px minmax(0, 1fr) auto;
  }

  .qbc-pu-miss-time {
    display: none;
  }
}

@media (max-width: 560px) {
  .qbc-pu-config-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .qbc-pu-overlay {
    padding: 0;
  }

  .qbc-pu-dialog {
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  .qbc-pu-toolbar {
    padding: 10px 14px;
  }

  .qbc-pu-body {
    padding: 12px 14px 6px;
  }

  .qbc-pu-button {
    margin-left: 0;
  }

  .qbc-pu-chart {
    height: 110px;
    gap: 4px;
  }

  .qbc-pu-bar-tip {
    display: none;
  }
}

html[data-theme="dark"] .qbc-pu-dialog {
  border-color: #1e293b;
  background: #0b1220;
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-pu-toolbar,
html[data-theme="dark"] .qbc-pu-footer {
  border-color: #1e293b;
  background: #0f172a;
}

html[data-theme="dark"] .qbc-pu-select,
html[data-theme="dark"] .qbc-pu-button {
  border-color: #334155;
  background: #111c2e;
  color: #cbd5e1;
}

html[data-theme="dark"] .qbc-pu-ranges {
  background: #111c2e;
}

html[data-theme="dark"] .qbc-pu-range {
  color: #94a3b8;
}

html[data-theme="dark"] .qbc-pu-stat,
html[data-theme="dark"] .qbc-pu-card,
html[data-theme="dark"] .qbc-pu-detail {
  border-color: #1e293b;
  background: #0f172a;
}

html[data-theme="dark"] .qbc-pu-stat-value,
html[data-theme="dark"] .qbc-pu-name strong,
html[data-theme="dark"] .qbc-pu-card-head h3 {
  color: #f1f5f9;
}

html[data-theme="dark"] .qbc-pu-bar {
  background: #1e293b;
}

html[data-theme="dark"] .qbc-pu-miss-item {
  background: #111c2e;
}

html[data-theme="dark"] .qbc-pu-miss-rank {
  background: #1e293b;
  color: #cbd5e1;
}

html[data-theme="dark"] .qbc-pu-miss-name {
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-pu-detail-meta {
  color: #94a3b8;
}

html[data-theme="dark"] .qbc-pu-table th {
  border-color: #1e293b;
  color: #94a3b8;
}

html[data-theme="dark"] .qbc-pu-table td {
  border-color: #16233a;
  color: #cbd5e1;
}

html[data-theme="dark"] .qbc-pu-row:hover {
  background: #131f33;
}

html[data-theme="dark"] .qbc-pu-row.is-open {
  background: #16294a;
}

html[data-theme="dark"] .qbc-pu-detail-row td {
  background: #0d1728;
}

html[data-theme="dark"] .qbc-pu-tag {
  background: #1e293b;
  color: #94a3b8;
}

html[data-theme="dark"] .qbc-pu-tag.is-on {
  background: #14532d;
  color: #86efac;
}

html[data-theme="dark"] .qbc-pu-config-toggle.is-active {
  border-color: #1d4ed8;
  background: #16294a;
  color: #bfdbfe;
}

html[data-theme="dark"] .qbc-pu-field-label {
  color: #94a3b8;
}

html[data-theme="dark"] .qbc-pu-input,
html[data-theme="dark"] .qbc-pu-textarea {
  border-color: #334155;
  background: #111c2e;
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-pu-switch {
  border-color: #1e293b;
  background: #111c2e;
  color: #cbd5e1;
}

html[data-theme="dark"] .qbc-pu-config-more {
  border-color: #1e293b;
}

html[data-theme="dark"] .qbc-pu-config-more summary {
  color: #cbd5e1;
}
