/* Uses the same overlay animation, title accent and mobile sheet as Macros,
   Report Preferences and Prior Report. All colors follow the active theme. */
.pd-overlay {
  position: fixed; inset: 0; z-index: 2147483300;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box; padding: 20px;
  background: rgba(3, 7, 18, .72); backdrop-filter: blur(5px);
  font-family: Outfit, system-ui, sans-serif;
}
.pd-dialog {
  display: flex; flex-direction: column; box-sizing: border-box;
  width: 760px; max-width: 100%; max-height: 88vh; max-height: 88dvh;
  overflow: hidden; border: 1px solid var(--app-border-strong, rgba(255,255,255,.14));
  border-radius: 16px; background: var(--app-card, #111a2e); color: var(--app-fg, #e5e7eb);
}
.pd-dialog.pd-announcement { width: 470px; }
.pd-header, .pd-actions, .pd-row-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pd-header {
  flex: 0 0 auto; align-items: flex-start; padding: 16px 20px;
  border-bottom: 1px solid var(--app-border-strong); background: var(--app-bg-3, #131c30);
}
.pd-header > div { min-width: 0; }
.pd-header .pd-copy { margin-bottom: 0; }
.pd-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; padding: 20px;
}
.pd-dialog h2 { font-size: 22px; font-weight: 700; letter-spacing: -.025em; margin: 0; }
.pd-dialog h3 { font-size: 15px; font-weight: 650; margin: 0 0 10px; }
.pd-header h3 { font-size: 19px; margin: 0; }
.pd-copy, .pd-muted { color: var(--app-fg-muted, #9ca3af); font-size: 13px; line-height: 1.55; margin: 7px 0 12px; }
.pd-muted { font-size: 12px; }
.pd-section { border-top: 1px solid var(--app-border, rgba(255,255,255,.09)); margin-top: 18px; padding-top: 18px; }
.pd-dialog label { display: block; font-size: 12px; font-weight: 600; margin: 10px 0 5px; }
.pd-dialog input, .pd-dialog textarea, .pd-dialog select {
  width: 100%; min-width: 0; box-sizing: border-box;
  background: var(--app-card-2, var(--app-bg-2, #0b1220)); color: var(--app-fg, #e5e7eb);
  border: 1px solid var(--app-border-strong, #334155); border-radius: 9px; padding: 10px 12px;
  font: inherit; font-size: 13px;
}
.pd-dialog textarea { resize: vertical; min-height: 76px; }
.pd-dialog :focus-visible { outline: 2px solid var(--accent, #60a5fa); outline-offset: 3px; }
.pd-button {
  min-height: 36px; border: 1px solid var(--app-border-strong, #334155); border-radius: 9px;
  padding: 7px 12px; background: transparent; color: var(--app-fg, #e5e7eb);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.pd-button:hover { background: var(--app-bg-3, rgba(255,255,255,.06)); }
.pd-button:disabled { opacity: .5; cursor: default; }
.pd-primary { background: var(--accent, #3b82f6); border-color: var(--accent, #3b82f6); color: var(--accent-fg, #fff); }
.pd-primary:hover { background: var(--accent, #3b82f6); filter: brightness(1.08); }
.pd-close { flex: 0 0 36px; border: 0; font-size: 22px; width: 36px; padding: 0 7px; }
.pd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.pd-actions { justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.pd-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; table-layout: fixed; }
.pd-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--app-fg-muted, #9ca3af); padding: 9px 6px; }
.pd-table td { border-top: 1px solid var(--app-border, #334155); padding: 10px 6px; vertical-align: top; overflow-wrap: anywhere; }
.pd-table th:last-child { width: 165px; }
.pd-row-actions { justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.pd-row-actions .pd-button { padding: 5px 8px; font-size: 11px; min-height: 30px; }
.pd-status { font-size: 12px; line-height: 1.5; min-height: 18px; margin-top: 10px; color: var(--app-fg-muted, #9ca3af); }
.pd-error { color: var(--app-danger, #f87171); }
.pd-result { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; background: var(--app-card-2, var(--app-bg-2, #0b1220)); border-radius: 9px; padding: 12px; margin-top: 10px; }
.pd-result:empty { display: none; }
.pd-disabled { opacity: .6; }
.pd-kicker { color: var(--accent, #60a5fa); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; align-self: center; }
.pd-sample { margin-top: 12px; }
.pd-sample textarea { margin: 5px 0; }
.pd-dialog details summary { cursor: pointer; font-size: 13px; font-weight: 600; padding: 9px 0; }
.pd-dialog [hidden] { display: none !important; }
body.light-mode .pd-overlay { background: rgba(15,23,42,.46); }
@media (max-width: 880px) {
  .pd-overlay { padding: 0; align-items: flex-end; }
  .pd-dialog { max-height: 92dvh; border-radius: 20px 20px 0 0; }
  .pd-body { padding: 18px; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .pd-dialog input, .pd-dialog textarea, .pd-dialog select { font-size: 16px; }
  .pd-button, .pd-row-actions .pd-button { min-height: 44px; }
  .pd-close { flex-basis: 44px; width: 44px; }
  .pd-dialog details summary { padding: 13px 0; }
}
@media (max-width: 600px) {
  .pd-header { padding: 14px 18px; }
  .pd-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pd-table, .pd-table tbody, .pd-table tr, .pd-table td { display: block; width: auto; }
  .pd-table thead { display: none; }
  .pd-table tr { border: 1px solid var(--app-border-strong); border-radius: 10px; padding: 10px; margin-top: 10px; }
  .pd-table td { border: 0; padding: 5px 0; }
  .pd-table td[data-label]::before { content: attr(data-label); display: block; color: var(--app-fg-muted); font-size: 11px; margin-bottom: 4px; }
  .pd-row-actions { justify-content: flex-start; }
  .pd-row-actions .pd-button { flex: 1 1 auto; }
  .pd-dialog h2 { font-size: 20px; }
  .pd-announcement .pd-actions .pd-button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .pd-overlay.app-overlay-modal, .pd-dialog.app-overlay-panel { animation: none; }
}
