/* Both show() and showModal() dialogs use viewport, never document-flow placement. */
dialog[open] {
  position: fixed !important;
  inset: 50% auto auto 50% !important;
  margin: 0 !important;
  transform: translate(-50%, -50%) !important;
  box-sizing: border-box;
  max-width: calc(100vw - 24px) !important;
  max-height: calc(100dvh - 24px) !important;
  overflow: auto !important;
  overscroll-behavior: contain;
}
.w3-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(11, 31, 25, .46);
  box-sizing: border-box;
}
.w3-modal-layer[hidden] { display: none !important; }
.w3-modal-card {
  width: min(520px, 100%);
  max-height: min(720px, calc(var(--w3-visual-height, 100dvh) - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #fff;
  color: #15231f;
  border: 1px solid #cbdad5;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}
.w3-modal-header { padding: 18px 20px 10px; }
.w3-modal-header h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.w3-modal-body { overflow: auto; padding: 8px 20px 18px; overscroll-behavior: contain; }
.w3-modal-message { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.w3-modal-input { width: 100%; min-height: 42px; margin-top: 14px; padding: 9px 11px; box-sizing: border-box; border: 1px solid #9db6ae; border-radius: 7px; font: inherit; }
.w3-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 18px; border-top: 1px solid #e1e9e6; background: #fbfdfc; }
.w3-modal-actions button { min-width: 88px; min-height: 40px; }
.w3-modal-actions [data-w3-modal-confirm] { background: #159447; color: #fff; border-color: #159447; }
body.w3-modal-open { overflow: hidden; }
@media (max-width: 480px), (max-height: 480px) {
  .w3-modal-layer { padding: 10px; }
  .w3-modal-card { width: 100%; max-height: calc(var(--w3-visual-height, 100dvh) - 20px); border-radius: 10px; }
  .w3-modal-header { padding: 14px 15px 8px; }
  .w3-modal-body { padding: 6px 15px 12px; }
  .w3-modal-actions { position: sticky; bottom: 0; padding: 10px 15px 14px; }
}
