/* Dialogs (ui/dialog.js) and the busy overlay (ui/busy.js). */

.app-dialog {
  border: 0;
  border-radius: 1rem;
  padding: 0;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .28);
  width: min(96vw, 520px);
  color: var(--text);
}
.app-dialog::backdrop { background: rgba(15, 23, 42, .45); }
/* A wider dialog sets its own width on .app-dialog.its-class (the card fills
   the dialog; widening only the card leaves it cut off on the right). */
.app-dialog-card { padding: 1rem; }
.app-dialog p { line-height: 1.45; }
.dialog-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}
.dialog-heading-row .small-note { margin-top: .35rem; }
.dialog-close-x {
  flex: none;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  border-radius: .6rem;
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .55rem;
  margin-top: 1rem;
}
.dialog-list { margin: .25rem 0 .75rem; padding-left: 1.2rem; line-height: 1.5; }
.dialog-side-action { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.dialog-side-action .small-note { margin: 0; }

/* Older iPadOS Safari has no showModal(); ui/dialog.js falls back to this.
   Without it dialog contents would sit inline in the page. */
dialog:not([open]) { display: none !important; }
dialog.dialog-fallback-active {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 9999 !important;
  margin: 0;
  max-height: calc(100vh - 1rem);
  max-height: calc(100svh - 1rem);
  overflow: auto;
}
.dialog-fallback-body { overflow: hidden; }
.dialog-fallback-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, .55);
}
.dialog-fallback-backdrop.is-visible { display: block; }

/* The company picker's two routes, each boxed so they read as alternatives. */
.company-select-section {
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
  background: #f8fafc;
  padding: .85rem 1rem .9rem;
  margin-bottom: .85rem;
}
.company-select-section .grid { margin-bottom: .6rem; }
.company-select-section .dialog-actions { margin-top: .6rem; justify-content: flex-start; }
.company-select-heading { margin: 0 0 .5rem; font-size: .98rem; font-weight: 600; }

@media (max-width: 480px) {
  .dialog-actions > button { flex: 1 1 100%; }
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.busy-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 28px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.busy-overlay-label { margin: 0; font-size: .9rem; color: var(--text); text-align: center; }
