:root {
  --common-dialog-z-index: 100;
}

#commonDialogOverlay,
.common-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--common-dialog-z-index, 100);
  padding: 16px;
  box-sizing: border-box;
}

#commonDialogOverlay.open,
.common-dialog-overlay.open {
  display: flex !important;
}

#commonDialogOverlay .common-dialog-panel,
.common-dialog-overlay .common-dialog-panel {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}

#commonDialogTitle {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  color: #111;
}

.common-dialog-message {
  white-space: pre-wrap;
  color: #333;
  line-height: 1.5;
  font-size: 13.5px;
  max-height: 55vh;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.common-dialog-input-wrap {
  margin-top: 10px;
}

#commonDialogInputLabel {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin: 10px 0 4px;
}

.common-dialog-input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
  box-sizing: border-box;
}

.common-dialog-input:focus {
  outline: none;
  border-color: #0b5da8;
}

textarea.common-dialog-input {
  min-height: 80px;
  resize: vertical;
}

#commonDialogError,
.common-dialog-error {
  font-size: 12.5px;
  color: #b71c1c;
  margin-top: 8px;
  min-height: 14px;
}

.common-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.common-dialog-button {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
}

.common-dialog-button.secondary {
  background: #f1f1ee;
  color: #555;
}

.common-dialog-button.secondary:hover {
  background: #e5e5e0;
}

.common-dialog-button.primary {
  background: #0b5da8;
  color: #fff;
}

.common-dialog-button.primary:hover {
  background: #094d8c;
}

.common-dialog-button.danger {
  background: #c62828;
  color: #fff;
}

.common-dialog-button.danger:hover {
  background: #b71c1c;
}

#commonDialogOverlay [hidden],
.common-dialog-overlay [hidden],
.common-dialog-input-wrap[hidden],
.common-dialog-input[hidden],
.common-dialog-button[hidden],
#commonDialogCancel[hidden] {
  display: none !important;
}
