/* Keep the header and actions outside the dialog's scrollable body. */
dialog.entry-dialog,
.regbox.dialog-panel {
  box-sizing: border-box;
  width: calc(100% - 16px);
  max-width: none;
  max-height: calc(100vh - 16px);
  max-height: calc(100dvh - 16px);
  padding: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  overflow-wrap: anywhere;
}
dialog.entry-dialog { margin: auto; }
dialog.entry-dialog[open],
.dialog-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
dialog.entry-dialog > .dialog-panel { flex: 1 1 auto; }
.dialog-header,
.dialog-footer {
  flex: none;
  padding: 12px clamp(12px, 2vw, 24px);
}
.dialog-header,
.dialog-footer,
.dialog-header h2,
.dialog-footer.row2 {
  margin: 0;
}
.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  padding: 8px clamp(12px, 2vw, 24px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
.dialog-header.row,
.dialog-footer,
.dialog-body .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dialog-body *,
.dialog-header *,
.dialog-footer * { min-width: 0; }
.entry-dialog :is(input:not([type=checkbox]):not([type=radio]), select, textarea) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.entry-dialog :is(button, .chip, td.num),
.regbox .dialog-footer a {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.dialog-footer:has(> button[hidden]:only-child),
.dialog-footer[hidden] { display: none; }
.entry-dialog :is(video, img, canvas) { max-width: 100%; }
.dialog-body table { width: 100%; table-layout: fixed; }
.entry-dialog .f2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.entry-dialog .f3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.entry-dialog .f4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .entry-dialog :is(.f3, .f4) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ut-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .ut-table :is(table, tbody, tr, td) { display: block; }
  .ut-table tr { margin-bottom: 12px; }
  .ut-table td::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
  }
}
@media (max-width: 480px) {
  .entry-dialog :is(.f2, .f3, .f4, .pmdims) { grid-template-columns: minmax(0, 1fr); }
  .dialog-body :is(td, th) { padding-inline: 4px; }
}

.entry-prompt { background: var(--panel, #182633); color: var(--text, var(--ink, #edf5ff)); }
.entry-prompt::backdrop { background: rgba(0, 0, 0, .65); }
.entry-prompt [data-label] { display: block; }
.entry-prompt [data-help] { margin-bottom: 10px; white-space: pre-line; }
.entry-prompt input {
  margin-top: 4px;
  border: 1px solid var(--line, #526275);
  border-radius: 8px;
  padding: 8px;
  background: #101923;
  color: inherit;
  font: inherit;
}
