/* The dialog shell stays in view; only the content area scrolls. */
#editor[open] {
  display: flex;
  flex-direction: column;
  max-height: min(90dvh, calc(100dvh - 32px));
  overflow: hidden;
}

#editor > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#editor .dialog-head,
#editor .dialog-footer {
  position: relative;
  inset: auto;
  flex: 0 0 auto;
  z-index: 1;
}

#editor .dialog-head { background: #fff; }
#editor .dialog-head h2 { min-width: 0; }
#editor .dialog-head .icon-button { flex-shrink: 0; }

#editor > .dialog-body,
#editor > .confirm-body,
#editor > form > .dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

body:has(#editor[open]) { overflow: hidden; }

.ai-review-hint { margin: -12px 0 16px; color: #637160; font-size: 12px; line-height: 1.8; }
.ai-review-notes { margin: 18px 0; }
.ai-review-notes > summary,
.ai-questions > summary { cursor: pointer; font-size: 13px; line-height: 1.8; color: #4f6545; }
.ai-review-notes > summary { min-height: 36px; padding: 8px 0; }
.ai-questions > summary { min-height: 32px; }
.ai-questions-content { padding-top: 8px; }
.ai-review-notes .ai-notices { margin: 8px 0 0; }

@media (max-width: 700px) {
  #editor[open] {
    height: 100dvh;
    max-height: 100dvh;
  }
  #editor.compact[open] {
    height: auto;
    max-height: calc(100dvh - 36px);
  }
  #editor .dialog-head { padding-top: max(19px, env(safe-area-inset-top)); }
  #editor .dialog-footer { flex-wrap: wrap; }
  #editor .dialog-footer > .actions,
  #editor .dialog-footer > .dialog-actions { flex-wrap: wrap; }
}
