.zp-dd-dialog {
  color-scheme: dark;
  box-sizing: border-box;
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  border: 1px solid #475569;
  border-radius: 16px;
  background: #111827;
  color: #f1f5f9;
  box-shadow: 0 24px 80px #0008;
  overflow: auto;
  overscroll-behavior: contain;
  font: 14px/1.55 system-ui, sans-serif;
}

.zp-dd-dialog[open] { display: flex; flex-direction: column; gap: 14px; }
.zp-dd-dialog::backdrop { background: #000a; }
.zp-dd-dialog *, .zp-dd-dialog *::before, .zp-dd-dialog *::after { box-sizing: border-box; }
.zp-dd-dialog p, .zp-dd-dialog h2, .zp-dd-dialog dl { margin: 0; }

.zp-dd-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.zp-dd-header h2 { font-size: 21px; }

.zp-dd-hint { font-size: 13px; color: #cbd5e1; }
.zp-dd-error { color: #fecaca; padding: 10px 12px; border: 1px solid #b45353; border-radius: 8px; background: #401e28; overflow-wrap: anywhere; }
.zp-dd-activity { color: #93c5fd; font-size: 14px; }

.zp-dd-selectors, .zp-dd-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.zp-dd-selectors label { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }

.zp-dd-dialog .zp-dd-button, .zp-dd-dialog select {
  min-height: 44px;
  border: 1px solid #64748b;
  border-radius: 8px;
  padding: 8px 12px;
  background: #1e293b;
  color: #f8fafc;
  font: inherit;
}

.zp-dd-dialog select { width: 100%; min-width: 0; }
.zp-dd-button { cursor: pointer; flex-shrink: 0; }
.zp-dd-button:not(:disabled):hover { background: #334155; }
.zp-dd-primary { background: #1d4ed8; border-color: #60a5fa; }
.zp-dd-primary:not(:disabled):hover { background: #2563eb; }

.zp-dd-dialog :disabled { opacity: .55; cursor: default; }
.zp-dd-dialog :focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }

.zp-dd-summary { display: grid; grid-template-columns: minmax(100px, 140px) minmax(0, 1fr); gap: 4px 12px; }
.zp-dd-summary dt { color: #94a3b8; font-weight: 500; }
.zp-dd-summary dd { margin: 0; overflow-wrap: anywhere; }

.zp-dd-rows { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.zp-dd-row { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 8px; background: #1e293b; }
.zp-dd-row-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.zp-dd-row-header strong { font-size: 15px; }
.zp-dd-reason { font-size: 14px; color: #cbd5e1; margin: 0; }
.zp-dd-time { min-height: 44px; width: auto; padding: 0 12px; }

.zp-dd-tag { font-size: 12px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.zp-dd-failed, .zp-dd-cut { color: #f87171; background: #450a0a; }
.zp-dd-review_pending, .zp-dd-unknown, .zp-dd-unmeasured, .zp-dd-original_preserved { color: #fbbf24; background: #451a03; }
.zp-dd-ok { color: #4ade80; background: #064e3b; }
.zp-dd-skipped { color: #94a3b8; background: #1e293b; border: 1px solid #475569; }

.zp-dd-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; }
.zp-dd-pagination span { font-size: 14px; color: #94a3b8; }

.zp-dd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.zp-dd-actions .zp-dd-button { flex: 1 1 auto; }

.zp-dd-dialog [hidden] { display: none !important; }

@media (max-width: 360px) {
  .zp-dd-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
    padding: 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    border-radius: 12px;
  }
  .zp-dd-header h2 { font-size: 18px; }
  .zp-dd-selectors, .zp-dd-filters { flex-direction: column; }
  .zp-dd-summary { grid-template-columns: 1fr; gap: 2px; }
  .zp-dd-summary dt { font-size: 12px; color: #94a3b8; }
  .zp-dd-summary dd { font-size: 14px; margin-bottom: 4px; }
  .zp-dd-row-header { flex-direction: column; align-items: flex-start; gap: 4px; }
  .zp-dd-actions .zp-dd-button { flex: 1 1 100%; }
}
