.zp-ai-dialog {
  color-scheme: dark;
  box-sizing: border-box;
  width: min(820px, 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-ai-dialog[open] { display: flex; flex-direction: column; gap: 14px; }
.zp-ai-dialog::backdrop { background: #000a; }
.zp-ai-dialog *, .zp-ai-dialog *::before, .zp-ai-dialog *::after { box-sizing: border-box; }
.zp-ai-dialog p, .zp-ai-dialog h2, .zp-ai-dialog h3, .zp-ai-dialog dl { margin: 0; }
.zp-ai-dialog h2 { font-size: 21px; }
.zp-ai-dialog h3 { font-size: 16px; }
.zp-ai-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.zp-ai-hint { font-size: 13px; color: #cbd5e1; }
.zp-ai-error { color: #fecaca; padding: 10px 12px; border: 1px solid #b45353; border-radius: 8px; background: #401e28; overflow-wrap: anywhere; }
.zp-ai-activity { color: #93c5fd; }
.zp-ai-records { display: flex; align-items: end; gap: 10px; }
.zp-ai-records label { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }
.zp-ai-button, .zp-ai-selector {
  min-height: 44px;
  border: 1px solid #64748b;
  border-radius: 8px;
  padding: 8px 12px;
  background: #1e293b;
  color: #f8fafc;
  font: inherit;
}
.zp-ai-selector { width: 100%; min-width: 0; }
.zp-ai-button { cursor: pointer; flex-shrink: 0; }
.zp-ai-button:not(:disabled):hover { background: #334155; }
.zp-ai-primary { background: #1d4ed8; border-color: #60a5fa; }
.zp-ai-primary:not(:disabled):hover { background: #2563eb; }
.zp-ai-dialog :disabled { opacity: .55; cursor: default; }
.zp-ai-dialog :focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.zp-ai-details { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.zp-ai-filename { overflow-wrap: anywhere; }
.zp-ai-state { color: #93c5fd; font-weight: 600; }
.zp-ai-diagnosis { display: grid; grid-template-columns: minmax(110px, 150px) minmax(0, 1fr); gap: 5px 14px; }
.zp-ai-diagnosis dt { color: #94a3b8; }
.zp-ai-diagnosis dd { margin: 0; overflow-wrap: anywhere; }
.zp-ai-notices { display: flex; flex-direction: column; gap: 6px; color: #fde68a; }
.zp-ai-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.zp-ai-events { margin: 0; padding-left: 22px; max-height: 220px; overflow: auto; overflow-wrap: anywhere; }
.zp-ai-events li + li { margin-top: 6px; }
.zp-ai-dialog [hidden] { display: none !important; }
@media (max-width: 480px) {
  .zp-ai-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-ai-records { flex-direction: column; align-items: stretch; }
  .zp-ai-actions .zp-ai-button { flex: 1 1 auto; }
  .zp-ai-diagnosis { grid-template-columns: minmax(90px, 110px) minmax(0, 1fr); gap: 6px 10px; }
}
